From fc4d185079ea17cfc973e37e6f871c4927071b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 6 Jun 2023 23:14:56 +0200 Subject: [PATCH] style: Use ThreadPool::scope_fifo in style It does the same, but it saves an indentation level: https://searchfox.org/mozilla-central/rev/a11b63915bd7810a03635d733123448ab5bfcad3/third_party/rust/rayon-core/src/thread_pool/mod.rs#217 Differential Revision: https://phabricator.services.mozilla.com/D134321 --- components/style/driver.rs | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/components/style/driver.rs b/components/style/driver.rs index 82ed2a66386..b7e33454f41 100644 --- a/components/style/driver.rs +++ b/components/style/driver.rs @@ -133,29 +133,27 @@ where let tls = ScopedTLS::>::new(pool); let root_opaque = root.as_node().opaque(); let drain = discovered.drain(..); - pool.install(|| { + pool.scope_fifo(|scope| { // Enable a breadth-first rayon traversal. This causes the work // queue to be always FIFO, rather than FIFO for stealers and // FILO for the owner (which is what rayon does by default). This // ensures that we process all the elements at a given depth before // proceeding to the next depth, which is important for style sharing. - rayon::scope_fifo(|scope| { - #[cfg(feature = "gecko")] - gecko_profiler_label!(Layout, StyleComputation); - parallel::traverse_nodes( - drain, - DispatchMode::TailCall, - /* recursion_ok = */ true, - root_opaque, - PerLevelTraversalData { - current_dom_depth: depth, - }, - scope, - pool, - traversal, - &tls, - ); - }); + #[cfg(feature = "gecko")] + gecko_profiler_label!(Layout, StyleComputation); + parallel::traverse_nodes( + drain, + DispatchMode::TailCall, + /* recursion_ok = */ true, + root_opaque, + PerLevelTraversalData { + current_dom_depth: depth, + }, + scope, + pool, + traversal, + &tls, + ); }); tls_slots = Some(tls.into_slots());