servo: Merge #10641 - Dedicated panic channel (from asajeffrey:dedicated-panic-channel); r=Manishearth

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

Source-Repo: https://github.com/servo/servo
Source-Revision: bd4b3a66a2aa57ab6fa881e3cc11091edc494a68
This commit is contained in:
Alan Jeffrey
2016-04-19 21:28:07 +05:00
parent 3a0351b7c1
commit 73bf0ef347
13 changed files with 108 additions and 232 deletions

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(),