Further changes required by Servo

This commit is contained in:
Oriol Brufau 2023-11-22 20:58:28 +01:00 committed by Martin Robinson
parent 23d60c2195
commit 0b75c1d9d1
2 changed files with 17 additions and 3 deletions

View file

@ -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,

View file

@ -81,6 +81,7 @@ fn distribute_one_chunk<'a, 'scope, E, D>(
D: DomTraversal<E>,
{
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,