diff --git a/components/style/context.rs b/components/style/context.rs index d7db7a5ab61..de8c95bb430 100644 --- a/components/style/context.rs +++ b/components/style/context.rs @@ -26,7 +26,7 @@ use selectors::matching::ElementSelectorFlags; use servo_arc::Arc; #[cfg(feature = "servo")] use servo_atoms::Atom; use shared_lock::StylesheetGuards; -use sharing::StyleSharingCandidateCache; +use sharing::StyleSharingCache; use std::fmt; use std::ops; #[cfg(feature = "servo")] use std::sync::Mutex; @@ -679,7 +679,7 @@ impl StackLimitChecker { /// thread in order to be able to mutate it without locking. pub struct ThreadLocalStyleContext { /// A cache to share style among siblings. - pub style_sharing_candidate_cache: StyleSharingCandidateCache, + pub sharing_cache: StyleSharingCache, /// The bloom filter used to fast-reject selector-matching. pub bloom_filter: StyleBloom, /// A channel on which new animations that have been triggered by style @@ -716,7 +716,7 @@ impl ThreadLocalStyleContext { #[cfg(feature = "servo")] pub fn new(shared: &SharedStyleContext) -> Self { ThreadLocalStyleContext { - style_sharing_candidate_cache: StyleSharingCandidateCache::new(), + sharing_cache: StyleSharingCache::new(), bloom_filter: StyleBloom::new(), new_animations_sender: shared.local_context_creation_data.lock().unwrap().new_animations_sender.clone(), tasks: SequentialTaskList(Vec::new()), @@ -733,7 +733,7 @@ impl ThreadLocalStyleContext { /// Creates a new `ThreadLocalStyleContext` from a shared one. pub fn new(shared: &SharedStyleContext) -> Self { ThreadLocalStyleContext { - style_sharing_candidate_cache: StyleSharingCandidateCache::new(), + sharing_cache: StyleSharingCache::new(), bloom_filter: StyleBloom::new(), tasks: SequentialTaskList(Vec::new()), selector_flags: SelectorFlagsMap::new(), diff --git a/components/style/sharing/mod.rs b/components/style/sharing/mod.rs index bf81915ce47..43095fbd781 100644 --- a/components/style/sharing/mod.rs +++ b/components/style/sharing/mod.rs @@ -343,7 +343,7 @@ impl StyleSharingTarget { &mut self, context: &mut StyleContext, ) -> StyleSharingResult { - let cache = &mut context.thread_local.style_sharing_candidate_cache; + let cache = &mut context.thread_local.sharing_cache; let shared_context = &context.shared; let selector_flags_map = &mut context.thread_local.selector_flags; let bloom_filter = &context.thread_local.bloom_filter; @@ -436,7 +436,7 @@ thread_local!(static SHARING_CACHE_KEY: StoredSharingCache = /// /// Note that this cache is flushed every time we steal work from the queue, so /// storing nodes here temporarily is safe. -pub struct StyleSharingCandidateCache { +pub struct StyleSharingCache { /// The LRU cache, with the type cast away to allow persisting the allocation. cache_typeless: OwningHandle>, /// Bind this structure to the lifetime of E, since that's what we effectively store. @@ -447,13 +447,13 @@ pub struct StyleSharingCandidateCache { dom_depth: usize, } -impl Drop for StyleSharingCandidateCache { +impl Drop for StyleSharingCache { fn drop(&mut self) { self.clear(); } } -impl StyleSharingCandidateCache { +impl StyleSharingCache { fn cache(&self) -> &SharingCache { let base: &TypelessSharingCache = &*self.cache_typeless; unsafe { mem::transmute(base) } @@ -472,7 +472,7 @@ impl StyleSharingCandidateCache { let cache = OwningHandle::new_with_fn(cache_arc, |x| unsafe { x.as_ref() }.unwrap().borrow_mut()); debug_assert_eq!(cache.num_entries(), 0); - StyleSharingCandidateCache { + StyleSharingCache { cache_typeless: cache, marker: PhantomData, dom_depth: 0, diff --git a/components/style/traversal.rs b/components/style/traversal.rs index 4c066f87684..6ae81436972 100644 --- a/components/style/traversal.rs +++ b/components/style/traversal.rs @@ -658,7 +658,7 @@ where match target.share_style_if_possible(context) { StyleWasShared(index, styles) => { context.thread_local.statistics.styles_shared += 1; - context.thread_local.style_sharing_candidate_cache.touch(index); + context.thread_local.sharing_cache.touch(index); styles } CannotShare => { @@ -677,7 +677,7 @@ where }; context.thread_local - .style_sharing_candidate_cache + .sharing_cache .insert_if_possible( &element, new_styles.primary(),