mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Generalize promise job queue into solitary microtask queue.
This commit is contained in:
parent
bac2f68b54
commit
32d4f84a30
8 changed files with 137 additions and 144 deletions
|
@ -210,10 +210,15 @@ impl ServiceWorkerGlobalScope {
|
|||
global.dispatch_activate();
|
||||
let reporter_name = format!("service-worker-reporter-{}", random::<u64>());
|
||||
scope.upcast::<GlobalScope>().mem_profiler_chan().run_with_memory_reporting(|| {
|
||||
// https://html.spec.whatwg.org/multipage/#event-loop-processing-model
|
||||
// Step 1
|
||||
while let Ok(event) = global.receive_event() {
|
||||
// Step 3
|
||||
if !global.handle_event(event) {
|
||||
break;
|
||||
}
|
||||
// Step 6
|
||||
global.upcast::<WorkerGlobalScope>().perform_a_microtask_checkpoint();
|
||||
}
|
||||
}, reporter_name, scope.script_chan(), CommonScriptMsg::CollectReports);
|
||||
}).expect("Thread spawning failed");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue