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:
Till Schneidereit 2016-05-24 15:28:25 +02:00
parent 2ce9eba3dc
commit 7536afff2a
7 changed files with 22 additions and 13 deletions

View file

@ -213,7 +213,8 @@ impl DedicatedWorkerGlobalScope {
worker_url: Url,
id: PipelineId,
from_devtools_receiver: IpcReceiver<DevtoolScriptControlMsg>,
main_thread_rt: Arc<Mutex<Option<SharedRt>>>,
parent_rt: SharedRt,
worker_rt_for_mainthread: Arc<Mutex<Option<SharedRt>>>,
worker: TrustedWorkerAddress,
parent_sender: Box<ScriptChan + Send>,
own_sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>,
@ -240,8 +241,8 @@ impl DedicatedWorkerGlobalScope {
}
};
let runtime = unsafe { new_rt_and_cx() };
*main_thread_rt.lock().unwrap() = Some(SharedRt::new(&runtime));
let runtime = unsafe { new_rt_and_cx(parent_rt.rt()) };
*worker_rt_for_mainthread.lock().unwrap() = Some(SharedRt::new(&runtime));
let (devtools_mpsc_chan, devtools_mpsc_port) = channel();
ROUTER.route_ipc_receiver_to_mpsc_sender(from_devtools_receiver, devtools_mpsc_chan);