Introduce GlobalScope::mem_profiler_chan

This commit is contained in:
Anthony Ramine 2016-10-01 03:53:20 +02:00
parent fe6fca9e1f
commit bfa7d045d0
6 changed files with 24 additions and 32 deletions

View file

@ -35,7 +35,7 @@ use js::rust::Runtime;
use msg::constellation_msg::{PipelineId, ReferrerPolicy};
use net_traits::{IpcSend, LoadOrigin};
use net_traits::{LoadContext, ResourceThreads, load_whole_resource};
use profile_traits::{mem, time};
use profile_traits::time;
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, maybe_take_panic_result};
use script_runtime::{ScriptThreadEventCategory, PromiseJobQueue, EnqueuedPromiseCallback};
use script_thread::{Runnable, RunnableWrapper};
@ -58,9 +58,10 @@ pub fn prepare_workerscope_init(global: GlobalRef,
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 init = WorkerGlobalScopeInit {
resource_threads: global.resource_threads(),
mem_profiler_chan: global.mem_profiler_chan().clone(),
mem_profiler_chan: mem_profiler_chan,
to_devtools_sender: to_devtools_sender,
time_profiler_chan: global.time_profiler_chan().clone(),
from_devtools_sender: devtools_sender,
@ -91,8 +92,6 @@ pub struct WorkerGlobalScope {
navigator: MutNullableHeap<JS<WorkerNavigator>>,
timers: OneshotTimers,
#[ignore_heap_size_of = "Defined in std"]
mem_profiler_chan: mem::ProfilerChan,
#[ignore_heap_size_of = "Defined in std"]
time_profiler_chan: time::ProfilerChan,
@ -127,7 +126,8 @@ impl WorkerGlobalScope {
closing: Option<Arc<AtomicBool>>)
-> WorkerGlobalScope {
WorkerGlobalScope {
globalscope: GlobalScope::new_inherited(init.to_devtools_sender),
globalscope:
GlobalScope::new_inherited(init.to_devtools_sender, init.mem_profiler_chan),
worker_id: init.worker_id,
pipeline_id: init.pipeline_id,
worker_url: worker_url,
@ -137,7 +137,6 @@ impl WorkerGlobalScope {
location: Default::default(),
navigator: Default::default(),
timers: OneshotTimers::new(timer_event_chan, init.scheduler_chan.clone()),
mem_profiler_chan: init.mem_profiler_chan,
time_profiler_chan: init.time_profiler_chan,
from_devtools_sender: init.from_devtools_sender,
from_devtools_receiver: from_devtools_receiver,
@ -148,10 +147,6 @@ impl WorkerGlobalScope {
}
}
pub fn mem_profiler_chan(&self) -> &mem::ProfilerChan {
&self.mem_profiler_chan
}
pub fn time_profiler_chan(&self) -> &time::ProfilerChan {
&self.time_profiler_chan
}