mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #11946 - emilio:animations-sender, r=bholley
style: Remove the Mutex from new_animations_sender by moving it to the local StyleContext. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors <!-- Either: --> - [x] These changes do not require tests because refactoring. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> 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. r? @SimonSapin/@mbrubeck for the style/layout, @bholley for the geckolib changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11946) <!-- Reviewable:end -->
This commit is contained in:
commit
ec0d3e084d
15 changed files with 166 additions and 134 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue