aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/servo/lib.rs9
-rw-r--r--components/style/context.rs21
-rw-r--r--components/style/traversal.rs11
3 files changed, 36 insertions, 5 deletions
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index 0ab416900c8..7e8a6c1a438 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -310,6 +310,15 @@ where
// Global configuration options, parsed from the command line.
let opts = opts::get();
+ use std::sync::atomic::Ordering;
+
+ style::context::DEFAULT_DISABLE_STYLE_SHARING_CACHE
+ .store(opts.disable_share_style_cache, Ordering::Relaxed);
+ style::context::DEFAULT_DUMP_STYLE_STATISTICS
+ .store(opts.style_sharing_stats, Ordering::Relaxed);
+ style::traversal::IS_SERVO_NONINCREMENTAL_LAYOUT
+ .store(opts.nonincremental_layout, Ordering::Relaxed);
+
if !opts.multiprocess {
media_platform::init();
}
diff --git a/components/style/context.rs b/components/style/context.rs
index 0c7d9744117..d07cf6bd94c 100644
--- a/components/style/context.rs
+++ b/components/style/context.rs
@@ -103,14 +103,29 @@ fn get_env_usize(name: &str) -> Option<usize> {
})
}
+/// A global variable holding the state of
+/// `StyleSystemOptions::default().disable_style_sharing_cache`.
+/// See [#22854](https://github.com/servo/servo/issues/22854).
+#[cfg(feature = "servo")]
+pub static DEFAULT_DISABLE_STYLE_SHARING_CACHE: std::sync::atomic::AtomicBool =
+ std::sync::atomic::AtomicBool::new(false);
+
+/// A global variable holding the state of
+/// `StyleSystemOptions::default().dump_style_statistics`.
+/// See [#22854](https://github.com/servo/servo/issues/22854).
+#[cfg(feature = "servo")]
+pub static DEFAULT_DUMP_STYLE_STATISTICS: std::sync::atomic::AtomicBool =
+ std::sync::atomic::AtomicBool::new(false);
+
impl Default for StyleSystemOptions {
#[cfg(feature = "servo")]
fn default() -> Self {
- use servo_config::opts;
+ use std::sync::atomic::Ordering;
StyleSystemOptions {
- disable_style_sharing_cache: opts::get().disable_share_style_cache,
- dump_style_statistics: opts::get().style_sharing_stats,
+ disable_style_sharing_cache: DEFAULT_DISABLE_STYLE_SHARING_CACHE
+ .load(Ordering::Relaxed),
+ dump_style_statistics: DEFAULT_DUMP_STYLE_STATISTICS.load(Ordering::Relaxed),
style_statistics_threshold: DEFAULT_STATISTICS_THRESHOLD,
}
}
diff --git a/components/style/traversal.rs b/components/style/traversal.rs
index 69d0e463150..1f64e7f22f0 100644
--- a/components/style/traversal.rs
+++ b/components/style/traversal.rs
@@ -45,12 +45,19 @@ impl<E: TElement> PreTraverseToken<E> {
}
}
+/// A global variable holding the state of
+/// `is_servo_nonincremental_layout()`.
+/// See [#22854](https://github.com/servo/servo/issues/22854).
+#[cfg(feature = "servo")]
+pub static IS_SERVO_NONINCREMENTAL_LAYOUT: std::sync::atomic::AtomicBool =
+ std::sync::atomic::AtomicBool::new(false);
+
#[cfg(feature = "servo")]
#[inline]
fn is_servo_nonincremental_layout() -> bool {
- use servo_config::opts;
+ use std::sync::atomic::Ordering;
- opts::get().nonincremental_layout
+ IS_SERVO_NONINCREMENTAL_LAYOUT.load(Ordering::Relaxed)
}
#[cfg(not(feature = "servo"))]