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:
Bobby Holley 2017-04-12 14:19:06 +08:00
parent 3c5a21ebf3
commit dc5dbd5542
7 changed files with 66 additions and 50 deletions

View file

@ -107,7 +107,8 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::mpsc::{Receiver, Sender, channel};
use std::thread;
use style::animation::Animation;
use style::context::{QuirksMode, ReflowGoal, SharedStyleContext, ThreadLocalStyleContextCreationInfo};
use style::context::{QuirksMode, ReflowGoal, SharedStyleContext};
use style::context::{StyleSystemOptions, ThreadLocalStyleContextCreationInfo};
use style::data::StoredRestyleHint;
use style::dom::{ShowSubtree, ShowSubtreeDataAndPrimaryValues, TElement, TNode};
use style::error_reporting::StdoutErrorReporter;
@ -516,6 +517,7 @@ impl LayoutThread {
LayoutContext {
style_context: SharedStyleContext {
stylist: rw_data.stylist.clone(),
options: StyleSystemOptions::default(),
guards: guards,
running_animations: self.running_animations.clone(),
expired_animations: self.expired_animations.clone(),