Auto merge of #10641 - asajeffrey:dedicated-panic-channel, r=Manishearth

Dedicated panic channel

Added a dedicated panic channel, and removed the panic messages for the script and layout threads. This is needed so that other threads can report panics, which is part of #10334.

Note that this PR includes the commit from #10572, so should land after it lands.

r? @Manishearth

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10641)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-04-19 21:58:07 +05:30
commit bd4b3a66a2
13 changed files with 108 additions and 232 deletions

View file

@ -12,7 +12,7 @@ use euclid::point::Point2D;
use euclid::rect::Rect;
use gfx_traits::{Epoch, LayerId};
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use msg::constellation_msg::{ConstellationChan, PanicMsg, PipelineId};
use msg::constellation_msg::{WindowSizeData};
use net_traits::image_cache_thread::ImageCacheThread;
use profile_traits::mem::ReportsChan;
@ -250,7 +250,7 @@ pub struct NewLayoutThreadInfo {
pub layout_pair: OpaqueScriptLayoutChannel,
pub pipeline_port: IpcReceiver<LayoutControlMsg>,
pub constellation_chan: ConstellationChan<ConstellationMsg>,
pub failure: Failure,
pub panic_chan: ConstellationChan<PanicMsg>,
pub script_chan: IpcSender<ConstellationControlMsg>,
pub image_cache_thread: ImageCacheThread,
pub paint_chan: OptionalOpaqueIpcSender,

View file

@ -389,7 +389,7 @@ pub struct ScriptThread {
content_process_shutdown_chan: IpcSender<()>,
}
/// In the event of thread failure, all data on the stack runs its destructor. However, there
/// In the event of thread panic, all data on the stack runs its destructor. However, there
/// are no reachable, owning pointers to the DOM memory, so it never gets freed by default
/// when the script thread fails. The ScriptMemoryFailsafe uses the destructor bomb pattern
/// to forcibly tear down the JS compartments for pages associated with the failing ScriptThread.
@ -442,11 +442,11 @@ impl ScriptThreadFactory for ScriptThread {
state: InitialScriptState,
layout_chan: &OpaqueScriptLayoutChannel,
load_data: LoadData) {
let ConstellationChan(const_chan) = state.constellation_chan.clone();
let ConstellationChan(panic_chan) = state.panic_chan.clone();
let (script_chan, script_port) = channel();
let layout_chan = LayoutChan(layout_chan.sender());
let failure_info = state.failure_info.clone();
thread::spawn_named_with_send_on_failure(format!("ScriptThread {:?}", state.id),
let pipeline_id = state.id;
thread::spawn_named_with_send_on_panic(format!("ScriptThread {:?}", state.id),
thread_state::SCRIPT,
move || {
PipelineNamespace::install(state.pipeline_namespace_id);
@ -481,7 +481,7 @@ impl ScriptThreadFactory for ScriptThread {
// This must always be the very last operation performed before the thread completes
failsafe.neuter();
}, failure_info, const_chan);
}, Some(pipeline_id), panic_chan);
}
}
@ -1061,7 +1061,7 @@ impl ScriptThread {
subpage_id,
load_data,
paint_chan,
failure,
panic_chan,
pipeline_port,
layout_shutdown_chan,
content_process_shutdown_chan,
@ -1079,7 +1079,7 @@ impl ScriptThread {
layout_pair: layout_pair,
pipeline_port: pipeline_port,
constellation_chan: self.layout_to_constellation_chan.clone(),
failure: failure,
panic_chan: panic_chan,
paint_chan: paint_chan,
script_chan: self.control_chan.clone(),
image_cache_thread: self.image_cache_thread.clone(),