diff options
author | Rahul Sharma <rsconceptx@gmail.com> | 2016-06-09 18:52:52 +0530 |
---|---|---|
committer | Rahul Sharma <rsconceptx@gmail.com> | 2016-07-16 23:29:44 +0530 |
commit | 1e6293ea1d06120c9f3488d7d32c24d8d92df6b1 (patch) | |
tree | ffc6addc9aff4eeb5562fd1b3b588603532b38c4 /components/servo/lib.rs | |
parent | e8fa02a07f3ee8965c022df4e92d5bdb0fccdb0b (diff) | |
download | servo-1e6293ea1d06120c9f3488d7d32c24d8d92df6b1.tar.gz servo-1e6293ea1d06120c9f3488d7d32c24d8d92df6b1.zip |
Integrate service worker manager thread
Diffstat (limited to 'components/servo/lib.rs')
-rw-r--r-- | components/servo/lib.rs | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 20aee632c1d..0b8f5756a36 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -83,7 +83,7 @@ use profile::mem as profile_mem; use profile::time as profile_time; use profile_traits::mem; use profile_traits::time; -use script_traits::{ConstellationMsg, ScriptMsg}; +use script_traits::{ConstellationMsg, ScriptMsg, SWManagerMsg}; use std::cmp::max; use std::rc::Rc; use std::sync::mpsc::Sender; @@ -114,7 +114,6 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static { // Global configuration options, parsed from the command line. let opts = opts::get(); - script::init(); // Get both endpoints of a special channel for communication between // the client window and the compositor. This channel is unique because @@ -160,13 +159,16 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static { // Create the constellation, which maintains the engine // pipelines, including the script and layout threads, as well // as the navigation context. - let constellation_chan = create_constellation(opts.clone(), - compositor_proxy.clone_compositor_proxy(), - time_profiler_chan.clone(), - mem_profiler_chan.clone(), - devtools_chan, - supports_clipboard, - webrender_api_sender.clone()); + let (constellation_chan, swmanager_sender) = create_constellation(opts.clone(), + compositor_proxy.clone_compositor_proxy(), + time_profiler_chan.clone(), + mem_profiler_chan.clone(), + devtools_chan, + supports_clipboard, + webrender_api_sender.clone()); + + // Send the constellation's swmanager sender to service worker manager thread + script::init(swmanager_sender); if cfg!(feature = "webdriver") { if let Some(port) = opts.webdriver_port { @@ -227,7 +229,8 @@ fn create_constellation(opts: opts::Opts, mem_profiler_chan: mem::ProfilerChan, devtools_chan: Option<Sender<devtools_traits::DevtoolsControlMsg>>, supports_clipboard: bool, - webrender_api_sender: Option<webrender_traits::RenderApiSender>) -> Sender<ConstellationMsg> { + webrender_api_sender: Option<webrender_traits::RenderApiSender>) + -> (Sender<ConstellationMsg>, IpcSender<SWManagerMsg>) { let bluetooth_thread: IpcSender<BluetoothMethodMsg> = BluetoothThreadFactory::new(); let (public_resource_threads, private_resource_threads) = @@ -252,7 +255,7 @@ fn create_constellation(opts: opts::Opts, supports_clipboard: supports_clipboard, webrender_api_sender: webrender_api_sender, }; - let constellation_chan = + let (constellation_chan, from_swmanager_sender) = Constellation::<script_layout_interface::message::Msg, layout_thread::LayoutThread, script::script_thread::ScriptThread>::start(initial_state); @@ -261,7 +264,7 @@ fn create_constellation(opts: opts::Opts, constellation_chan.send(ConstellationMsg::InitLoadUrl(url)).unwrap(); }; - constellation_chan + (constellation_chan, from_swmanager_sender) } // A logger that logs to two downstream loggers. @@ -308,7 +311,9 @@ pub fn run_content_process(token: String) { create_sandbox(); } - script::init(); + // Send the constellation sender to service worker manager thread + let from_swmanager_sender = unprivileged_content.swmanager_chan(); + script::init(from_swmanager_sender); unprivileged_content.start_all::<script_layout_interface::message::Msg, layout_thread::LayoutThread, |