diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/style/gecko/global_style_data.rs | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/components/style/gecko/global_style_data.rs b/components/style/gecko/global_style_data.rs index 0f80a18816e..f396a4ee451 100644 --- a/components/style/gecko/global_style_data.rs +++ b/components/style/gecko/global_style_data.rs @@ -16,12 +16,6 @@ use std::ffi::CString; /// Global style data pub struct GlobalStyleData { - /// How many threads parallel styling can use. - pub num_threads: usize, - - /// The parallel styling thread pool. - pub style_thread_pool: Option<rayon::ThreadPool>, - /// Shared RWLock for CSSOM objects pub shared_lock: SharedRwLock, @@ -29,6 +23,15 @@ pub struct GlobalStyleData { pub options: StyleSystemOptions, } +/// Global thread pool +pub struct StyleThreadPool { + /// How many threads parallel styling can use. + pub num_threads: usize, + + /// The parallel styling thread pool. + pub style_thread_pool: Option<rayon::ThreadPool>, +} + fn thread_name(index: usize) -> String { format!("StyleThread#{}", index) } @@ -53,8 +56,8 @@ fn thread_shutdown(_: usize) { } lazy_static! { - /// Global style data - pub static ref GLOBAL_STYLE_DATA: GlobalStyleData = { + /// Global thread pool + pub static ref STYLE_THREAD_POOL: StyleThreadPool = { let stylo_threads = env::var("STYLO_THREADS") .map(|s| s.parse::<usize>().expect("invalid STYLO_THREADS value")); let mut num_threads = match stylo_threads { @@ -93,11 +96,14 @@ lazy_static! { pool }; - GlobalStyleData { + StyleThreadPool { num_threads: num_threads, style_thread_pool: pool, - shared_lock: SharedRwLock::new(), - options: StyleSystemOptions::default(), } }; + /// Global style data + pub static ref GLOBAL_STYLE_DATA: GlobalStyleData = GlobalStyleData { + shared_lock: SharedRwLock::new(), + options: StyleSystemOptions::default(), + }; } |