Bind runnable dispatching in script_runtime

This commit is contained in:
Akash-Pateria 2019-11-16 22:42:43 -05:00 committed by Josh Matthews
parent e6ae93f66e
commit 84f16eae98
69 changed files with 164 additions and 427 deletions

View file

@ -32,6 +32,7 @@ use crate::script_runtime::{
new_child_runtime, CommonScriptMsg, JSContext as SafeJSContext, Runtime, ScriptChan, ScriptPort,
};
use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue};
use crate::task_source::networking::NetworkingTaskSource;
use crate::task_source::TaskSourceName;
use crossbeam_channel::{unbounded, Receiver, Sender};
use devtools_traits::DevtoolScriptControlMsg;
@ -344,7 +345,16 @@ impl DedicatedWorkerGlobalScope {
.referrer_policy(referrer_policy)
.origin(origin);
let runtime = unsafe { new_child_runtime(parent) };
let runtime = unsafe {
if let Some(pipeline_id) = pipeline_id {
new_child_runtime(
parent,
Some(NetworkingTaskSource(parent_sender.clone(), pipeline_id)),
)
} else {
new_child_runtime(parent, None)
}
};
let (devtools_mpsc_chan, devtools_mpsc_port) = unbounded();
ROUTER.route_ipc_receiver_to_crossbeam_sender(

View file

@ -315,7 +315,7 @@ impl ServiceWorkerGlobalScope {
},
};
let runtime = new_rt_and_cx();
let runtime = new_rt_and_cx(None);
let (devtools_mpsc_chan, devtools_mpsc_port) = unbounded();
ROUTER

View file

@ -477,7 +477,7 @@ impl WorkletThread {
global_init: init.global_init,
global_scopes: HashMap::new(),
control_buffer: None,
runtime: new_rt_and_cx(),
runtime: new_rt_and_cx(None),
should_gc: false,
gc_threshold: MIN_GC_THRESHOLD,
});