mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Auto merge of #28635 - negator:patch-2, r=jdm
Do not use ParallelIterator if not using rayon
The rayon [`ParalllelIIterator`](https://github.com/rayon-rs/rayon/blob/master/src/iter/plumbing/README.md) is being used for inline content size calculations irrespective of the `use_rayon` flag, which can lead to an unbounded (dynamically determined) number of threads being spawned during iteration.
The check is performed for static position calculations, however:
6fced22e47/components/layout_2020/flow/mod.rs (L235-L242)
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
f77e66bbf8
1 changed files with 9 additions and 1 deletions
|
@ -141,13 +141,21 @@ impl BlockContainer {
|
|||
writing_mode: WritingMode,
|
||||
) -> ContentSizes {
|
||||
match &self {
|
||||
Self::BlockLevelBoxes(boxes) => boxes
|
||||
Self::BlockLevelBoxes(boxes) if layout_context.use_rayon => boxes
|
||||
.par_iter()
|
||||
.map(|box_| {
|
||||
box_.borrow_mut()
|
||||
.inline_content_sizes(layout_context, writing_mode)
|
||||
})
|
||||
.reduce(ContentSizes::zero, ContentSizes::max),
|
||||
Self::BlockLevelBoxes(boxes) => boxes
|
||||
.iter()
|
||||
.map(|box_| {
|
||||
box_.borrow_mut()
|
||||
.inline_content_sizes(layout_context, writing_mode)
|
||||
})
|
||||
.reduce(ContentSizes::max)
|
||||
.unwrap_or_else(ContentSizes::zero),
|
||||
Self::InlineFormattingContext(context) => {
|
||||
context.inline_content_sizes(layout_context, writing_mode)
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue