aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/root.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2017-09-27 14:24:37 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2017-09-27 14:24:37 +0200
commitb441f8a0f72469a2c2f6e5f51a4b8a00709ef707 (patch)
treea00ba72a9786252431625fa67251305dc686bccc /components/script/dom/bindings/root.rs
parent378babfd4ce587295b826aea169327a2706095f4 (diff)
downloadservo-b441f8a0f72469a2c2f6e5f51a4b8a00709ef707.tar.gz
servo-b441f8a0f72469a2c2f6e5f51a4b8a00709ef707.zip
Kill RootCollectionPtr
Diffstat (limited to 'components/script/dom/bindings/root.rs')
-rw-r--r--components/script/dom/bindings/root.rs19
1 files changed, 4 insertions, 15 deletions
diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs
index ae81e4909b9..cbab8951184 100644
--- a/components/script/dom/bindings/root.rs
+++ b/components/script/dom/bindings/root.rs
@@ -91,7 +91,7 @@ impl<T: DomObject> DomRoot<T> {
unsafe fn new(unrooted: Dom<T>) -> DomRoot<T> {
debug_assert!(thread_state::get().is_script());
STACK_ROOTS.with(|ref collection| {
- let RootCollectionPtr(collection) = collection.get().unwrap();
+ let collection = collection.get().unwrap();
(*collection).root(unrooted.reflector());
DomRoot {
ptr: unrooted,
@@ -155,24 +155,14 @@ pub struct RootCollection {
roots: UnsafeCell<Vec<*const Reflector>>,
}
-/// A pointer to a RootCollection, for use in global variables.
-struct RootCollectionPtr(pub *const RootCollection);
-
-impl Copy for RootCollectionPtr {}
-impl Clone for RootCollectionPtr {
- fn clone(&self) -> RootCollectionPtr {
- *self
- }
-}
-
-thread_local!(static STACK_ROOTS: Cell<Option<RootCollectionPtr>> = Cell::new(None));
+thread_local!(static STACK_ROOTS: Cell<Option<*const RootCollection>> = Cell::new(None));
pub struct ThreadLocalStackRoots<'a>(PhantomData<&'a u32>);
impl<'a> ThreadLocalStackRoots<'a> {
pub fn new(roots: &'a RootCollection) -> Self {
STACK_ROOTS.with(|ref r| {
- r.set(Some(RootCollectionPtr(roots as *const _)))
+ r.set(Some(roots))
});
ThreadLocalStackRoots(PhantomData)
}
@@ -220,8 +210,7 @@ impl RootCollection {
pub unsafe fn trace_roots(tracer: *mut JSTracer) {
debug!("tracing stack roots");
STACK_ROOTS.with(|ref collection| {
- let RootCollectionPtr(collection) = collection.get().unwrap();
- let collection = &*(*collection).roots.get();
+ let collection = &*(*collection.get().unwrap()).roots.get();
for root in collection {
trace_reflector(tracer, "on stack", &**root);
}