diff options
author | Gregory Terzian <gterzian@users.noreply.github.com> | 2017-05-15 07:19:58 +0800 |
---|---|---|
committer | Gregory Terzian <gterzian@users.noreply.github.com> | 2017-05-19 17:29:16 +0800 |
commit | a8390aea2451928153bd744e7eeb73fc70564124 (patch) | |
tree | 0848b50b49447aa9ce47a523f75e319f1915a442 /components/script/microtask.rs | |
parent | 5da0aa9f11b7b1c2dc8b5adf178eebafa92d1849 (diff) | |
download | servo-a8390aea2451928153bd744e7eeb73fc70564124.tar.gz servo-a8390aea2451928153bd744e7eeb73fc70564124.zip |
use microtasks to await a stable state
Diffstat (limited to 'components/script/microtask.rs')
-rw-r--r-- | components/script/microtask.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/components/script/microtask.rs b/components/script/microtask.rs index 7fadf111ddb..8f10dbcf489 100644 --- a/components/script/microtask.rs +++ b/components/script/microtask.rs @@ -11,6 +11,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::PromiseBinding::PromiseJobCallback; use dom::bindings::js::Root; use dom::globalscope::GlobalScope; +use dom::htmlmediaelement::MediaElementMicrotask; use dom::mutationobserver::MutationObserver; use msg::constellation_msg::PipelineId; use std::cell::Cell; @@ -29,9 +30,14 @@ pub struct MicrotaskQueue { #[derive(JSTraceable, HeapSizeOf)] pub enum Microtask { Promise(EnqueuedPromiseCallback), + MediaElement(MediaElementMicrotask), NotifyMutationObservers, } +pub trait MicrotaskRunnable { + fn handler(&self) {} +} + /// A promise callback scheduled to run during the next microtask checkpoint (#4283). #[derive(JSTraceable, HeapSizeOf)] pub struct EnqueuedPromiseCallback { @@ -72,6 +78,9 @@ impl MicrotaskQueue { if let Some(target) = target_provider(job.pipeline) { let _ = job.callback.Call_(&*target, ExceptionHandling::Report); } + }, + Microtask::MediaElement(ref task) => { + task.handler(); } Microtask::NotifyMutationObservers => { MutationObserver::notify_mutation_observers(); |