aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/audioscheduledsourcenode.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2018-11-16 09:54:40 -0500
committerGitHub <noreply@github.com>2018-11-16 09:54:40 -0500
commita2937d948818665ecda16a06fe6c8fa751d265fd (patch)
tree7c925d0d1517807e56963847da4c3ca25d7b2626 /components/script/dom/audioscheduledsourcenode.rs
parent050b2bca70b09a84901de84b4538f19da3250eee (diff)
parent75eb94afcaae2f868ecccba5b5dcea4066998d7a (diff)
downloadservo-a2937d948818665ecda16a06fe6c8fa751d265fd.tar.gz
servo-a2937d948818665ecda16a06fe6c8fa751d265fd.zip
Auto merge of #21804 - AgustinCB:unify-task-source-canceller-api, r=gterzian
Unify the task source and task canceller API To do so, I created a struct `TaskManagement(TaskSource, TaskCanceller)` and made `*_task_source` return that instead of just the task source. Next, I refactored all places in which `task_canceller` by basically removing them in favour of a previously called `*_task_source`. I tried to make `task_canceller` a private method in `Window`, with the hope of enforcing the use of `*_task_source`. However, it's used in components/script/dom/globalscope.rs:575 in such a way that will make it harder to avoid. I decided to leave it that way. It'd be possible to unify `*_task_source` in such a way that we would have only one method. However, I decided not to do it because one of the `TaskSource` implementations is special: `history_traversal_task_source`. Not wanting to over complicate things, I decided to leave the structure this way. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #21154 (github issue number if applicable). - [x] These changes do not require tests because it's refactoring code that should already be tested. <!-- 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/21804) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/audioscheduledsourcenode.rs')
-rw-r--r--components/script/dom/audioscheduledsourcenode.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audioscheduledsourcenode.rs
index 31527fda3de..24437b88db9 100644
--- a/components/script/dom/audioscheduledsourcenode.rs
+++ b/components/script/dom/audioscheduledsourcenode.rs
@@ -10,7 +10,7 @@ use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::num::Finite;
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::bindings::reflector::DomObject;
-use crate::task_source::{TaskSource, TaskSourceName};
+use crate::task_source::TaskSource;
use dom_struct::dom_struct;
use servo_media::audio::node::OnEndedCallback;
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage};
@@ -71,15 +71,16 @@ impl AudioScheduledSourceNodeMethods for AudioScheduledSourceNode {
let this = Trusted::new(self);
let global = self.global();
let window = global.as_window();
- let task_source = window.dom_manipulation_task_source();
- let canceller = window.task_canceller(TaskSourceName::DOMManipulation);
+ let (task_source, canceller) = window
+ .task_manager()
+ .dom_manipulation_task_source_with_canceller();
let callback = OnEndedCallback::new(move || {
let _ = task_source.queue_with_canceller(
task!(ended: move || {
let this = this.root();
let global = this.global();
let window = global.as_window();
- window.dom_manipulation_task_source().queue_simple_event(
+ window.task_manager().dom_manipulation_task_source().queue_simple_event(
this.upcast(),
atom!("ended"),
&window