mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Make all task source runnables cancellable
Implement all Runnable methods on CancellableRunnable to redirect to their inner runnable
This commit is contained in:
parent
afc0ccb48d
commit
5f7324a9a5
14 changed files with 69 additions and 58 deletions
|
@ -189,10 +189,16 @@ pub struct CancellableRunnable<T: Runnable + Send> {
|
|||
}
|
||||
|
||||
impl<T: Runnable + Send> Runnable for CancellableRunnable<T> {
|
||||
fn name(&self) -> &'static str { self.inner.name() }
|
||||
|
||||
fn is_cancelled(&self) -> bool {
|
||||
self.cancelled.load(Ordering::SeqCst)
|
||||
}
|
||||
|
||||
fn main_thread_handler(self: Box<CancellableRunnable<T>>, script_thread: &ScriptThread) {
|
||||
self.inner.main_thread_handler(script_thread);
|
||||
}
|
||||
|
||||
fn handler(self: Box<CancellableRunnable<T>>) {
|
||||
self.inner.handler()
|
||||
}
|
||||
|
@ -1220,8 +1226,8 @@ impl ScriptThread {
|
|||
doc.mut_loader().inhibit_events();
|
||||
|
||||
// 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(handler)).unwrap();
|
||||
let handler = DocumentProgressHandler::new(Trusted::new(doc));
|
||||
self.dom_manipulation_task_source.queue(handler, doc.window()).unwrap();
|
||||
|
||||
self.constellation_chan.send(ConstellationMsg::LoadComplete(pipeline)).unwrap();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue