mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Allow refcounting arbitrary DOM objects in concert with the GC to enable safe, asynchronous/cross-task references to pinned objects.
This commit is contained in:
parent
c4b93d30e4
commit
2f059c15e7
8 changed files with 210 additions and 154 deletions
|
@ -48,8 +48,6 @@
|
|||
use dom::bindings::trace::JSTraceable;
|
||||
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 js::jsval::JSVal;
|
||||
use layout_interface::TrustedNodeAddress;
|
||||
|
@ -142,24 +140,6 @@ impl JS<Node> {
|
|||
}
|
||||
}
|
||||
|
||||
impl JS<XMLHttpRequest> {
|
||||
pub unsafe fn from_trusted_xhr_address(inner: TrustedXHRAddress) -> JS<XMLHttpRequest> {
|
||||
let TrustedXHRAddress(addr) = inner;
|
||||
JS {
|
||||
ptr: addr as *const 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