aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-08-02 08:05:16 -0500
committerGitHub <noreply@github.com>2016-08-02 08:05:16 -0500
commit2aa257f603e73655ccf2375e3ee875a37d707d09 (patch)
tree409a909e6c80c933855127dfceeb7d7680c37206 /components/script
parent93b130f3f7571ebb7407e3914d83dc6fc526c7d4 (diff)
parent4936fb26d94f7cc0726142b8a3ac3246b4fcbafe (diff)
downloadservo-2aa257f603e73655ccf2375e3ee875a37d707d09.tar.gz
servo-2aa257f603e73655ccf2375e3ee875a37d707d09.zip
Auto merge of #12557 - creativcoder:sw-scope, r=nox
Bring back run_with_memory_reporting in serviceworkerglobalscope <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [X] These changes do not require tests because its a refactor. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12557) <!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/dedicatedworkerglobalscope.rs2
-rw-r--r--components/script/dom/serviceworkerglobalscope.rs13
2 files changed, 9 insertions, 6 deletions
diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs
index d997a33ebd6..dfe385f0696 100644
--- a/components/script/dom/dedicatedworkerglobalscope.rs
+++ b/components/script/dom/dedicatedworkerglobalscope.rs
@@ -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() {
diff --git a/components/script/dom/serviceworkerglobalscope.rs b/components/script/dom/serviceworkerglobalscope.rs
index 4208754f91d..c6a238ac10f 100644
--- a/components/script/dom/serviceworkerglobalscope.rs
+++ b/components/script/dom/serviceworkerglobalscope.rs
@@ -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);
});
}