diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-26 01:53:40 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-26 09:49:10 +0200 |
commit | f87c2a8d7616112ca924e30292db2d244cf87eec (patch) | |
tree | 7344afe7ec0ec1ac7d1d13f5385111ee9c4be332 /components/script/dom/bindings/weakref.rs | |
parent | 577370746e2ce3da7fa25a20b8e1bbeed319df65 (diff) | |
download | servo-f87c2a8d7616112ca924e30292db2d244cf87eec.tar.gz servo-f87c2a8d7616112ca924e30292db2d244cf87eec.zip |
Rename Root<T> to DomRoot<T>
In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>,
where Root<T> will be able to handle all the things that need to be
rooted that have a stable traceable address that doesn't move for the
whole lifetime of the root. Stay tuned.
Diffstat (limited to 'components/script/dom/bindings/weakref.rs')
-rw-r--r-- | components/script/dom/bindings/weakref.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/components/script/dom/bindings/weakref.rs b/components/script/dom/bindings/weakref.rs index 61a50a240b1..6ece47cea3b 100644 --- a/components/script/dom/bindings/weakref.rs +++ b/components/script/dom/bindings/weakref.rs @@ -13,7 +13,7 @@ use core::nonzero::NonZero; use dom::bindings::reflector::DomObject; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::trace::JSTraceable; use heapsize::HeapSizeOf; use js::jsapi::{JSTracer, JS_GetReservedSlot, JS_SetReservedSlot}; @@ -84,9 +84,9 @@ impl<T: WeakReferenceable> WeakRef<T> { value.downgrade() } - /// Root a weak reference. Returns `None` if the object was already collected. - pub fn root(&self) -> Option<Root<T>> { - unsafe { &*self.ptr.get() }.value.get().map(Root::new) + /// DomRoot a weak reference. Returns `None` if the object was already collected. + pub fn root(&self) -> Option<DomRoot<T>> { + unsafe { &*self.ptr.get() }.value.get().map(DomRoot::new) } /// Return whether the weakly-referenced object is still alive. @@ -179,9 +179,9 @@ impl<T: WeakReferenceable> MutableWeakRef<T> { } } - /// Root a mutable weak reference. Returns `None` if the object + /// DomRoot a mutable weak reference. Returns `None` if the object /// was already collected. - pub fn root(&self) -> Option<Root<T>> { + pub fn root(&self) -> Option<DomRoot<T>> { unsafe { &*self.cell.get() }.as_ref().and_then(WeakRef::root) } } |