diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-18 10:54:11 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-18 10:54:11 +0200 |
commit | 99ff976e8507e647beec9892ca67b46753cf697e (patch) | |
tree | de6c71c8211c7d0300c266f15a2021f2214f34b8 /components/script/task_source/performance_timeline.rs | |
parent | 5ed6abe22c69fb71685c297b7a59e48550c5dbb5 (diff) | |
download | servo-99ff976e8507e647beec9892ca67b46753cf697e.tar.gz servo-99ff976e8507e647beec9892ca67b46753cf697e.zip |
Use task! to notify performance observers
Diffstat (limited to 'components/script/task_source/performance_timeline.rs')
-rw-r--r-- | components/script/task_source/performance_timeline.rs | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/components/script/task_source/performance_timeline.rs b/components/script/task_source/performance_timeline.rs index 938566b7a8f..0b379d496f4 100644 --- a/components/script/task_source/performance_timeline.rs +++ b/components/script/task_source/performance_timeline.rs @@ -8,31 +8,12 @@ use dom::bindings::refcounted::Trusted; use dom::globalscope::GlobalScope; -use dom::performance::Performance; use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use std::fmt; use std::result::Result; use task::{Task, TaskCanceller}; use task_source::TaskSource; -pub struct NotifyPerformanceObserverTask { - owner: Trusted<Performance>, -} - -impl NotifyPerformanceObserverTask { - pub fn new(owner: Trusted<Performance>) -> Self { - NotifyPerformanceObserverTask { - owner, - } - } -} - -impl Task for NotifyPerformanceObserverTask { - fn run(self: Box<Self>) { - self.owner.root().notify_observers(); - } -} - #[derive(JSTraceable)] pub struct PerformanceTimelineTaskSource(pub Box<ScriptChan + Send + 'static>); @@ -68,7 +49,12 @@ impl TaskSource for PerformanceTimelineTaskSource { impl PerformanceTimelineTaskSource { pub fn queue_notification(&self, global: &GlobalScope) { let owner = Trusted::new(&*global.performance()); - let task = box NotifyPerformanceObserverTask::new(owner); - let _ = self.queue(task, global); + // FIXME(nox): Why are errors silenced here? + let _ = self.queue( + box task!(notify_performance_observers: move || { + owner.root().notify_observers(); + }), + global, + ); } } |