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/networking.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/networking.rs')
-rw-r--r-- | components/script/task_source/networking.rs | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/components/script/task_source/networking.rs b/components/script/task_source/networking.rs index 8306a4789bb..56c583d775f 100644 --- a/components/script/task_source/networking.rs +++ b/components/script/task_source/networking.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; -use script_thread::{Runnable, RunnableWrapper}; +use script_thread::{Task, TaskCanceller}; use task_source::TaskSource; #[derive(JSTraceable)] @@ -16,18 +16,28 @@ impl Clone for NetworkingTaskSource { } impl TaskSource for NetworkingTaskSource { - fn queue_with_wrapper<T>(&self, - msg: Box<T>, - wrapper: &RunnableWrapper) - -> Result<(), ()> - where T: Runnable + Send + 'static { - self.0.send(CommonScriptMsg::RunnableMsg(ScriptThreadEventCategory::NetworkEvent, - wrapper.wrap_runnable(msg))) + fn queue_with_canceller<T>( + &self, + msg: Box<T>, + canceller: &TaskCanceller, + ) -> Result<(), ()> + where + T: Send + Task + 'static, + { + self.0.send(CommonScriptMsg::Task( + ScriptThreadEventCategory::NetworkEvent, + canceller.wrap_task(msg), + )) } } impl NetworkingTaskSource { - pub fn queue_wrapperless<T: Runnable + Send + 'static>(&self, msg: Box<T>) -> Result<(), ()> { - self.0.send(CommonScriptMsg::RunnableMsg(ScriptThreadEventCategory::NetworkEvent, msg)) + /// This queues a task that will not be cancelled when its associated + /// global scope gets destroyed. + pub fn queue_unconditionally<T>(&self, msg: Box<T>) -> Result<(), ()> + where + T: Task + Send + 'static, + { + self.0.send(CommonScriptMsg::Task(ScriptThreadEventCategory::NetworkEvent, msg)) } } |