Properly implement TaskSource for NetworkingTaskSource

This commit is contained in:
Keith Yeung 2016-10-13 17:41:48 -07:00
parent d99d26cf1f
commit 72cb856e31
15 changed files with 89 additions and 69 deletions

View file

@ -41,6 +41,7 @@ use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::Receiver;
use task_source::file_reading::FileReadingTaskSource;
use task_source::networking::NetworkingTaskSource;
use timers::{IsInterval, TimerCallback};
use url::Url;
@ -361,6 +362,10 @@ impl WorkerGlobalScope {
FileReadingTaskSource(self.script_chan())
}
pub fn networking_task_source(&self) -> NetworkingTaskSource {
NetworkingTaskSource(self.script_chan())
}
pub fn new_script_pair(&self) -> (Box<ScriptChan + Send>, Box<ScriptPort + Send>) {
let dedicated = self.downcast::<DedicatedWorkerGlobalScope>();
if let Some(dedicated) = dedicated {