mirror of
https://github.com/servo/servo.git
synced 2025-06-13 19:04:30 +00:00
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.
This commit is contained in:
parent
2ce9eba3dc
commit
7536afff2a
7 changed files with 22 additions and 13 deletions
|
@ -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(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue