mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Replace RwLock<StyleRule> with Locked<StyleRule>
This commit is contained in:
parent
57724e5a37
commit
aeffca2a59
33 changed files with 279 additions and 334 deletions
|
@ -17,6 +17,7 @@ use parking_lot::RwLock;
|
|||
use selector_parser::PseudoElement;
|
||||
use selectors::matching::ElementSelectorFlags;
|
||||
use servo_config::opts;
|
||||
use shared_lock::ReadGuards;
|
||||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::fmt;
|
||||
|
@ -61,10 +62,13 @@ pub enum QuirksMode {
|
|||
///
|
||||
/// There's exactly one of these during a given restyle traversal, and it's
|
||||
/// shared among the worker threads.
|
||||
pub struct SharedStyleContext {
|
||||
pub struct SharedStyleContext<'a> {
|
||||
/// The CSS selector stylist.
|
||||
pub stylist: Arc<Stylist>,
|
||||
|
||||
/// Guards for pre-acquired locks
|
||||
pub guards: ReadGuards<'a>,
|
||||
|
||||
/// The animations that are currently running.
|
||||
pub running_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>,
|
||||
|
||||
|
@ -85,7 +89,7 @@ pub struct SharedStyleContext {
|
|||
pub quirks_mode: QuirksMode,
|
||||
}
|
||||
|
||||
impl SharedStyleContext {
|
||||
impl<'a> SharedStyleContext<'a> {
|
||||
/// Return a suitable viewport size in order to be used for viewport units.
|
||||
pub fn viewport_size(&self) -> Size2D<Au> {
|
||||
self.stylist.device.au_viewport_size()
|
||||
|
@ -306,7 +310,7 @@ impl<E: TElement> Drop for ThreadLocalStyleContext<E> {
|
|||
/// shared style context, and a mutable reference to a local one.
|
||||
pub struct StyleContext<'a, E: TElement + 'a> {
|
||||
/// The shared style context reference.
|
||||
pub shared: &'a SharedStyleContext,
|
||||
pub shared: &'a SharedStyleContext<'a>,
|
||||
/// The thread-local style context (mutable) reference.
|
||||
pub thread_local: &'a mut ThreadLocalStyleContext<E>,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue