mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
Added a dedicated panic channel.
This commit is contained in:
parent
a7c885706e
commit
cfb066ef20
13 changed files with 108 additions and 232 deletions
|
@ -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,
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue