mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Store style system options in the global style data and shared style context.
I wanted to add an environmental variable to disable the style sharing cache for gecko, but the current pattern involves lazy_static!, which involves an atomic operation on lookup, which is a bit hot to do each time we try to share styles. This makes that work happen once per process.
This commit is contained in:
parent
3c5a21ebf3
commit
dc5dbd5542
7 changed files with 66 additions and 50 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
//! Global style data
|
||||
|
||||
use context::StyleSystemOptions;
|
||||
use num_cpus;
|
||||
use rayon;
|
||||
use shared_lock::SharedRwLock;
|
||||
|
@ -20,6 +21,9 @@ pub struct GlobalStyleData {
|
|||
|
||||
/// Shared RWLock for CSSOM objects
|
||||
pub shared_lock: SharedRwLock,
|
||||
|
||||
/// Global style system options determined by env vars.
|
||||
pub options: StyleSystemOptions,
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
|
@ -45,6 +49,7 @@ lazy_static! {
|
|||
num_threads: num_threads,
|
||||
style_thread_pool: pool,
|
||||
shared_lock: SharedRwLock::new(),
|
||||
options: StyleSystemOptions::default(),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue