aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2018-12-02 14:58:15 -0500
committerJosh Matthews <josh@joshmatthews.net>2019-01-15 14:00:13 -0500
commit367014a4ea5b3fff5e4f33df199db0fdb7a95925 (patch)
treeda0e8b17e5064337c11877b1ef724e92a14f690a /components/script/script_thread.rs
parent644101e1e42a98996ff98c4cb8fb3cb6dd18be94 (diff)
downloadservo-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.rs10
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 {