mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Introduce GlobalScope::new_script_pair
This commit is contained in:
parent
1f8bb3a89f
commit
cdf3ef05e7
3 changed files with 17 additions and 13 deletions
|
@ -18,7 +18,7 @@ use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
|
|||
use js::glue::{IsWrapper, UnwrapObject};
|
||||
use js::jsapi::{CurrentGlobalOrNull, GetGlobalForObjectCrossCompartment};
|
||||
use js::jsapi::{JSContext, JSObject, JS_GetClass};
|
||||
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort};
|
||||
use script_runtime::CommonScriptMsg;
|
||||
use script_thread::ScriptThread;
|
||||
use task_source::file_reading::FileReadingTaskSource;
|
||||
|
||||
|
@ -66,16 +66,6 @@ impl<'a> GlobalRef<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Create a new sender/receiver pair that can be used to implement an on-demand
|
||||
/// event loop. Used for implementing web APIs that require blocking semantics
|
||||
/// without resorting to nested event loops.
|
||||
pub fn new_script_pair(&self) -> (Box<ScriptChan + Send>, Box<ScriptPort + Send>) {
|
||||
match *self {
|
||||
GlobalRef::Window(ref window) => window.new_script_pair(),
|
||||
GlobalRef::Worker(ref worker) => worker.new_script_pair(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Process a single event as if it were the next event in the thread queue for
|
||||
/// this global.
|
||||
pub fn process_event(&self, msg: CommonScriptMsg) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue