From 99ff976e8507e647beec9892ca67b46753cf697e Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 18 Sep 2017 10:54:11 +0200 Subject: Use task! to notify performance observers --- .../script/task_source/performance_timeline.rs | 28 ++++++---------------- 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'components/script/task_source/performance_timeline.rs') 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, -} - -impl NotifyPerformanceObserverTask { - pub fn new(owner: Trusted) -> Self { - NotifyPerformanceObserverTask { - owner, - } - } -} - -impl Task for NotifyPerformanceObserverTask { - fn run(self: Box) { - self.owner.root().notify_observers(); - } -} - #[derive(JSTraceable)] pub struct PerformanceTimelineTaskSource(pub Box); @@ -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, + ); } } -- cgit v1.2.3