diff options
author | Tetsuharu OHZEKI <saneyuki.snyk@gmail.com> | 2014-05-26 14:46:31 +0900 |
---|---|---|
committer | Tetsuharu OHZEKI <saneyuki.snyk@gmail.com> | 2014-05-30 03:38:40 +0900 |
commit | da703d6a808346a59ec4ca82c27209b4170a95c8 (patch) | |
tree | ab91322feab6ef2ff04b2b52d055514611c0d1d3 /src/components/script/dom/bindings/js.rs | |
parent | 3e558fdcb1667c162d8f27194696415dcb7eae1f (diff) | |
download | servo-da703d6a808346a59ec4ca82c27209b4170a95c8.tar.gz servo-da703d6a808346a59ec4ca82c27209b4170a95c8.zip |
JS<T> contains '*T' instead of RefCell.
Diffstat (limited to 'src/components/script/dom/bindings/js.rs')
-rw-r--r-- | src/components/script/dom/bindings/js.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/components/script/dom/bindings/js.rs b/src/components/script/dom/bindings/js.rs index 44178cb93c3..b5a83b01e7c 100644 --- a/src/components/script/dom/bindings/js.rs +++ b/src/components/script/dom/bindings/js.rs @@ -111,7 +111,7 @@ impl<T: Reflectable> Temporary<T> { /// A rooted, JS-owned value. Must only be used as a field in other JS-owned types. pub struct JS<T> { - ptr: RefCell<*mut T> + ptr: *T } impl<T> Eq for JS<T> { @@ -134,7 +134,7 @@ impl JS<Node> { pub unsafe fn from_trusted_node_address(inner: TrustedNodeAddress) -> JS<Node> { let TrustedNodeAddress(addr) = inner; JS { - ptr: RefCell::new(addr as *mut Node) + ptr: addr as *Node } } } @@ -143,7 +143,7 @@ impl JS<XMLHttpRequest> { pub unsafe fn from_trusted_xhr_address(inner: TrustedXHRAddress) -> JS<XMLHttpRequest> { let TrustedXHRAddress(addr) = inner; JS { - ptr: RefCell::new(addr as *mut XMLHttpRequest) + ptr: addr as *XMLHttpRequest } } } @@ -152,7 +152,7 @@ impl<T: Reflectable> JS<T> { /// Create a new JS-owned value wrapped from a raw Rust pointer. pub unsafe fn from_raw(raw: *mut T) -> JS<T> { JS { - ptr: RefCell::new(raw) + ptr: raw as *T } } @@ -404,14 +404,13 @@ impl<'a, 'b, T: Reflectable> Root<'a, 'b, T> { /// It cannot not outlive its associated RootCollection, and it contains a JSRef /// which cannot outlive this new Root. fn new(roots: &'a RootCollection, unrooted: &JS<T>) -> Root<'a, 'b, T> { - let ptr: *T = unrooted.ptr.borrow().clone() as *T; let root = Root { root_list: roots, jsref: JSRef { - ptr: ptr, + ptr: unrooted.ptr.clone(), chain: ContravariantLifetime, }, - ptr: ptr, + ptr: unrooted.ptr.clone(), js_ptr: unrooted.reflector().get_jsobject(), }; roots.root(&root); @@ -494,7 +493,7 @@ impl<'a,T> JSRef<'a,T> { pub fn unrooted(&self) -> JS<T> { JS { - ptr: RefCell::new(self.ptr as *mut T) + ptr: self.ptr } } } |