From 378babfd4ce587295b826aea169327a2706095f4 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Wed, 27 Sep 2017 14:16:05 +0200 Subject: [PATCH] Move STACK_ROOTS to dom::bindings::root --- components/script/dom/bindings/root.rs | 7 ++++--- components/script/script_thread.rs | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index 9f10fc87f2a..ae81e4909b9 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -35,8 +35,7 @@ use js::jsapi::{JSObject, JSTracer, Heap}; use js::rust::GCMethods; use mitochondria::OnceCell; use script_layout_interface::TrustedNodeAddress; -use script_thread::STACK_ROOTS; -use std::cell::UnsafeCell; +use std::cell::{Cell, UnsafeCell}; use std::default::Default; use std::hash::{Hash, Hasher}; #[cfg(debug_assertions)] @@ -157,7 +156,7 @@ pub struct RootCollection { } /// A pointer to a RootCollection, for use in global variables. -pub struct RootCollectionPtr(pub *const RootCollection); +struct RootCollectionPtr(pub *const RootCollection); impl Copy for RootCollectionPtr {} impl Clone for RootCollectionPtr { @@ -166,6 +165,8 @@ impl Clone for RootCollectionPtr { } } +thread_local!(static STACK_ROOTS: Cell> = Cell::new(None)); + pub struct ThreadLocalStackRoots<'a>(PhantomData<&'a u32>); impl<'a> ThreadLocalStackRoots<'a> { diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index eb8b9b389a7..1891e84784d 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -35,7 +35,7 @@ use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::DomObject; use dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootCollection}; -use dom::bindings::root::{RootCollectionPtr, RootedReference, ThreadLocalStackRoots}; +use dom::bindings::root::{RootedReference, ThreadLocalStackRoots}; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::trace::JSTraceable; @@ -129,7 +129,6 @@ use webvr_traits::{WebVREvent, WebVRMsg}; pub type ImageCacheMsg = (PipelineId, PendingImageResponse); -thread_local!(pub static STACK_ROOTS: Cell> = Cell::new(None)); thread_local!(static SCRIPT_THREAD_ROOT: Cell> = Cell::new(None)); pub unsafe fn trace_thread(tr: *mut JSTracer) {