mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
use microtasks to await a stable state
This commit is contained in:
parent
5da0aa9f11
commit
a8390aea24
12 changed files with 47 additions and 97 deletions
|
@ -665,14 +665,11 @@ impl ScriptThread {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#await-a-stable-state
|
||||
pub fn await_stable_state<T: Runnable + Send + 'static>(task: T) {
|
||||
//TODO use microtasks when they exist
|
||||
pub fn await_stable_state(task: Microtask) {
|
||||
SCRIPT_THREAD_ROOT.with(|root| {
|
||||
if let Some(script_thread) = root.get() {
|
||||
let script_thread = unsafe { &*script_thread };
|
||||
let _ = script_thread.chan.send(CommonScriptMsg::RunnableMsg(
|
||||
ScriptThreadEventCategory::DomEvent,
|
||||
box task));
|
||||
script_thread.microtask_queue.enqueue(task);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue