mirror of
https://github.com/servo/servo.git
synced 2025-07-16 03:43:38 +01:00
layout: Stop using Rayon in single-threaded mode (#37832)
In layout, some parts of the code were still using parallel iterators from Rayon even when single-thread layout was activated. This change modifies those parts to use non-parallel iterators when `LayoutContext::use_rayon` is not active. Testing: It's very hard to make an automated test for this, but I've manually verified this by building with tracing and observing that layout runs only on a single thread now when loading https://servo.org. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
da364f7a61
commit
647122d0f6
3 changed files with 197 additions and 144 deletions
|
@ -1221,14 +1221,25 @@ impl InitialFlexLineLayout<'_> {
|
|||
);
|
||||
|
||||
// https://drafts.csswg.org/css-flexbox/#algo-cross-item
|
||||
let layout_results = items
|
||||
.par_iter()
|
||||
.zip(&item_used_main_sizes)
|
||||
.map(|(item, used_main_size)| {
|
||||
item.layout(*used_main_size, flex_context, None, None)
|
||||
.unwrap()
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let layout_results: Vec<_> = if flex_context.layout_context.use_rayon {
|
||||
items
|
||||
.par_iter()
|
||||
.zip(&item_used_main_sizes)
|
||||
.map(|(item, used_main_size)| {
|
||||
item.layout(*used_main_size, flex_context, None, None)
|
||||
.unwrap()
|
||||
})
|
||||
.collect()
|
||||
} else {
|
||||
items
|
||||
.iter()
|
||||
.zip(&item_used_main_sizes)
|
||||
.map(|(item, used_main_size)| {
|
||||
item.layout(*used_main_size, flex_context, None, None)
|
||||
.unwrap()
|
||||
})
|
||||
.collect()
|
||||
};
|
||||
|
||||
let items: Vec<_> = izip!(
|
||||
items.into_iter(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue