diff options
author | Keith Yeung <kungfukeith11@gmail.com> | 2016-01-06 11:44:54 -0500 |
---|---|---|
committer | Keith Yeung <kungfukeith11@gmail.com> | 2016-03-10 01:05:53 -0500 |
commit | 3f2cbf002520289f706e7a7c6448a39ca7fa4bef (patch) | |
tree | 668324ce1c47e981314f28aab246b6524f92fda9 /components/script/task_source/file_reading.rs | |
parent | fa93d3f4674c0e326a644826f5c394136a858f2b (diff) | |
download | servo-3f2cbf002520289f706e7a7c6448a39ca7fa4bef.tar.gz servo-3f2cbf002520289f706e7a7c6448a39ca7fa4bef.zip |
Add task_source directory
Use DOMManipulationTaskSource whenever possible
Diffstat (limited to 'components/script/task_source/file_reading.rs')
-rw-r--r-- | components/script/task_source/file_reading.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/components/script/task_source/file_reading.rs b/components/script/task_source/file_reading.rs new file mode 100644 index 00000000000..e4afad34b4b --- /dev/null +++ b/components/script/task_source/file_reading.rs @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use script_thread::{CommonScriptMsg, MainThreadScriptMsg, ScriptChan}; +use std::sync::mpsc::Sender; + +#[derive(JSTraceable)] +pub struct FileReadingTaskSource(pub Sender<MainThreadScriptMsg>); + +impl ScriptChan for FileReadingTaskSource { + fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> { + let FileReadingTaskSource(ref chan) = *self; + chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ()) + } + + fn clone(&self) -> Box<ScriptChan + Send> { + let FileReadingTaskSource(ref chan) = *self; + box FileReadingTaskSource((*chan).clone()) + } +} |