mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement trait-based ResourceThreads and clean up related naming issues
Changes include: - Introduce an IpcSend trait to abstract over a collection of IpcSenders - Implement ResourceThreads collection to abstract the resource-related sub threads across the component - Rename original ResourceThread and ControlMsg into an unifed CoreResource__ to accommodate above changes and avoid confusions
This commit is contained in:
parent
051a749e0d
commit
a51db4cfa8
22 changed files with 213 additions and 179 deletions
|
@ -19,7 +19,7 @@ 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::{PanicMsg, PipelineId};
|
||||
use net_traits::ResourceThread;
|
||||
use net_traits::CoreResourceThread;
|
||||
use profile_traits::{mem, time};
|
||||
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort};
|
||||
use script_thread::{MainThreadScriptChan, ScriptThread};
|
||||
|
@ -114,8 +114,8 @@ impl<'a> GlobalRef<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Get the `ResourceThread` for this global scope.
|
||||
pub fn resource_thread(&self) -> ResourceThread {
|
||||
/// Get the `CoreResourceThread` for this global scope.
|
||||
pub fn core_resource_thread(&self) -> CoreResourceThread {
|
||||
match *self {
|
||||
GlobalRef::Window(ref window) => {
|
||||
let doc = window.Document();
|
||||
|
@ -123,7 +123,7 @@ impl<'a> GlobalRef<'a> {
|
|||
let loader = doc.loader();
|
||||
(*loader.resource_thread).clone()
|
||||
}
|
||||
GlobalRef::Worker(ref worker) => worker.resource_thread().clone(),
|
||||
GlobalRef::Worker(ref worker) => worker.core_resource_thread().clone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue