aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/task_source/dom_manipulation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/task_source/dom_manipulation.rs')
-rw-r--r--components/script/task_source/dom_manipulation.rs19
1 files changed, 11 insertions, 8 deletions
diff --git a/components/script/task_source/dom_manipulation.rs b/components/script/task_source/dom_manipulation.rs
index 3cb08055446..5deef052c3e 100644
--- a/components/script/task_source/dom_manipulation.rs
+++ b/components/script/task_source/dom_manipulation.rs
@@ -5,6 +5,7 @@
use dom::bindings::refcounted::Trusted;
use dom::event::{EventBubbles, EventCancelable, EventRunnable, SimpleEventRunnable};
use dom::eventtarget::EventTarget;
+use dom::window::Window;
use script_thread::{MainThreadScriptMsg, Runnable, ScriptThread};
use std::result::Result;
use std::sync::mpsc::Sender;
@@ -14,8 +15,9 @@ use task_source::TaskSource;
#[derive(JSTraceable, Clone)]
pub struct DOMManipulationTaskSource(pub Sender<MainThreadScriptMsg>);
-impl TaskSource<DOMManipulationTask> for DOMManipulationTaskSource {
- fn queue(&self, msg: DOMManipulationTask) -> Result<(), ()> {
+impl TaskSource for DOMManipulationTaskSource {
+ fn queue<T: Runnable + Send + 'static>(&self, msg: T, window: &Window) -> Result<(), ()> {
+ let msg = DOMManipulationTask(window.get_runnable_wrapper().wrap_runnable(msg));
self.0.send(MainThreadScriptMsg::DOMManipulation(msg)).map_err(|_| ())
}
}
@@ -25,24 +27,25 @@ impl DOMManipulationTaskSource {
target: &EventTarget,
name: Atom,
bubbles: EventBubbles,
- cancelable: EventCancelable) {
+ cancelable: EventCancelable,
+ window: &Window) {
let target = Trusted::new(target);
- let runnable = box EventRunnable {
+ let runnable = EventRunnable {
target: target,
name: name,
bubbles: bubbles,
cancelable: cancelable,
};
- let _ = self.queue(DOMManipulationTask(runnable));
+ let _ = self.queue(runnable, window);
}
- pub fn queue_simple_event(&self, target: &EventTarget, name: Atom) {
+ pub fn queue_simple_event(&self, target: &EventTarget, name: Atom, window: &Window) {
let target = Trusted::new(target);
- let runnable = box SimpleEventRunnable {
+ let runnable = SimpleEventRunnable {
target: target,
name: name,
};
- let _ = self.queue(DOMManipulationTask(runnable));
+ let _ = self.queue(runnable, window);
}
}