Move workers' pipeline IDs to WorkerGlobalScope

This commit is contained in:
Anthony Ramine 2016-10-01 16:58:36 +02:00
parent fce0a8e7cf
commit 4ccdbccdd7
5 changed files with 11 additions and 35 deletions

View file

@ -81,7 +81,6 @@ enum MixedMessage {
#[dom_struct]
pub struct DedicatedWorkerGlobalScope {
workerglobalscope: WorkerGlobalScope,
id: PipelineId,
#[ignore_heap_size_of = "Defined in std"]
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>,
#[ignore_heap_size_of = "Defined in std"]
@ -100,7 +99,6 @@ pub struct DedicatedWorkerGlobalScope {
impl DedicatedWorkerGlobalScope {
fn new_inherited(init: WorkerGlobalScopeInit,
worker_url: Url,
id: PipelineId,
from_devtools_receiver: Receiver<DevtoolScriptControlMsg>,
runtime: Runtime,
parent_sender: Box<ScriptChan + Send>,
@ -117,7 +115,6 @@ impl DedicatedWorkerGlobalScope {
from_devtools_receiver,
timer_event_chan,
Some(closing)),
id: id,
receiver: receiver,
own_sender: own_sender,
timer_event_port: timer_event_port,
@ -129,7 +126,6 @@ impl DedicatedWorkerGlobalScope {
pub fn new(init: WorkerGlobalScopeInit,
worker_url: Url,
id: PipelineId,
from_devtools_receiver: Receiver<DevtoolScriptControlMsg>,
runtime: Runtime,
parent_sender: Box<ScriptChan + Send>,
@ -142,7 +138,6 @@ impl DedicatedWorkerGlobalScope {
let cx = runtime.cx();
let scope = box DedicatedWorkerGlobalScope::new_inherited(init,
worker_url,
id,
from_devtools_receiver,
runtime,
parent_sender,
@ -157,7 +152,6 @@ impl DedicatedWorkerGlobalScope {
#[allow(unsafe_code)]
pub fn run_worker_scope(init: WorkerGlobalScopeInit,
worker_url: Url,
id: PipelineId,
from_devtools_receiver: IpcReceiver<DevtoolScriptControlMsg>,
worker_rt_for_mainthread: Arc<Mutex<Option<SharedRt>>>,
worker: TrustedWorkerAddress,
@ -170,7 +164,7 @@ impl DedicatedWorkerGlobalScope {
let name = format!("WebWorker for {}", serialized_worker_url);
spawn_named(name, move || {
thread_state::initialize(thread_state::SCRIPT | thread_state::IN_WORKER);
PipelineId::install(id);
PipelineId::install(init.pipeline_id);
let roots = RootCollection::new();
let _stack_roots_tls = StackRootTLS::new(&roots);
@ -204,7 +198,7 @@ impl DedicatedWorkerGlobalScope {
});
let global = DedicatedWorkerGlobalScope::new(
init, url, id, devtools_mpsc_port, runtime,
init, url, devtools_mpsc_port, runtime,
parent_sender.clone(), own_sender, receiver,
timer_ipc_chan, timer_rx, closing);
// FIXME(njn): workers currently don't have a unique ID suitable for using in reporter
@ -244,10 +238,6 @@ impl DedicatedWorkerGlobalScope {
}
}
pub fn pipeline_id(&self) -> PipelineId {
self.id
}
pub fn new_script_pair(&self) -> (Box<ScriptChan + Send>, Box<ScriptPort + Send>) {
let (tx, rx) = channel();
let chan = box SendableWorkerScriptChan {