diff options
author | Ms2ger <ms2ger@gmail.com> | 2015-01-01 12:21:40 +0100 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2015-02-05 18:45:21 +0100 |
commit | 4036206734efb924ea555b0a368692378221b54c (patch) | |
tree | ce9118d757779484b64fc113995a0745ace92844 /components/script/dom/bindings/js.rs | |
parent | d8c2c88bbda1ede44a4c202a91dea09e51d9190a (diff) | |
download | servo-4036206734efb924ea555b0a368692378221b54c.tar.gz servo-4036206734efb924ea555b0a368692378221b54c.zip |
Remove the Root.jsref member.
It is simpler to just construct it when the methods are called.
Diffstat (limited to 'components/script/dom/bindings/js.rs')
-rw-r--r-- | components/script/dom/bindings/js.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index 8b8f19e4d97..216c38604ab 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -584,7 +584,7 @@ pub struct Root<T> { /// List that ensures correct dynamic root ordering root_list: &'static RootCollection, /// Reference to rooted value that must not outlive this container - jsref: JSRef<'static, T>, + ptr: NonZero<*const T>, /// On-stack JS pointer to assuage conservative stack scanner js_ptr: *mut JSObject, } @@ -596,10 +596,7 @@ impl<T: Reflectable> Root<T> { fn new(roots: &'static RootCollection, unrooted: &JS<T>) -> Root<T> { let root = Root { root_list: roots, - jsref: JSRef { - ptr: unrooted.ptr.clone(), - chain: ContravariantLifetime, - }, + ptr: unrooted.ptr, js_ptr: unrooted.reflector().get_jsobject(), }; roots.root(&root); @@ -610,7 +607,7 @@ impl<T: Reflectable> Root<T> { /// the lifetime of this root. pub fn r<'b>(&'b self) -> JSRef<'b, T> { JSRef { - ptr: self.jsref.ptr, + ptr: self.ptr, chain: ContravariantLifetime, } } @@ -621,7 +618,7 @@ impl<T: Reflectable> Root<T> { /// DO NOT CALL. pub fn get_unsound_ref_forever<'b>(&self) -> JSRef<'b, T> { JSRef { - ptr: self.jsref.ptr, + ptr: self.ptr, chain: ContravariantLifetime, } } |