Add devtools_chan method to GlobalRef and make new globals notifications work with nested workers

fixup! Add devtools_chan method to GlobalRef and make new globals notifications work with nested workers

fixup! Add devtools_chan method to GlobalRef and make new globals notifications work with nested workers
This commit is contained in:
thiagopnts 2015-04-04 00:15:51 -03:00
parent f22d920b4d
commit ea5c702f4a
4 changed files with 73 additions and 23 deletions

View file

@ -13,8 +13,9 @@ use dom::bindings::utils::{Reflectable, Reflector};
use dom::workerglobalscope::{WorkerGlobalScope, WorkerGlobalScopeHelpers};
use dom::window::{self, WindowHelpers};
use script_task::ScriptChan;
use devtools_traits::DevtoolsControlChan;
use msg::constellation_msg::WorkerId;
use msg::constellation_msg::{PipelineId, WorkerId};
use net_traits::ResourceTask;
use js::{JSCLASS_IS_GLOBAL, JSCLASS_IS_DOMJSCLASS};
@ -82,6 +83,23 @@ impl<'a> GlobalRef<'a> {
}
}
/// Get the `PipelineId` for this global scope.
pub fn pipeline(&self) -> PipelineId {
match *self {
GlobalRef::Window(window) => window.pipeline(),
GlobalRef::Worker(worker) => worker.pipeline(),
}
}
/// Get `DevtoolsControlChan` to send messages to Devtools
/// task when available.
pub fn devtools_chan(&self) -> Option<DevtoolsControlChan> {
match *self {
GlobalRef::Window(window) => window.devtools_chan(),
GlobalRef::Worker(worker) => worker.devtools_chan(),
}
}
/// Get the `ResourceTask` for this global scope.
pub fn resource_task(&self) -> ResourceTask {
match *self {