Bug 1522714 - Track in APZCTreeManager whether we are using an async zoom container. r=kats
authorBotond Ballo <botond@mozilla.com>
Wed, 06 Feb 2019 22:05:49 +0000
changeset 457477 9ca00a435ef84508c495f05be6cfc4c8cda6aa7f
parent 457476 44fde95f62b1308fef1368a0cbaeb857e7a46ddd
child 457478 d47ab770340f6e567f262f9f48c9c5af05107374
push id35511
push userrgurzau@mozilla.com
push dateThu, 07 Feb 2019 05:01:56 +0000
treeherdermozilla-central@d09706f38e5e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1522714
milestone67.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 1522714 - Track in APZCTreeManager whether we are using an async zoom container. r=kats Differential Revision: https://phabricator.services.mozilla.com/D18112
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/apz/src/APZCTreeManager.h
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -253,16 +253,17 @@ class MOZ_RAII AutoFocusSequenceNumberSe
 };
 
 APZCTreeManager::APZCTreeManager(LayersId aRootLayersId)
     : mInputQueue(new InputQueue()),
       mRootLayersId(aRootLayersId),
       mSampler(nullptr),
       mUpdater(nullptr),
       mTreeLock("APZCTreeLock"),
+      mUsingAsyncZoomContainer(false),
       mMapLock("APZCMapLock"),
       mRetainedTouchIdentifier(-1),
       mInScrollbarTouchDrag(false),
       mApzcTreeLog("apzctree"),
       mTestDataLock("APZTestDataLock"),
       mDPI(160.0) {
   RefPtr<APZCTreeManager> self(this);
   NS_DispatchToMainThread(NS_NewRunnableFunction(
@@ -382,16 +383,17 @@ APZCTreeManager::UpdateHitTestingTreeImp
   // transplanted elsewhere. Doing that as part of a recursive tree walk is hard
   // and so maintaining a list and removing APZCs that are still alive is much
   // simpler.
   ForEachNode<ReverseIterator>(mRootNode.get(),
                                [&state](HitTestingTreeNode* aNode) {
                                  state.mNodesToDestroy.AppendElement(aNode);
                                });
   mRootNode = nullptr;
+  mUsingAsyncZoomContainer = false;
 
   if (aRoot) {
     std::stack<gfx::TreeAutoIndent> indents;
     std::stack<AncestorTransform> ancestorTransforms;
     HitTestingTreeNode* parent = nullptr;
     HitTestingTreeNode* next = nullptr;
     LayersId layersId = aRootLayerTreeId;
     ancestorTransforms.push(AncestorTransform());
@@ -400,16 +402,20 @@ APZCTreeManager::UpdateHitTestingTreeImp
     mApzcTreeLog << "[start]\n";
     mTreeLock.AssertCurrentThreadIn();
 
     ForEachNode<ReverseIterator>(
         aRoot,
         [&](ScrollNode aLayerMetrics) {
           mApzcTreeLog << aLayerMetrics.Name() << '\t';
 
+          if (aLayerMetrics.IsAsyncZoomContainer()) {
+            mUsingAsyncZoomContainer = true;
+          }
+
           HitTestingTreeNode* node = PrepareNodeForLayer(
               lock, aLayerMetrics, aLayerMetrics.Metrics(), layersId,
               ancestorTransforms.top(), parent, next, state);
           MOZ_ASSERT(node);
           AsyncPanZoomController* apzc = node->GetApzc();
           aLayerMetrics.SetApzc(apzc);
 
           // GetScrollbarAnimationId is only set when webrender is enabled,
--- a/gfx/layers/apz/src/APZCTreeManager.h
+++ b/gfx/layers/apz/src/APZCTreeManager.h
@@ -760,16 +760,21 @@ class APZCTreeManager : public IAPZCTree
    * APZC instance in isolation (that is, if its tree pointers are not being
    * accessed or mutated). The lock also needs to be held when accessing the
    * mRootNode instance variable, as that is considered part of the APZC tree
    * management state.
    * IMPORTANT: See the note about lock ordering at the top of this file. */
   mutable mozilla::RecursiveMutex mTreeLock;
   RefPtr<HitTestingTreeNode> mRootNode;
 
+  /* True if the current hit-testing tree contains an async zoom container
+   * node.
+   */
+  bool mUsingAsyncZoomContainer;
+
   /** A lock that protects mApzcMap and mScrollThumbInfo. */
   mutable mozilla::Mutex mMapLock;
   /**
    * A map for quick access to get APZC instances by guid, without having to
    * acquire the tree lock. mMapLock must be acquired while accessing or
    * modifying mApzcMap.
    */
   std::unordered_map<ScrollableLayerGuid, RefPtr<AsyncPanZoomController>,