diff options
Diffstat (limited to 'components/script/task_source/performance_timeline.rs')
-rw-r--r-- | components/script/task_source/performance_timeline.rs | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/components/script/task_source/performance_timeline.rs b/components/script/task_source/performance_timeline.rs index 7d77b6b7db7..db80789a206 100644 --- a/components/script/task_source/performance_timeline.rs +++ b/components/script/task_source/performance_timeline.rs @@ -10,25 +10,25 @@ use dom::bindings::refcounted::Trusted; use dom::globalscope::GlobalScope; use dom::performance::Performance; use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; -use script_thread::{Runnable, RunnableWrapper}; +use script_thread::{Task, TaskCanceller}; use std::fmt; use std::result::Result; use task_source::TaskSource; -pub struct NotifyPerformanceObserverRunnable { +pub struct NotifyPerformanceObserverTask { owner: Trusted<Performance>, } -impl NotifyPerformanceObserverRunnable { +impl NotifyPerformanceObserverTask { pub fn new(owner: Trusted<Performance>) -> Self { - NotifyPerformanceObserverRunnable { + NotifyPerformanceObserverTask { owner, } } } -impl Runnable for NotifyPerformanceObserverRunnable { - fn handler(self: Box<NotifyPerformanceObserverRunnable>) { +impl Task for NotifyPerformanceObserverTask { + fn run(self: Box<Self>) { self.owner.root().notify_observers(); } } @@ -49,13 +49,17 @@ impl fmt::Debug for PerformanceTimelineTaskSource { } impl TaskSource for PerformanceTimelineTaskSource { - fn queue_with_wrapper<T>(&self, - msg: Box<T>, - wrapper: &RunnableWrapper) -> Result<(), ()> - where T: Runnable + Send + 'static { - let msg = CommonScriptMsg::RunnableMsg( + fn queue_with_canceller<T>( + &self, + msg: Box<T>, + canceller: &TaskCanceller, + ) -> Result<(), ()> + where + T: Send + Task + 'static, + { + let msg = CommonScriptMsg::Task( ScriptThreadEventCategory::PerformanceTimelineTask, - wrapper.wrap_runnable(msg) + canceller.wrap_task(msg) ); self.0.send(msg).map_err(|_| ()) } @@ -64,7 +68,7 @@ impl TaskSource for PerformanceTimelineTaskSource { impl PerformanceTimelineTaskSource { pub fn queue_notification(&self, global: &GlobalScope) { let owner = Trusted::new(&*global.performance()); - let runnable = box NotifyPerformanceObserverRunnable::new(owner); - let _ = self.queue(runnable, global); + let task = box NotifyPerformanceObserverTask::new(owner); + let _ = self.queue(task, global); } } |