diff options
author | Josh Matthews <josh@joshmatthews.net> | 2018-12-02 14:58:15 -0500 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2019-01-15 14:00:13 -0500 |
commit | 367014a4ea5b3fff5e4f33df199db0fdb7a95925 (patch) | |
tree | da0e8b17e5064337c11877b1ef724e92a14f690a /components/script/script_thread.rs | |
parent | 644101e1e42a98996ff98c4cb8fb3cb6dd18be94 (diff) | |
download | servo-367014a4ea5b3fff5e4f33df199db0fdb7a95925.tar.gz servo-367014a4ea5b3fff5e4f33df199db0fdb7a95925.zip |
Reintroduce parent runtimes for worker threads.
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 9247ca6afba..2053b10fa88 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -100,6 +100,7 @@ use js::glue::GetWindowProxyClass; use js::jsapi::{JSAutoCompartment, JSContext, JS_SetWrapObjectCallbacks}; use js::jsapi::{JSTracer, SetWindowProxyClass}; use js::jsval::UndefinedValue; +use js::rust::ParentRuntime; use metrics::{PaintTimeMetrics, MAX_TASK_NS}; use mime::{self, Mime}; use msg::constellation_msg::{ @@ -725,6 +726,13 @@ impl ScriptThreadFactory for ScriptThread { } impl ScriptThread { + pub fn runtime_handle() -> ParentRuntime { + SCRIPT_THREAD_ROOT.with(|root| { + let script_thread = unsafe { &*root.get().unwrap() }; + script_thread.js_runtime.prepare_for_new_child() + }) + } + pub unsafe fn note_newly_transitioning_nodes(nodes: Vec<UntrustedNodeAddress>) { SCRIPT_THREAD_ROOT.with(|root| { let script_thread = &*root.get().unwrap(); @@ -1009,7 +1017,7 @@ impl ScriptThread { port: Receiver<MainThreadScriptMsg>, chan: Sender<MainThreadScriptMsg>, ) -> ScriptThread { - let runtime = unsafe { new_rt_and_cx() }; + let runtime = new_rt_and_cx(); let cx = runtime.cx(); unsafe { |