Combined DOMManipulationTask runnable variants into a single variant

This commit is contained in:
Connor Brewster 2016-07-06 10:46:39 -06:00
parent 68fb9ebc41
commit d6f4dc06df
7 changed files with 22 additions and 36 deletions

View file

@ -200,11 +200,8 @@ impl<T: Runnable + Send> Runnable for CancellableRunnable<T> {
pub trait Runnable {
fn is_cancelled(&self) -> bool { false }
fn handler(self: Box<Self>);
}
pub trait MainThreadRunnable {
fn handler(self: Box<Self>, script_thread: &ScriptThread);
fn handler(self: Box<Self>) {}
fn main_thread_handler(self: Box<Self>, _script_thread: &ScriptThread) { self.handler(); }
}
enum MixedMessage {
@ -1223,7 +1220,7 @@ impl ScriptThread {
// https://html.spec.whatwg.org/multipage/#the-end step 7
let handler = box DocumentProgressHandler::new(Trusted::new(doc));
self.dom_manipulation_task_source.queue(DOMManipulationTask::DocumentProgress(handler)).unwrap();
self.dom_manipulation_task_source.queue(DOMManipulationTask::Runnable(handler)).unwrap();
self.constellation_chan.send(ConstellationMsg::LoadComplete(pipeline)).unwrap();
}