mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01: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
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue