mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Store a pointer to the Worker in the DedicatedWorkerGlobalScope.
This commit is contained in:
parent
4f7c7fc808
commit
e8bd66cfa9
4 changed files with 99 additions and 10 deletions
|
@ -48,6 +48,7 @@
|
|||
use dom::bindings::utils::{Reflector, Reflectable};
|
||||
use dom::node::Node;
|
||||
use dom::xmlhttprequest::{XMLHttpRequest, TrustedXHRAddress};
|
||||
use dom::worker::{Worker, TrustedWorkerAddress};
|
||||
use js::jsapi::JSObject;
|
||||
use layout_interface::TrustedNodeAddress;
|
||||
use script_task::StackRoots;
|
||||
|
@ -143,6 +144,15 @@ impl JS<XMLHttpRequest> {
|
|||
}
|
||||
}
|
||||
|
||||
impl JS<Worker> {
|
||||
pub unsafe fn from_trusted_worker_address(inner: TrustedWorkerAddress) -> JS<Worker> {
|
||||
let TrustedWorkerAddress(addr) = inner;
|
||||
JS {
|
||||
ptr: addr as *const Worker
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Reflectable> JS<T> {
|
||||
/// Create a new JS-owned value wrapped from a raw Rust pointer.
|
||||
pub unsafe fn from_raw(raw: *const T) -> JS<T> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue