diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-16 02:09:26 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-16 15:43:26 +0200 |
commit | 56117d31856be46d7df417e659a4406305b4e258 (patch) | |
tree | c3a6b03f1bf9f3b9c8c1a2f67b0a8ac703f93d0a /components/script/task_source/performance_timeline.rs | |
parent | 52a6f63608a25e0574fd43b69f404f79a9a6c28f (diff) | |
download | servo-56117d31856be46d7df417e659a4406305b4e258.tar.gz servo-56117d31856be46d7df417e659a4406305b4e258.zip |
Rename Runnable to Task
The changes are:
* `*Runnable` -> `*Task`;
* `RunnableMsg` -> `Task`;
* `RunnableWrapper` -> `TaskCanceller`;
* `MainThreadRunnable` -> `MainThreadTask`;
* `wrap_runnable` -> `wrap_task`;
* `get_runnable_wrapper` -> `task_canceller`;
* `handler` -> `run`;
* `main_thread_handler` -> `run_with_script_thread`.
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); } } |