diff options
author | Emilio Cobos Álvarez <me@emiliocobos.me> | 2016-06-29 20:04:30 -0700 |
---|---|---|
committer | Emilio Cobos Álvarez <me@emiliocobos.me> | 2016-07-01 13:48:06 -0700 |
commit | 203d2a62c24ca3d8b07e4ec492fc53bb30bbeedc (patch) | |
tree | 979b0367ce41c744c270a54092c962b916f5a6e9 /components/layout/context.rs | |
parent | 5478e605aef93cc384b709688cc68e3ed854a68b (diff) | |
download | servo-203d2a62c24ca3d8b07e4ec492fc53bb30bbeedc.tar.gz servo-203d2a62c24ca3d8b07e4ec492fc53bb30bbeedc.zip |
style: Remove the Mutex from new_animations_sender by moving it to the local StyleContext.
As a follow-up, we could move all the data living under a mutex in the
SharedLayoutContext only in order to create the local context to the same place.
This should increase animation performance when there are multiple animations in
one page that happen to be on different threads.
Diffstat (limited to 'components/layout/context.rs')
-rw-r--r-- | components/layout/context.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/components/layout/context.rs b/components/layout/context.rs index 11cfed0d1b3..08237579626 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -25,15 +25,14 @@ use std::hash::BuildHasherDefault; use std::rc::Rc; use std::sync::{Arc, Mutex, RwLock}; use style::context::{LocalStyleContext, StyleContext}; -use style::matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache}; -use style::properties::ServoComputedValues; use style::selector_impl::ServoSelectorImpl; use style::servo::SharedStyleContext; use url::Url; use util::opts; struct LocalLayoutContext { - style_context: LocalStyleContext<ServoComputedValues>, + style_context: LocalStyleContext<ServoSelectorImpl>, + font_context: RefCell<FontContext>, } @@ -64,11 +63,10 @@ fn create_or_get_local_context(shared_layout_context: &SharedLayoutContext) context } else { let font_cache_thread = shared_layout_context.font_cache_thread.lock().unwrap().clone(); + let local_style_data = shared_layout_context.style_context.local_context_creation_data.lock().unwrap(); + let context = Rc::new(LocalLayoutContext { - style_context: LocalStyleContext { - applicable_declarations_cache: RefCell::new(ApplicableDeclarationsCache::new()), - style_sharing_candidate_cache: RefCell::new(StyleSharingCandidateCache::new()), - }, + style_context: LocalStyleContext::new(&local_style_data), font_context: RefCell::new(FontContext::new(font_cache_thread)), }); *r = Some(context.clone()); @@ -110,7 +108,7 @@ impl<'a> StyleContext<'a, ServoSelectorImpl> for LayoutContext<'a> { &self.shared.style_context } - fn local_context(&self) -> &LocalStyleContext<ServoComputedValues> { + fn local_context(&self) -> &LocalStyleContext<ServoSelectorImpl> { &self.cached_local_layout_context.style_context } } |