Bug 1450099 - Add a fast-path to FindScrollThumbNode() for when the drag metrics has not been initialized. r=kats
authorBotond Ballo <botond@mozilla.com>
Wed, 04 Apr 2018 16:36:01 -0400
changeset 411752 16bec207dc418bac3bef71ae5c15ade76032d6e0
parent 411751 4b4230db0bdce11b915a896b84ab99631c77aa82
child 411753 2dc5471ebd4a119941db86cbec9ed7d413b9a851
push id33770
push usernerli@mozilla.com
push dateThu, 05 Apr 2018 10:01:08 +0000
treeherdermozilla-central@65e0fefdab51 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1450099
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1450099 - Add a fast-path to FindScrollThumbNode() for when the drag metrics has not been initialized. r=kats MozReview-Commit-ID: IGhP2KW9WC
gfx/layers/apz/src/APZCTreeManager.cpp
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -2548,16 +2548,22 @@ APZCTreeManager::SetLongTapEnabled(bool 
 {
   APZThreadUtils::AssertOnControllerThread();
   GestureEventListener::SetLongTapEnabled(aLongTapEnabled);
 }
 
 RefPtr<HitTestingTreeNode>
 APZCTreeManager::FindScrollThumbNode(const AsyncDragMetrics& aDragMetrics)
 {
+  if (!aDragMetrics.mDirection) {
+    // The AsyncDragMetrics has not been initialized yet - there will be
+    // no matching node, so don't bother searching the tree.
+    return RefPtr<HitTestingTreeNode>();
+  }
+
   RecursiveMutexAutoLock lock(mTreeLock);
 
   return DepthFirstSearch<ReverseIterator>(mRootNode.get(),
       [&aDragMetrics](HitTestingTreeNode* aNode) {
         return aNode->MatchesScrollDragMetrics(aDragMetrics);
       });
 }