mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Reintroduce parent runtimes for worker threads.
This commit is contained in:
parent
644101e1e4
commit
367014a4ea
7 changed files with 49 additions and 14 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue