Make the parallel traversal an explicit flag instead of guessing from Servo.

MozReview-Commit-ID: 83DgB1sZnCb
This commit is contained in:
Bobby Holley 2017-08-10 17:28:25 -07:00
parent f4ccbf3687
commit 248a245c95
2 changed files with 7 additions and 1 deletions

View file

@ -31,6 +31,10 @@ bitflags! {
const ClearDirtyDescendants = 1 << 5,
/// Clears the animation-only dirty descendants bit in the subtree.
const ClearAnimationOnlyDirtyDescendants = 1 << 6,
/// Allows the traversal to run in parallel if there are sufficient cores on
/// the machine.
const ParallelTraversal = 1 << 7,
}
}
@ -62,6 +66,7 @@ pub fn assert_traversal_flags_match() {
ServoTraversalFlags_ClearDirtyDescendants => ClearDirtyDescendants,
ServoTraversalFlags_ClearAnimationOnlyDirtyDescendants =>
ClearAnimationOnlyDirtyDescendants,
ServoTraversalFlags_ParallelTraversal => ParallelTraversal,
}
}

View file

@ -229,7 +229,8 @@ fn traverse_subtree(element: GeckoElement,
debug!("{:?}", ShowSubtreeData(element.as_node()));
let style_thread_pool = &*STYLE_THREAD_POOL;
let traversal_driver = if style_thread_pool.style_thread_pool.is_none() || !element.is_root() {
let traversal_driver = if !traversal_flags.contains(traversal_flags::ParallelTraversal) ||
style_thread_pool.style_thread_pool.is_none() {
TraversalDriver::Sequential
} else {
TraversalDriver::Parallel