From 248a245c95c4bd1eaaa89476c37e28c384941af9 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Thu, 10 Aug 2017 17:28:25 -0700 Subject: [PATCH] Make the parallel traversal an explicit flag instead of guessing from Servo. MozReview-Commit-ID: 83DgB1sZnCb --- components/style/traversal_flags.rs | 5 +++++ ports/geckolib/glue.rs | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/components/style/traversal_flags.rs b/components/style/traversal_flags.rs index 7a985c3d3cf..2e3e0f4c2ad 100644 --- a/components/style/traversal_flags.rs +++ b/components/style/traversal_flags.rs @@ -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, } } diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 552ee02fe61..0d0ff0db9be 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -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