mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
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 -->
This commit is contained in:
commit
2aa257f603
2 changed files with 9 additions and 6 deletions
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue