mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Inline DedicatedWorkerGlobalScope::init.
This was an unnecessary abstraction.
This commit is contained in:
parent
603c0b889a
commit
31376a6a79
2 changed files with 3 additions and 14 deletions
|
@ -38,15 +38,6 @@ impl DedicatedWorkerGlobalScope {
|
|||
let scope = box DedicatedWorkerGlobalScope::new_inherited(cx.clone());
|
||||
DedicatedWorkerGlobalScopeBinding::Wrap(cx.ptr, scope)
|
||||
}
|
||||
|
||||
pub fn init() -> Temporary<DedicatedWorkerGlobalScope> {
|
||||
let (_js_runtime, js_context) = ScriptTask::new_rt_and_cx();
|
||||
DedicatedWorkerGlobalScope::new(js_context.clone())
|
||||
}
|
||||
|
||||
pub fn get_rust_cx<'a>(&'a self) -> &'a Rc<Cx> {
|
||||
self.workerglobalscope.get_rust_cx()
|
||||
}
|
||||
}
|
||||
|
||||
impl DedicatedWorkerGlobalScope {
|
||||
|
@ -67,8 +58,9 @@ impl DedicatedWorkerGlobalScope {
|
|||
}
|
||||
};
|
||||
|
||||
let global = DedicatedWorkerGlobalScope::init().root();
|
||||
match global.get_rust_cx().evaluate_script(
|
||||
let (_js_runtime, js_context) = ScriptTask::new_rt_and_cx();
|
||||
let global = DedicatedWorkerGlobalScope::new(js_context.clone()).root();
|
||||
match js_context.evaluate_script(
|
||||
global.reflector().get_jsobject(), source, filename.to_str(), 1) {
|
||||
Ok(_) => (),
|
||||
Err(_) => println!("evaluate_script failed")
|
||||
|
|
|
@ -37,9 +37,6 @@ impl WorkerGlobalScope {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_rust_cx<'a>(&'a self) -> &'a Rc<Cx> {
|
||||
&*self.js_context
|
||||
}
|
||||
pub fn get_cx(&self) -> *mut JSContext {
|
||||
self.js_context.ptr
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue