diff options
Diffstat (limited to 'components/script/dom/bindings/global.rs')
-rw-r--r-- | components/script/dom/bindings/global.rs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs index 036c53e67b4..adb94c9d2ca 100644 --- a/components/script/dom/bindings/global.rs +++ b/components/script/dom/bindings/global.rs @@ -19,7 +19,8 @@ use js::jsapi::{CurrentGlobalOrNull, GetGlobalForObjectCrossCompartment}; use js::jsapi::{JSContext, JSObject, JS_GetClass, MutableHandleValue}; use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL}; use msg::constellation_msg::{PipelineId, PanicMsg}; -use net_traits::{CoreResourceThread, RequestSource}; +use net_traits::filemanager_thread::FileManagerThreadMsg; +use net_traits::{ResourceThreads, CoreResourceThread, RequestSource, IpcSend}; use profile_traits::{mem, time}; use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort}; use script_thread::{MainThreadScriptChan, ScriptThread}; @@ -122,19 +123,29 @@ impl<'a> GlobalRef<'a> { } } - /// Get the `CoreResourceThread` for this global scope. - pub fn core_resource_thread(&self) -> CoreResourceThread { + /// Get the `ResourceThreads` for this global scope. + pub fn resource_threads(&self) -> ResourceThreads { match *self { GlobalRef::Window(ref window) => { let doc = window.Document(); let doc = doc.r(); let loader = doc.loader(); - (*loader.resource_thread).clone() + loader.resource_threads().clone() } - GlobalRef::Worker(ref worker) => worker.core_resource_thread().clone(), + GlobalRef::Worker(ref worker) => worker.resource_threads().clone(), } } + /// Get the `CoreResourceThread` for this global scope + pub fn core_resource_thread(&self) -> CoreResourceThread { + self.resource_threads().sender() + } + + /// Get the port to file manager for this global scope + pub fn filemanager_thread(&self) -> IpcSender<FileManagerThreadMsg> { + self.resource_threads().sender() + } + /// Get the worker's id. pub fn get_worker_id(&self) -> Option<WorkerId> { match *self { |