Bug 1526489 - Move AutoApplyAsyncTestAttributes into AsyncPanZoomController.cpp. r=kats
authorBotond Ballo <botond@mozilla.com>
Tue, 26 Mar 2019 00:57:36 +0000
changeset 466409 d94e429f5760379da1d7e9f3e27e32d8e67ae9e4
parent 466408 967a5709c6558790426e3903e9f87a612b8b7fe1
child 466410 49c62552262de7933091bbcf6f92767dca94d232
push id35768
push useropoprus@mozilla.com
push dateThu, 28 Mar 2019 09:55:54 +0000
treeherdermozilla-central@c045dd97faf2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1526489
milestone68.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 1526489 - Move AutoApplyAsyncTestAttributes into AsyncPanZoomController.cpp. r=kats Now that it's an implementation detail of AsyncPanZoomController, it doesn't need to live in APZUtils.h. Depends on D24612 Differential Revision: https://phabricator.services.mozilla.com/D24799
gfx/layers/apz/src/APZUtils.cpp
gfx/layers/apz/src/APZUtils.h
gfx/layers/apz/src/AsyncPanZoomController.cpp
--- a/gfx/layers/apz/src/APZUtils.cpp
+++ b/gfx/layers/apz/src/APZUtils.cpp
@@ -5,32 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/layers/APZUtils.h"
 
 #include "AsyncPanZoomController.h"
 
 namespace mozilla {
 namespace layers {
-
-AutoApplyAsyncTestAttributes::AutoApplyAsyncTestAttributes(
-    const AsyncPanZoomController* aApzc)
-    // Having to use const_cast here seems less ugly than the alternatives
-    // of making several members of AsyncPanZoomController that
-    // ApplyAsyncTestAttributes() modifies |mutable|, or several methods that
-    // query the async transforms non-const.
-    : mApzc(const_cast<AsyncPanZoomController*>(aApzc)),
-      mPrevFrameMetrics(aApzc->Metrics()) {
-  mApzc->ApplyAsyncTestAttributes();
-}
-
-AutoApplyAsyncTestAttributes::~AutoApplyAsyncTestAttributes() {
-  mApzc->UnapplyAsyncTestAttributes(mPrevFrameMetrics);
-}
-
 namespace apz {
 
 /*static*/ void InitializeGlobalState() {
   MOZ_ASSERT(NS_IsMainThread());
   AsyncPanZoomController::InitializeGlobalState();
 }
 
 /*static*/ const ScreenMargin CalculatePendingDisplayPort(
--- a/gfx/layers/apz/src/APZUtils.h
+++ b/gfx/layers/apz/src/APZUtils.h
@@ -119,35 +119,16 @@ struct TargetConfirmationFlags {
                 gfx::CompositorHitTestFlags::eDispatchToContent)),
         mRequiresTargetConfirmation(aHitTestInfo.contains(
             gfx::CompositorHitTestFlags::eRequiresTargetConfirmation)) {}
 
   bool mTargetConfirmed : 1;
   bool mRequiresTargetConfirmation : 1;
 };
 
-/**
- * An RAII class to temporarily apply async test attributes to the provided
- * AsyncPanZoomController.
- *
- * This class should be used in the implementation of any AsyncPanZoomController
- * method that queries the async scroll offset or async zoom (this includes
- * the async layout viewport offset, since modifying the async scroll offset
- * may result in the layout viewport moving as well).
- */
-class MOZ_RAII AutoApplyAsyncTestAttributes {
- public:
-  explicit AutoApplyAsyncTestAttributes(const AsyncPanZoomController*);
-  ~AutoApplyAsyncTestAttributes();
-
- private:
-  AsyncPanZoomController* mApzc;
-  FrameMetrics mPrevFrameMetrics;
-};
-
 enum class AsyncTransformComponent { eLayout, eVisual };
 
 using AsyncTransformComponents = EnumSet<AsyncTransformComponent>;
 
 constexpr AsyncTransformComponents LayoutAndVisual(
     AsyncTransformComponent::eLayout, AsyncTransformComponent::eVisual);
 
 namespace apz {
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -567,16 +567,50 @@ class MOZ_STACK_CLASS StateChangeNotific
     mApzc->DispatchStateChangeNotification(mInitialState, newState);
   }
 
  private:
   AsyncPanZoomController* mApzc;
   AsyncPanZoomController::PanZoomState mInitialState;
 };
 
+/**
+ * An RAII class to temporarily apply async test attributes to the provided
+ * AsyncPanZoomController.
+ *
+ * This class should be used in the implementation of any AsyncPanZoomController
+ * method that queries the async scroll offset or async zoom (this includes
+ * the async layout viewport offset, since modifying the async scroll offset
+ * may result in the layout viewport moving as well).
+ */
+class MOZ_RAII AutoApplyAsyncTestAttributes {
+ public:
+  explicit AutoApplyAsyncTestAttributes(const AsyncPanZoomController*);
+  ~AutoApplyAsyncTestAttributes();
+
+ private:
+  AsyncPanZoomController* mApzc;
+  FrameMetrics mPrevFrameMetrics;
+};
+
+AutoApplyAsyncTestAttributes::AutoApplyAsyncTestAttributes(
+    const AsyncPanZoomController* aApzc)
+    // Having to use const_cast here seems less ugly than the alternatives
+    // of making several members of AsyncPanZoomController that
+    // ApplyAsyncTestAttributes() modifies |mutable|, or several methods that
+    // query the async transforms non-const.
+    : mApzc(const_cast<AsyncPanZoomController*>(aApzc)),
+      mPrevFrameMetrics(aApzc->Metrics()) {
+  mApzc->ApplyAsyncTestAttributes();
+}
+
+AutoApplyAsyncTestAttributes::~AutoApplyAsyncTestAttributes() {
+  mApzc->UnapplyAsyncTestAttributes(mPrevFrameMetrics);
+}
+
 class ZoomAnimation : public AsyncPanZoomAnimation {
  public:
   ZoomAnimation(AsyncPanZoomController& aApzc, const CSSPoint& aStartOffset,
                 const CSSToParentLayerScale2D& aStartZoom,
                 const CSSPoint& aEndOffset,
                 const CSSToParentLayerScale2D& aEndZoom)
       : mApzc(aApzc),
         mTotalDuration(TimeDuration::FromMilliseconds(