Introduce GlobalScope::script_chan

This commit is contained in:
Anthony Ramine 2016-10-04 00:35:16 +02:00
parent 71236e168a
commit a7305b7fc4
4 changed files with 19 additions and 14 deletions

View file

@ -25,7 +25,7 @@ use libc;
use profile_traits::time;
use script_runtime::{CommonScriptMsg, EnqueuedPromiseCallback, ScriptChan};
use script_runtime::{ScriptPort, maybe_take_panic_result};
use script_thread::{MainThreadScriptChan, RunnableWrapper, ScriptThread};
use script_thread::{RunnableWrapper, ScriptThread};
use script_traits::MsDuration;
use std::ffi::CString;
use std::panic;
@ -67,16 +67,6 @@ impl<'a> GlobalRef<'a> {
}
}
/// `ScriptChan` used to send messages to the event loop of this global's
/// thread.
pub fn script_chan(&self) -> Box<ScriptChan + Send> {
match *self {
GlobalRef::Window(ref window) =>
MainThreadScriptChan(window.main_thread_script_chan().clone()).clone(),
GlobalRef::Worker(ref worker) => worker.script_chan(),
}
}
/// `ScriptChan` used to send messages to the event loop of this global's
/// thread.
pub fn networking_task_source(&self) -> Box<ScriptChan + Send> {