Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix `--layout-threads 1` in layout 2020 #25230

Merged
merged 3 commits into from Dec 11, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Support STYLO_THREADS=1

  • Loading branch information
SimonSapin committed Dec 10, 2019
commit aade6030258ac644739cc3e7658c16f72fec5bd2
@@ -1076,14 +1076,18 @@ impl LayoutThread {
};

let rayon_pool = STYLE_THREAD_POOL.pool();
let rayon_pool = rayon_pool.as_ref().unwrap();
let rayon_pool = rayon_pool.as_ref();

let box_tree = if token.should_traverse() {
driver::traverse_dom(&traversal, token, Some(rayon_pool));
driver::traverse_dom(&traversal, token, rayon_pool);

let root_node = document.root_element().unwrap().as_node();
let box_tree =
rayon_pool.install(|| BoxTreeRoot::construct(traversal.context(), root_node));
let build_box_tree = || BoxTreeRoot::construct(traversal.context(), root_node);
let box_tree = if let Some(pool) = rayon_pool {
pool.install(build_box_tree)
} else {
build_box_tree()
};
Some(box_tree)
} else {
None
@@ -1096,8 +1100,12 @@ impl LayoutThread {
self.viewport_size.width.to_f32_px(),
self.viewport_size.height.to_f32_px(),
);
let fragment_tree =
rayon_pool.install(|| box_tree.layout(&layout_context, viewport_size));
let run_layout = || box_tree.layout(&layout_context, viewport_size);
let fragment_tree = if let Some(pool) = rayon_pool {
pool.install(run_layout)
} else {
run_layout()
};
*self.box_tree_root.borrow_mut() = Some(box_tree);
*self.fragment_tree_root.borrow_mut() = Some(fragment_tree);
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.