mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #8599 - jdm:e10s-redux, r=metajack
compositing: Split Servo up into multiple sandboxed processes. Multiprocess mode is enabled with the `-M` switch, and sandboxing is enabled with the `-S` switch. Rebase of #6884. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8599) <!-- Reviewable:end -->
This commit is contained in:
commit
8b39b9afed
33 changed files with 688 additions and 265 deletions
|
@ -53,7 +53,7 @@ use js::jsval::JSVal;
|
|||
use js::rust::Runtime;
|
||||
use layout_interface::{LayoutChan, LayoutRPC};
|
||||
use libc;
|
||||
use msg::constellation_msg::ConstellationChan;
|
||||
use msg::constellation_msg::{ConstellationChan, ScriptMsg};
|
||||
use msg::constellation_msg::{PipelineId, SubpageId, WindowSizeData, WorkerId};
|
||||
use net_traits::Metadata;
|
||||
use net_traits::image::base::Image;
|
||||
|
@ -275,7 +275,6 @@ no_jsmanaged_fields!(WorkerId);
|
|||
no_jsmanaged_fields!(QuirksMode);
|
||||
no_jsmanaged_fields!(Runtime);
|
||||
no_jsmanaged_fields!(Headers, Method);
|
||||
no_jsmanaged_fields!(ConstellationChan<ConstellationMsg>);
|
||||
no_jsmanaged_fields!(LayoutChan);
|
||||
no_jsmanaged_fields!(WindowProxyHandler);
|
||||
no_jsmanaged_fields!(UntrustedNodeAddress);
|
||||
|
@ -299,6 +298,13 @@ no_jsmanaged_fields!(AttrIdentifier);
|
|||
no_jsmanaged_fields!(AttrValue);
|
||||
no_jsmanaged_fields!(ElementSnapshot);
|
||||
|
||||
impl JSTraceable for ConstellationChan<ScriptMsg> {
|
||||
#[inline]
|
||||
fn trace(&self, _trc: *mut JSTracer) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
impl JSTraceable for Box<ScriptChan + Send> {
|
||||
#[inline]
|
||||
fn trace(&self, _trc: *mut JSTracer) {
|
||||
|
|
|
@ -29,6 +29,8 @@ use string_cache::Atom;
|
|||
use style::animation::PropertyAnimation;
|
||||
use style::stylesheets::Stylesheet;
|
||||
use url::Url;
|
||||
use util::ipc::OptionalOpaqueIpcSender;
|
||||
|
||||
pub use dom::node::TrustedNodeAddress;
|
||||
|
||||
/// Asynchronous messages that script can send to layout.
|
||||
|
@ -254,8 +256,9 @@ pub struct NewLayoutTaskInfo {
|
|||
pub pipeline_port: IpcReceiver<LayoutControlMsg>,
|
||||
pub constellation_chan: ConstellationChan<ConstellationMsg>,
|
||||
pub failure: Failure,
|
||||
pub script_chan: Sender<ConstellationControlMsg>,
|
||||
pub script_chan: IpcSender<ConstellationControlMsg>,
|
||||
pub image_cache_task: ImageCacheTask,
|
||||
pub paint_chan: Box<Any + Send>,
|
||||
pub layout_shutdown_chan: Sender<()>,
|
||||
pub paint_chan: OptionalOpaqueIpcSender,
|
||||
pub layout_shutdown_chan: IpcSender<()>,
|
||||
pub content_process_shutdown_chan: IpcSender<()>,
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ use time::{Tm, now};
|
|||
use url::{Url, UrlParser};
|
||||
use util::opts;
|
||||
use util::str::DOMString;
|
||||
use util::task::spawn_named_with_send_on_failure;
|
||||
use util::task;
|
||||
use util::task_state;
|
||||
use webdriver_handlers;
|
||||
|
||||
|
@ -232,8 +232,9 @@ pub enum ScriptTaskEventCategory {
|
|||
Resize,
|
||||
ScriptEvent,
|
||||
TimerEvent,
|
||||
UpdateReplacedElement,
|
||||
SetViewport,
|
||||
StylesheetLoad,
|
||||
UpdateReplacedElement,
|
||||
WebSocketEvent,
|
||||
WorkerEvent,
|
||||
}
|
||||
|
@ -396,7 +397,7 @@ pub struct ScriptTask {
|
|||
chan: MainThreadScriptChan,
|
||||
|
||||
/// A channel to hand out to tasks that need to respond to a message from the script task.
|
||||
control_chan: Sender<ConstellationControlMsg>,
|
||||
control_chan: IpcSender<ConstellationControlMsg>,
|
||||
|
||||
/// The port on which the constellation and layout tasks can communicate with the
|
||||
/// script task.
|
||||
|
@ -438,6 +439,8 @@ pub struct ScriptTask {
|
|||
scheduler_chan: IpcSender<TimerEventRequest>,
|
||||
timer_event_chan: Sender<TimerEvent>,
|
||||
timer_event_port: Receiver<TimerEvent>,
|
||||
|
||||
content_process_shutdown_chan: IpcSender<()>,
|
||||
}
|
||||
|
||||
/// In the event of task failure, all data on the stack runs its destructor. However, there
|
||||
|
@ -484,7 +487,8 @@ impl ScriptTaskFactory for ScriptTask {
|
|||
ScriptLayoutChan::new(chan, port)
|
||||
}
|
||||
|
||||
fn clone_layout_channel(_phantom: Option<&mut ScriptTask>, pair: &OpaqueScriptLayoutChannel) -> Box<Any + Send> {
|
||||
fn clone_layout_channel(_phantom: Option<&mut ScriptTask>, pair: &OpaqueScriptLayoutChannel)
|
||||
-> Box<Any + Send> {
|
||||
box pair.sender() as Box<Any + Send>
|
||||
}
|
||||
|
||||
|
@ -496,9 +500,10 @@ impl ScriptTaskFactory for ScriptTask {
|
|||
let (script_chan, script_port) = channel();
|
||||
let layout_chan = LayoutChan(layout_chan.sender());
|
||||
let failure_info = state.failure_info;
|
||||
spawn_named_with_send_on_failure(format!("ScriptTask {:?}", state.id), task_state::SCRIPT, move || {
|
||||
task::spawn_named_with_send_on_failure(format!("ScriptTask {:?}", state.id),
|
||||
task_state::SCRIPT,
|
||||
move || {
|
||||
PipelineNamespace::install(state.pipeline_namespace_id);
|
||||
|
||||
let roots = RootCollection::new();
|
||||
let _stack_roots_tls = StackRootTLS::new(&roots);
|
||||
let chan = MainThreadScriptChan(script_chan);
|
||||
|
@ -524,6 +529,7 @@ impl ScriptTaskFactory for ScriptTask {
|
|||
let reporter_name = format!("script-reporter-{}", id);
|
||||
mem_profiler_chan.run_with_memory_reporting(|| {
|
||||
script_task.start();
|
||||
let _ = script_task.content_process_shutdown_chan.send(());
|
||||
}, reporter_name, channel_for_reporter, CommonScriptMsg::CollectReports);
|
||||
|
||||
// This must always be the very last operation performed before the task completes
|
||||
|
@ -636,6 +642,9 @@ impl ScriptTask {
|
|||
|
||||
let (timer_event_chan, timer_event_port) = channel();
|
||||
|
||||
// Ask the router to proxy IPC messages from the control port to us.
|
||||
let control_port = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(state.control_port);
|
||||
|
||||
ScriptTask {
|
||||
page: DOMRefCell::new(None),
|
||||
incomplete_loads: DOMRefCell::new(vec!()),
|
||||
|
@ -650,7 +659,7 @@ impl ScriptTask {
|
|||
port: port,
|
||||
chan: chan,
|
||||
control_chan: state.control_chan,
|
||||
control_port: state.control_port,
|
||||
control_port: control_port,
|
||||
constellation_chan: state.constellation_chan,
|
||||
compositor: DOMRefCell::new(state.compositor),
|
||||
time_profiler_chan: state.time_profiler_chan,
|
||||
|
@ -667,6 +676,8 @@ impl ScriptTask {
|
|||
scheduler_chan: state.scheduler_chan,
|
||||
timer_event_chan: timer_event_chan,
|
||||
timer_event_port: timer_event_port,
|
||||
|
||||
content_process_shutdown_chan: state.content_process_shutdown_chan,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -940,7 +951,10 @@ impl ScriptTask {
|
|||
ScriptTaskEventCategory::NetworkEvent => ProfilerCategory::ScriptNetworkEvent,
|
||||
ScriptTaskEventCategory::Resize => ProfilerCategory::ScriptResize,
|
||||
ScriptTaskEventCategory::ScriptEvent => ProfilerCategory::ScriptEvent,
|
||||
ScriptTaskEventCategory::UpdateReplacedElement => ProfilerCategory::ScriptUpdateReplacedElement,
|
||||
ScriptTaskEventCategory::UpdateReplacedElement => {
|
||||
ProfilerCategory::ScriptUpdateReplacedElement
|
||||
}
|
||||
ScriptTaskEventCategory::StylesheetLoad => ProfilerCategory::ScriptStylesheetLoad,
|
||||
ScriptTaskEventCategory::SetViewport => ProfilerCategory::ScriptSetViewport,
|
||||
ScriptTaskEventCategory::TimerEvent => ProfilerCategory::ScriptTimerEvent,
|
||||
ScriptTaskEventCategory::WebSocketEvent => ProfilerCategory::ScriptWebSocketEvent,
|
||||
|
@ -1185,6 +1199,7 @@ impl ScriptTask {
|
|||
failure,
|
||||
pipeline_port,
|
||||
layout_shutdown_chan,
|
||||
content_process_shutdown_chan,
|
||||
} = new_layout_info;
|
||||
|
||||
let layout_pair = ScriptTask::create_layout_channel(None::<&mut ScriptTask>);
|
||||
|
@ -1204,6 +1219,7 @@ impl ScriptTask {
|
|||
script_chan: self.control_chan.clone(),
|
||||
image_cache_task: self.image_cache_task.clone(),
|
||||
layout_shutdown_chan: layout_shutdown_chan,
|
||||
content_process_shutdown_chan: content_process_shutdown_chan,
|
||||
};
|
||||
|
||||
let page = self.root_page();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue