diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-20 10:37:09 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-20 10:37:09 +0200 |
commit | 6c9fb5ae7a4eb6cff38de3bb6446af304a32bc8a (patch) | |
tree | 63a8bd729171e5886340fe89774f2287bd11cb5b /components/script/task_source/file_reading.rs | |
parent | 52527d6f9dfaae13458059243d975f5336bdead4 (diff) | |
download | servo-6c9fb5ae7a4eb6cff38de3bb6446af304a32bc8a.tar.gz servo-6c9fb5ae7a4eb6cff38de3bb6446af304a32bc8a.zip |
Introduce TaskOnce
Having both TaskBox and TaskOnce allows us to remove the superfluous inner boxing
from CancellableTask<T>.
Diffstat (limited to 'components/script/task_source/file_reading.rs')
-rw-r--r-- | components/script/task_source/file_reading.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/components/script/task_source/file_reading.rs b/components/script/task_source/file_reading.rs index 2ed44165b92..fc9af75794c 100644 --- a/components/script/task_source/file_reading.rs +++ b/components/script/task_source/file_reading.rs @@ -6,7 +6,7 @@ use dom::domexception::DOMErrorName; use dom::filereader::{FileReader, TrustedFileReader, GenerationId, ReadMetaData}; use script_runtime::{CommonScriptMsg, ScriptThreadEventCategory, ScriptChan}; use std::sync::Arc; -use task::{TaskBox, TaskCanceller}; +use task::{TaskCanceller, TaskOnce}; use task_source::TaskSource; #[derive(JSTraceable)] @@ -21,21 +21,21 @@ impl Clone for FileReadingTaskSource { impl TaskSource for FileReadingTaskSource { fn queue_with_canceller<T>( &self, - msg: Box<T>, + task: T, canceller: &TaskCanceller, ) -> Result<(), ()> where - T: TaskBox + 'static, + T: TaskOnce + 'static, { self.0.send(CommonScriptMsg::Task( ScriptThreadEventCategory::FileRead, - canceller.wrap_task(msg), + box canceller.wrap_task(task), )) } } -impl TaskBox for FileReadingTask { - fn run_box(self: Box<Self>) { +impl TaskOnce for FileReadingTask { + fn run_once(self) { self.handle_task(); } } |