summaryrefslogtreecommitdiffstats
path: root/servo/components/style/sharing/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'servo/components/style/sharing/mod.rs')
-rw-r--r--servo/components/style/sharing/mod.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/servo/components/style/sharing/mod.rs b/servo/components/style/sharing/mod.rs
index 28592a02c5..2b66db5530 100644
--- a/servo/components/style/sharing/mod.rs
+++ b/servo/components/style/sharing/mod.rs
@@ -76,13 +76,11 @@ use crate::style_resolver::{PrimaryStyle, ResolvedElementStyles};
use crate::stylist::Stylist;
use crate::values::AtomIdent;
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
-use owning_ref::OwningHandle;
use selectors::matching::{NeedsSelectorFlags, SelectorCaches, VisitedHandlingMode};
-use servo_arc::Arc;
use smallbitvec::SmallBitVec;
use smallvec::SmallVec;
use std::marker::PhantomData;
-use std::mem::{self, ManuallyDrop};
+use std::mem;
use std::ops::Deref;
use std::ptr::NonNull;
use uluru::LRUCache;
@@ -535,12 +533,11 @@ impl<E: TElement> SharingCache<E> {
/// [2] https://github.com/rust-lang/rust/issues/13707
type SharingCache<E> = SharingCacheBase<StyleSharingCandidate<E>>;
type TypelessSharingCache = SharingCacheBase<FakeCandidate>;
-type StoredSharingCache = Arc<AtomicRefCell<TypelessSharingCache>>;
thread_local! {
// See the comment on bloom.rs about why do we leak this.
- static SHARING_CACHE_KEY: ManuallyDrop<StoredSharingCache> =
- ManuallyDrop::new(Arc::new_leaked(Default::default()));
+ static SHARING_CACHE_KEY: &'static AtomicRefCell<TypelessSharingCache> =
+ Box::leak(Default::default());
}
/// An LRU cache of the last few nodes seen, so that we can aggressively try to
@@ -550,7 +547,7 @@ thread_local! {
/// storing nodes here temporarily is safe.
pub struct StyleSharingCache<E: TElement> {
/// The LRU cache, with the type cast away to allow persisting the allocation.
- cache_typeless: OwningHandle<StoredSharingCache, AtomicRefMut<'static, TypelessSharingCache>>,
+ cache_typeless: AtomicRefMut<'static, TypelessSharingCache>,
/// Bind this structure to the lifetime of E, since that's what we effectively store.
marker: PhantomData<SendElement<E>>,
/// The DOM depth we're currently at. This is used as an optimization to
@@ -593,9 +590,7 @@ impl<E: TElement> StyleSharingCache<E> {
mem::align_of::<SharingCache<E>>(),
mem::align_of::<TypelessSharingCache>()
);
- let cache_arc = SHARING_CACHE_KEY.with(|c| Arc::clone(&*c));
- let cache =
- OwningHandle::new_with_fn(cache_arc, |x| unsafe { x.as_ref() }.unwrap().borrow_mut());
+ let cache = SHARING_CACHE_KEY.with(|c| c.borrow_mut());
debug_assert!(cache.is_empty());
StyleSharingCache {