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 777793 16bec207dc418bac3bef71ae5c15ade76032d6e0
parent 777792 4b4230db0bdce11b915a896b84ab99631c77aa82
child 777794 2dc5471ebd4a119941db86cbec9ed7d413b9a851
push id105296
push userpaolo.mozmail@amadzone.org
push dateThu, 05 Apr 2018 10:49:16 +0000
reviewerskats
bugs1450099
milestone61.0a1
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);
       });
 }