Make prepare_workerscope_init take a &GlobalScope

This commit is contained in:
Anthony Ramine 2016-10-03 18:47:58 +02:00
parent 9a48ebb245
commit 83feb7dee3
3 changed files with 11 additions and 20 deletions

View file

@ -60,7 +60,7 @@ impl ServiceWorkerRegistration {
let worker_id = global_scope.get_next_worker_id(); let worker_id = global_scope.get_next_worker_id();
let devtools_chan = global_scope.devtools_chan().cloned(); let devtools_chan = global_scope.devtools_chan().cloned();
let init = prepare_workerscope_init(global, None); let init = prepare_workerscope_init(global_scope, None);
ScopeThings { ScopeThings {
script_url: script_url, script_url: script_url,
init: init, init: init,

View file

@ -105,7 +105,7 @@ impl Worker {
page_info)); page_info));
} }
let init = prepare_workerscope_init(global, Some(devtools_sender)); let init = prepare_workerscope_init(global_scope, Some(devtools_sender));
DedicatedWorkerGlobalScope::run_worker_scope( DedicatedWorkerGlobalScope::run_worker_scope(
init, worker_url, devtools_receiver, worker.runtime.clone(), worker_ref, init, worker_url, devtools_receiver, worker.runtime.clone(), worker_ref,

View file

@ -46,27 +46,18 @@ use task_source::file_reading::FileReadingTaskSource;
use timers::{IsInterval, OneshotTimerCallback, OneshotTimerHandle, OneshotTimers, TimerCallback}; use timers::{IsInterval, OneshotTimerCallback, OneshotTimerHandle, OneshotTimers, TimerCallback};
use url::Url; use url::Url;
pub fn prepare_workerscope_init(global: GlobalRef, pub fn prepare_workerscope_init(global: &GlobalScope,
devtools_sender: Option<IpcSender<DevtoolScriptControlMsg>>) -> WorkerGlobalScopeInit { devtools_sender: Option<IpcSender<DevtoolScriptControlMsg>>) -> WorkerGlobalScopeInit {
let global_scope = global.as_global_scope();
let worker_id = global_scope.get_next_worker_id();
let to_devtools_sender = global_scope.devtools_chan().cloned();
let mem_profiler_chan = global_scope.mem_profiler_chan().clone();
let time_profiler_chan = global_scope.time_profiler_chan().clone();
let constellation_chan = global_scope.constellation_chan().clone();
let scheduler_chan = global_scope.scheduler_chan().clone();
let pipeline_id = global_scope.pipeline_id();
let resource_threads = global_scope.resource_threads().clone();
let init = WorkerGlobalScopeInit { let init = WorkerGlobalScopeInit {
resource_threads: resource_threads, resource_threads: global.resource_threads().clone(),
mem_profiler_chan: mem_profiler_chan, mem_profiler_chan: global.mem_profiler_chan().clone(),
to_devtools_sender: to_devtools_sender, to_devtools_sender: global.devtools_chan().cloned(),
time_profiler_chan: time_profiler_chan, time_profiler_chan: global.time_profiler_chan().clone(),
from_devtools_sender: devtools_sender, from_devtools_sender: devtools_sender,
constellation_chan: constellation_chan, constellation_chan: global.constellation_chan().clone(),
scheduler_chan: scheduler_chan, scheduler_chan: global.scheduler_chan().clone(),
worker_id: worker_id, worker_id: global.get_next_worker_id(),
pipeline_id: pipeline_id, pipeline_id: global.pipeline_id(),
}; };
init init