mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
introduce "per task source" ignoring of tasks
This commit is contained in:
parent
ce430566cd
commit
671627e97e
21 changed files with 127 additions and 34 deletions
|
@ -52,6 +52,7 @@ use std::rc::Rc;
|
|||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use task::TaskCanceller;
|
||||
use task_source::TaskSourceName;
|
||||
use task_source::file_reading::FileReadingTaskSource;
|
||||
use task_source::networking::NetworkingTaskSource;
|
||||
use task_source::performance_timeline::PerformanceTimelineTaskSource;
|
||||
|
@ -508,11 +509,14 @@ impl GlobalScope {
|
|||
|
||||
/// Returns the task canceller of this global to ensure that everything is
|
||||
/// properly cancelled when the global scope is destroyed.
|
||||
pub fn task_canceller(&self) -> TaskCanceller {
|
||||
pub fn task_canceller(&self, name: TaskSourceName) -> TaskCanceller {
|
||||
if let Some(window) = self.downcast::<Window>() {
|
||||
return window.task_canceller();
|
||||
return window.task_canceller(name);
|
||||
}
|
||||
if let Some(worker) = self.downcast::<WorkerGlobalScope>() {
|
||||
// Note: the "name" is not passed to the worker,
|
||||
// because 'closing' it only requires one task canceller for all task sources.
|
||||
// https://html.spec.whatwg.org/multipage/#dom-workerglobalscope-closing
|
||||
return worker.task_canceller();
|
||||
}
|
||||
unreachable!();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue