mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Introduce GlobalScope::mem_profiler_chan
This commit is contained in:
parent
fe6fca9e1f
commit
bfa7d045d0
6 changed files with 24 additions and 32 deletions
|
@ -11,6 +11,7 @@ use dom::crypto::Crypto;
|
|||
use dom::eventtarget::EventTarget;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use js::jsapi::{JS_GetContext, JS_GetObjectRuntime, JSContext};
|
||||
use profile_traits::mem;
|
||||
use std::cell::Cell;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::hash_map::Entry;
|
||||
|
@ -32,11 +33,16 @@ pub struct GlobalScope {
|
|||
/// For providing instructions to an optional devtools server.
|
||||
#[ignore_heap_size_of = "channels are hard"]
|
||||
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||
|
||||
/// For sending messages to the memory profiler.
|
||||
#[ignore_heap_size_of = "channels are hard"]
|
||||
mem_profiler_chan: mem::ProfilerChan,
|
||||
}
|
||||
|
||||
impl GlobalScope {
|
||||
pub fn new_inherited(
|
||||
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>)
|
||||
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||
mem_profiler_chan: mem::ProfilerChan)
|
||||
-> Self {
|
||||
GlobalScope {
|
||||
eventtarget: EventTarget::new_inherited(),
|
||||
|
@ -45,6 +51,7 @@ impl GlobalScope {
|
|||
devtools_wants_updates: Default::default(),
|
||||
console_timers: DOMRefCell::new(Default::default()),
|
||||
devtools_chan: devtools_chan,
|
||||
mem_profiler_chan: mem_profiler_chan,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,6 +112,11 @@ impl GlobalScope {
|
|||
pub fn devtools_chan(&self) -> Option<&IpcSender<ScriptToDevtoolsControlMsg>> {
|
||||
self.devtools_chan.as_ref()
|
||||
}
|
||||
|
||||
/// Get a sender to the memory profiler thread.
|
||||
pub fn mem_profiler_chan(&self) -> &mem::ProfilerChan {
|
||||
&self.mem_profiler_chan
|
||||
}
|
||||
}
|
||||
|
||||
fn timestamp_in_ms(time: Timespec) -> u64 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue