Bring back run_with_memory_reporting in serviceworkerglobalscope

This commit is contained in:
Rahul Sharma 2016-07-22 19:48:54 +05:30
parent c1409af543
commit 4936fb26d9
2 changed files with 9 additions and 6 deletions

View file

@ -218,7 +218,7 @@ impl DedicatedWorkerGlobalScope {
scope.execute_script(DOMString::from(source));
}
let reporter_name = format!("worker-reporter-{}", random::<u64>());
let reporter_name = format!("dedicated-worker-reporter-{}", random::<u64>());
scope.mem_profiler_chan().run_with_memory_reporting(|| {
while let Ok(event) = global.receive_event() {
if scope.is_closing() {

View file

@ -25,6 +25,7 @@ use js::jsval::UndefinedValue;
use js::rust::Runtime;
use msg::constellation_msg::PipelineId;
use net_traits::{LoadContext, load_whole_resource, IpcSend, CustomResponseMediator};
use rand::random;
use script_runtime::{CommonScriptMsg, StackRootTLS, get_reports, new_rt_and_cx};
use script_traits::{TimerEvent, WorkerGlobalScopeInit, ScopeThings, ServiceWorkerMsg};
use std::sync::mpsc::{Receiver, RecvError, Select, Sender, channel};
@ -185,12 +186,14 @@ impl ServiceWorkerGlobalScope {
let _ = timer_chan.send(());
});
// TODO XXXcreativcoder bring back run_with_memory_reporting when things are more concrete here.
while let Ok(event) = global.receive_event() {
if !global.handle_event(event) {
break;
let reporter_name = format!("service-worker-reporter-{}", random::<u64>());
scope.mem_profiler_chan().run_with_memory_reporting(|| {
while let Ok(event) = global.receive_event() {
if !global.handle_event(event) {
break;
}
}
}
}, reporter_name, scope.script_chan(), CommonScriptMsg::CollectReports);
});
}