diff options
author | Till Schneidereit <till@tillschneidereit.net> | 2016-05-24 15:28:25 +0200 |
---|---|---|
committer | Till Schneidereit <till@tillschneidereit.net> | 2016-05-24 17:43:49 +0200 |
commit | 7536afff2a8cd77fd5d0ae6b3324a430eae8ae67 (patch) | |
tree | 793132136678cdcd3403317d19e9ed71a5886969 /components/script/script_thread.rs | |
parent | 2ce9eba3dc87348c5de235883295f0f6ead4317e (diff) | |
download | servo-7536afff2a8cd77fd5d0ae6b3324a430eae8ae67.tar.gz servo-7536afff2a8cd77fd5d0ae6b3324a430eae8ae67.zip |
Pass a parent JS runtime when creating DOM Worker runtimes
This enables sharing data with the parent runtime, decreasing memory usage and startup time. Also contains an update to current rust-mozjs, because that's required for this to work.
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 330eebafdfe..c26ea4461b9 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -88,6 +88,7 @@ use std::borrow::ToOwned; use std::cell::{Cell, RefCell}; use std::collections::HashSet; use std::option::Option; +use std::ptr; use std::rc::Rc; use std::result::Result; use std::sync::atomic::{Ordering, AtomicBool}; @@ -456,8 +457,8 @@ impl ScriptThreadFactory for ScriptThread { let mem_profiler_chan = state.mem_profiler_chan.clone(); let window_size = state.window_size; let script_thread = ScriptThread::new(state, - script_port, - script_chan.clone()); + script_port, + script_chan.clone()); SCRIPT_THREAD_ROOT.with(|root| { *root.borrow_mut() = Some(&script_thread as *const _); @@ -531,7 +532,7 @@ impl ScriptThread { port: Receiver<MainThreadScriptMsg>, chan: Sender<MainThreadScriptMsg>) -> ScriptThread { - let runtime = unsafe { new_rt_and_cx() }; + let runtime = unsafe { new_rt_and_cx(ptr::null_mut()) }; unsafe { JS_SetWrapObjectCallbacks(runtime.rt(), |