mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
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
This commit is contained in:
parent
d0475b75d4
commit
fc4d185079
1 changed files with 16 additions and 18 deletions
|
@ -133,29 +133,27 @@ where
|
||||||
let tls = ScopedTLS::<ThreadLocalStyleContext<E>>::new(pool);
|
let tls = ScopedTLS::<ThreadLocalStyleContext<E>>::new(pool);
|
||||||
let root_opaque = root.as_node().opaque();
|
let root_opaque = root.as_node().opaque();
|
||||||
let drain = discovered.drain(..);
|
let drain = discovered.drain(..);
|
||||||
pool.install(|| {
|
pool.scope_fifo(|scope| {
|
||||||
// Enable a breadth-first rayon traversal. This causes the work
|
// Enable a breadth-first rayon traversal. This causes the work
|
||||||
// queue to be always FIFO, rather than FIFO for stealers and
|
// queue to be always FIFO, rather than FIFO for stealers and
|
||||||
// FILO for the owner (which is what rayon does by default). This
|
// FILO for the owner (which is what rayon does by default). This
|
||||||
// ensures that we process all the elements at a given depth before
|
// ensures that we process all the elements at a given depth before
|
||||||
// proceeding to the next depth, which is important for style sharing.
|
// proceeding to the next depth, which is important for style sharing.
|
||||||
rayon::scope_fifo(|scope| {
|
#[cfg(feature = "gecko")]
|
||||||
#[cfg(feature = "gecko")]
|
gecko_profiler_label!(Layout, StyleComputation);
|
||||||
gecko_profiler_label!(Layout, StyleComputation);
|
parallel::traverse_nodes(
|
||||||
parallel::traverse_nodes(
|
drain,
|
||||||
drain,
|
DispatchMode::TailCall,
|
||||||
DispatchMode::TailCall,
|
/* recursion_ok = */ true,
|
||||||
/* recursion_ok = */ true,
|
root_opaque,
|
||||||
root_opaque,
|
PerLevelTraversalData {
|
||||||
PerLevelTraversalData {
|
current_dom_depth: depth,
|
||||||
current_dom_depth: depth,
|
},
|
||||||
},
|
scope,
|
||||||
scope,
|
pool,
|
||||||
pool,
|
traversal,
|
||||||
traversal,
|
&tls,
|
||||||
&tls,
|
);
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
tls_slots = Some(tls.into_slots());
|
tls_slots = Some(tls.into_slots());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue