mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
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:
parent
f22d920b4d
commit
ea5c702f4a
4 changed files with 73 additions and 23 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue