mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Make task queue API usable from non-main threads.
This commit is contained in:
parent
0e4865ea1a
commit
2aef518ce6
9 changed files with 42 additions and 21 deletions
|
@ -5,6 +5,7 @@
|
|||
use dom::attr::Attr;
|
||||
use dom::bindings::codegen::Bindings::HTMLDetailsElementBinding;
|
||||
use dom::bindings::codegen::Bindings::HTMLDetailsElementBinding::HTMLDetailsElementMethods;
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::inheritance::Castable;
|
||||
use dom::bindings::js::Root;
|
||||
use dom::bindings::refcounted::Trusted;
|
||||
|
@ -78,7 +79,7 @@ impl VirtualMethods for HTMLDetailsElement {
|
|||
element: details,
|
||||
toggle_number: counter
|
||||
};
|
||||
let _ = task_source.queue(runnable, window.r());
|
||||
let _ = task_source.queue(runnable, GlobalRef::Window(&window));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ use dom::bindings::codegen::Bindings::HTMLFormElementBinding::HTMLFormElementMet
|
|||
use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
|
||||
use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods;
|
||||
use dom::bindings::conversions::DerivedFrom;
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
|
||||
use dom::bindings::js::{JS, MutNullableHeap, Root};
|
||||
use dom::bindings::refcounted::Trusted;
|
||||
|
@ -484,7 +485,7 @@ impl HTMLFormElement {
|
|||
};
|
||||
|
||||
// Step 3
|
||||
window.dom_manipulation_task_source().queue(nav, window).unwrap();
|
||||
window.dom_manipulation_task_source().queue(nav, GlobalRef::Window(window)).unwrap();
|
||||
}
|
||||
|
||||
/// Interactively validate the constraints of form elements
|
||||
|
|
|
@ -184,7 +184,7 @@ impl HTMLImageElement {
|
|||
src: src.into(),
|
||||
};
|
||||
let task = window.dom_manipulation_task_source();
|
||||
let _ = task.queue(runnable, window);
|
||||
let _ = task.queue(runnable, GlobalRef::Window(window));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ impl HTMLMediaElement {
|
|||
elem: Trusted::new(self),
|
||||
};
|
||||
let win = window_from_node(self);
|
||||
let _ = win.dom_manipulation_task_source().queue(task, win.r());
|
||||
let _ = win.dom_manipulation_task_source().queue(task, GlobalRef::Window(&win));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#internal-pause-steps step 2.2
|
||||
|
@ -265,13 +265,13 @@ impl HTMLMediaElement {
|
|||
elem: Trusted::new(self),
|
||||
};
|
||||
let win = window_from_node(self);
|
||||
let _ = win.dom_manipulation_task_source().queue(task, win.r());
|
||||
let _ = win.dom_manipulation_task_source().queue(task, GlobalRef::Window(&win));
|
||||
}
|
||||
|
||||
fn queue_fire_simple_event(&self, type_: &'static str) {
|
||||
let win = window_from_node(self);
|
||||
let task = box FireSimpleEventTask::new(self, type_);
|
||||
let _ = win.dom_manipulation_task_source().queue(task, win.r());
|
||||
let _ = win.dom_manipulation_task_source().queue(task, GlobalRef::Window(&win));
|
||||
}
|
||||
|
||||
fn fire_simple_event(&self, type_: &str) {
|
||||
|
@ -498,7 +498,8 @@ impl HTMLMediaElement {
|
|||
|
||||
fn queue_dedicated_media_source_failure_steps(&self) {
|
||||
let window = window_from_node(self);
|
||||
let _ = window.dom_manipulation_task_source().queue(box DedicatedMediaSourceFailureTask::new(self), window.r());
|
||||
let _ = window.dom_manipulation_task_source().queue(box DedicatedMediaSourceFailureTask::new(self),
|
||||
GlobalRef::Window(&window));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dedicated-media-source-failure-steps
|
||||
|
|
|
@ -161,7 +161,8 @@ impl Storage {
|
|||
let window = global_ref.as_window();
|
||||
let task_source = window.dom_manipulation_task_source();
|
||||
let trusted_storage = Trusted::new(self);
|
||||
task_source.queue(box StorageEventRunnable::new(trusted_storage, key, old_value, new_value), window).unwrap();
|
||||
task_source.queue(box StorageEventRunnable::new(trusted_storage, key, old_value, new_value),
|
||||
global_ref).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue