Skip to content

Commit

Permalink
Bring back run_with_memory_reporting in serviceworkerglobalscope
Browse files Browse the repository at this point in the history
  • Loading branch information
creativcoder committed Jul 29, 2016
1 parent c1409af commit 4936fb2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/script/dom/dedicatedworkerglobalscope.rs
Expand Up @@ -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() {
Expand Down
13 changes: 8 additions & 5 deletions components/script/dom/serviceworkerglobalscope.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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);
});
}

Expand Down

0 comments on commit 4936fb2

Please sign in to comment.