From 0b75c1d9d1d3169a16a7894de5b5e4f3f55600ff Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Wed, 22 Nov 2023 20:58:28 +0100 Subject: [PATCH] Further changes required by Servo --- components/style/driver.rs | 12 ++++++++++-- components/style/parallel.rs | 8 +++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/components/style/driver.rs b/components/style/driver.rs index cf48d831fdd..3b9534f7790 100644 --- a/components/style/driver.rs +++ b/components/style/driver.rs @@ -63,7 +63,10 @@ fn with_pool_in_place_scope<'scope, R>( /// See documentation of the pref for performance characteristics. fn work_unit_max() -> usize { - static_prefs::pref!("layout.css.stylo-work-unit-size") as usize + #[cfg(feature = "gecko")] + return static_prefs::pref!("layout.css.stylo-work-unit-size") as usize; + #[cfg(feature = "servo")] + return 16; } /// Do a DOM traversal for top-down and (optionally) bottom-up processing, generic over `D`. @@ -124,7 +127,12 @@ where discovered, root.as_node().opaque(), work_unit_max, - static_prefs::pref!("layout.css.stylo-local-work-queue.in-main-thread") as usize, + (|| { + #[cfg(feature = "gecko")] + return static_prefs::pref!("layout.css.stylo-local-work-queue.in-main-thread") as usize; + #[cfg(feature = "servo")] + return 32; + })(), PerLevelTraversalData { current_dom_depth: root.depth() }, maybe_scope, traversal, diff --git a/components/style/parallel.rs b/components/style/parallel.rs index 08f081b30e1..bb352c95101 100644 --- a/components/style/parallel.rs +++ b/components/style/parallel.rs @@ -81,6 +81,7 @@ fn distribute_one_chunk<'a, 'scope, E, D>( D: DomTraversal, { scope.spawn_fifo(move |scope| { + #[cfg(feature = "gecko")] gecko_profiler_label!(Layout, StyleComputation); let mut tlc = tls.ensure(create_thread_local_context); let mut context = StyleContext { @@ -92,7 +93,12 @@ fn distribute_one_chunk<'a, 'scope, E, D>( items, traversal_root, work_unit_max, - static_prefs::pref!("layout.css.stylo-local-work-queue.in-worker") as usize, + (|| { + #[cfg(feature = "gecko")] + return static_prefs::pref!("layout.css.stylo-local-work-queue.in-worker") as usize; + #[cfg(feature = "servo")] + return 0; + })(), traversal_data, Some(scope), traversal,