summaryrefslogtreecommitdiffstats
path: root/servo/components/style/sharing
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
commit59203c63bb777a3bacec32fb8830fba33540e809 (patch)
tree58298e711c0ff0575818c30485b44a2f21bf28a0 /servo/components/style/sharing
parentAdding upstream version 126.0.1. (diff)
downloadfirefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz
firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'servo/components/style/sharing')
-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 {