Skip to content
Permalink
Browse files

Remove compound microtasks

We handled compound microtasks as microtasks so, basically, we only need
to remove the naming of `compound`.
  • Loading branch information...
CYBAI committed Mar 31, 2019
1 parent 793b412 commit e88858388a250738153202666a90fae157d09ca0
Showing with 11 additions and 15 deletions.
  1. +5 −5 components/script/dom/mutationobserver.rs
  2. +6 −10 components/script/script_thread.rs
@@ -90,21 +90,21 @@ impl MutationObserver {
}

/// <https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask>
pub fn queue_mutation_observer_compound_microtask() {
pub fn queue_mutation_observer_microtask() {
// Step 1
if ScriptThread::is_mutation_observer_compound_microtask_queued() {
if ScriptThread::is_mutation_observer_microtask_queued() {
return;
}
// Step 2
ScriptThread::set_mutation_observer_compound_microtask_queued(true);
ScriptThread::set_mutation_observer_microtask_queued(true);
// Step 3
ScriptThread::enqueue_microtask(Microtask::NotifyMutationObservers);
}

/// <https://dom.spec.whatwg.org/#notify-mutation-observers>
pub fn notify_mutation_observers() {
// Step 1
ScriptThread::set_mutation_observer_compound_microtask_queued(false);
ScriptThread::set_mutation_observer_microtask_queued(false);
// Step 2
let notify_list = ScriptThread::get_mutation_observers();
// TODO: steps 3-4 (slots)
@@ -239,7 +239,7 @@ impl MutationObserver {
}

// Step 5
MutationObserver::queue_mutation_observer_compound_microtask();
MutationObserver::queue_mutation_observer_microtask();
}
}

@@ -615,7 +615,7 @@ pub struct ScriptThread {
microtask_queue: Rc<MicrotaskQueue>,

/// Microtask Queue for adding support for mutation observer microtasks
mutation_observer_compound_microtask_queued: Cell<bool>,
mutation_observer_microtask_queued: Cell<bool>,

/// The unit of related similar-origin browsing contexts' list of MutationObserver objects
mutation_observers: DomRefCell<Vec<Dom<MutationObserver>>>,
@@ -767,21 +767,17 @@ impl ScriptThread {
})
}

pub fn set_mutation_observer_compound_microtask_queued(value: bool) {
pub fn set_mutation_observer_microtask_queued(value: bool) {
SCRIPT_THREAD_ROOT.with(|root| {
let script_thread = unsafe { &*root.get().unwrap() };
script_thread
.mutation_observer_compound_microtask_queued
.set(value);
script_thread.mutation_observer_microtask_queued.set(value);
})
}

pub fn is_mutation_observer_compound_microtask_queued() -> bool {
pub fn is_mutation_observer_microtask_queued() -> bool {
SCRIPT_THREAD_ROOT.with(|root| {
let script_thread = unsafe { &*root.get().unwrap() };
return script_thread
.mutation_observer_compound_microtask_queued
.get();
return script_thread.mutation_observer_microtask_queued.get();
})
}

@@ -1145,7 +1141,7 @@ impl ScriptThread {

microtask_queue: Default::default(),

mutation_observer_compound_microtask_queued: Default::default(),
mutation_observer_microtask_queued: Default::default(),

mutation_observers: Default::default(),

0 comments on commit e888583

Please sign in to comment.
You can’t perform that action at this time.