aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/sharing/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/style/sharing/mod.rs')
-rw-r--r--components/style/sharing/mod.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/components/style/sharing/mod.rs b/components/style/sharing/mod.rs
index 3ce2a717dc8..5f5d1c6cab5 100644
--- a/components/style/sharing/mod.rs
+++ b/components/style/sharing/mod.rs
@@ -485,8 +485,12 @@ type SharingCache<E> = SharingCacheBase<StyleSharingCandidate<E>>;
type TypelessSharingCache = SharingCacheBase<FakeCandidate>;
type StoredSharingCache = Arc<AtomicRefCell<TypelessSharingCache>>;
-thread_local!(static SHARING_CACHE_KEY: StoredSharingCache =
- Arc::new(AtomicRefCell::new(TypelessSharingCache::default())));
+thread_local! {
+ // TODO(emilio): Looks like a few of these should just be Rc<RefCell<>> or
+ // something. No need for atomics in the thread-local code.
+ static SHARING_CACHE_KEY: StoredSharingCache =
+ Arc::new_leaked(AtomicRefCell::new(TypelessSharingCache::default()));
+}
/// An LRU cache of the last few nodes seen, so that we can aggressively try to
/// reuse their styles.