geckolib: move NUM_THREADS from style to geckolib

This change eliminates some gecko-only configuration in the style
component and moves NUM_THREADS closer to its only uses.
This commit is contained in:
Nathan Froyd 2017-02-22 11:22:16 -05:00
parent 3e81f8431e
commit fafcdda16a
6 changed files with 15 additions and 21 deletions

View file

@ -11,12 +11,9 @@ use gecko_bindings::bindings::RawServoStyleSet;
use gecko_bindings::structs::RawGeckoPresContextOwned;
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use media_queries::Device;
use num_cpus;
use parking_lot::RwLock;
use properties::ComputedValues;
use std::cmp;
use std::collections::HashMap;
use std::env;
use std::sync::Arc;
use std::sync::mpsc::{Receiver, Sender, channel};
use stylesheets::Stylesheet;
@ -53,16 +50,6 @@ pub struct PerDocumentStyleDataImpl {
/// and unexpected races while trying to mutate it.
pub struct PerDocumentStyleData(AtomicRefCell<PerDocumentStyleDataImpl>);
lazy_static! {
/// The number of layout threads, computed statically.
pub static ref NUM_THREADS: usize = {
match env::var("STYLO_THREADS").map(|s| s.parse::<usize>().expect("invalid STYLO_THREADS")) {
Ok(num) => num,
_ => cmp::max(num_cpus::get() * 3 / 4, 1),
}
};
}
impl PerDocumentStyleData {
/// Create a dummy `PerDocumentStyleData`.
pub fn new(pres_context: RawGeckoPresContextOwned) -> Self {