Bug 907123 - Move fling-related things into a new section in AsyncPanZoomController.h. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 29 Apr 2014 09:45:09 -0400
changeset 181103 6e068aa1987d5622174c7019b5788aec68eb1a7b
parent 181102 2048240a81d27b5cae8a3f30cbe4a1ecf0496ba1
child 181104 2edf6b019ee24351f5ea41f26e0a52d75e323a87
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersbotond
bugs907123
milestone32.0a1
Bug 907123 - Move fling-related things into a new section in AsyncPanZoomController.h. r=botond
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/apz/src/AsyncPanZoomController.cpp
gfx/layers/apz/src/AsyncPanZoomController.h
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -723,17 +723,17 @@ APZCTreeManager::DispatchScroll(AsyncPan
 
 void
 APZCTreeManager::HandOffFling(AsyncPanZoomController* aPrev, ScreenPoint aVelocity)
 {
   // Build the overscroll handoff chain. This is necessary because it is
   // otherwise built on touch-start and cleared on touch-end, and a fling
   // happens after touch-end. Note that, unlike DispatchScroll() which is
   // called on every touch-move during overscroll panning,
-  // HandleFlingOverscroll() is only called once during a fling handoff,
+  // HandOffFling() is only called once during a fling handoff,
   // so it's not worth trying to avoid building the handoff chain here.
   BuildOverscrollHandoffChain(aPrev);
 
   nsRefPtr<AsyncPanZoomController> next;  // will be used outside monitor block
   {
     // Grab tree lock to protect mOverscrollHandoffChain from concurrent
     // access from the input and compositor threads.
     // Release it before calling GetInputTransforms() as that grabs the
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1289,30 +1289,30 @@ bool FlingAnimation::Sample(FrameMetrics
     // not the other. In such a case we only want to hand off the relevant
     // component of the fling.
     if (FuzzyEqualsMultiplicative(overscroll.x, 0.0f)) {
       velocity.x = 0;
     } else if (FuzzyEqualsMultiplicative(overscroll.y, 0.0f)) {
       velocity.y = 0;
     }
 
-    // To hand off the fling, we call APZCTreeManager::HandleFlingOverscroll()
+    // To hand off the fling, we call APZCTreeManager::HandOffFling()
     // which starts a new fling in the next APZC in the handoff chain with
     // the same velocity. For simplicity, the actual overscroll of the current
     // sample is discarded rather than being handed off. The compositor should
     // sample animations sufficiently frequently that this is not noticeable.
 
     // Make a local copy of the tree manager pointer and check if it's not
-    // null before calling HandleFlingOverscroll(). This is necessary because
+    // null before calling HandOffFling(). This is necessary because
     // Destroy(), which nulls out mTreeManager, could be called concurrently.
     APZCTreeManager* treeManagerLocal = mApzc.mTreeManager;
     if (treeManagerLocal) {
-      // APZC is holding mMonitor, so directly calling HandleFlingOverscroll()
+      // APZC is holding mMonitor, so directly calling HandOffFling()
       // (which acquires the tree lock) would violate the lock ordering. Instead
-      // we schedule HandleFlingOverscroll() to be called after mMonitor is
+      // we schedule HandOffFling() to be called after mMonitor is
       // released.
       mDeferredTasks.append(NewRunnableMethod(treeManagerLocal,
                                               &APZCTreeManager::HandOffFling,
                                               &mApzc,
                                               velocity));
     }
   }
 
--- a/gfx/layers/apz/src/AsyncPanZoomController.h
+++ b/gfx/layers/apz/src/AsyncPanZoomController.h
@@ -290,22 +290,16 @@ public:
   /**
    * Cancels any currently running animation. Note that all this does is set the
    * state of the AsyncPanZoomController back to NOTHING, but it is the
    * animation's responsibility to check this before advancing.
    */
   void CancelAnimation();
 
   /**
-   * Take over a fling with the given velocity from another APZC. Used for
-   * during overscroll handoff for a fling.
-   */
-  void TakeOverFling(ScreenPoint aVelocity);
-
-  /**
    * Returns allowed touch behavior for the given point on the scrollable layer.
    * Internally performs a kind of hit testing based on the regions constructed
    * on the main thread and attached to the current scrollable layer. Each of such regions
    * contains info about allowed touch behavior. If regions info isn't enough it returns
    * UNKNOWN value and we should switch to the fallback approach - asking content.
    * TODO: for now it's only a stub and returns hardcoded magic value. As soon as bug 928833
    * is done we should integrate its logic here.
    */
@@ -497,24 +491,16 @@ protected:
   void RequestContentRepaint(FrameMetrics& aFrameMetrics);
 
   /**
    * Actually send the next pending paint request to gecko.
    */
   void DispatchRepaintRequest(const FrameMetrics& aFrameMetrics);
 
   /**
-   * Advances a fling by an interpolated amount based on the passed in |aDelta|.
-   * This should be called whenever sampling the content transform for this
-   * frame. Returns true if the fling animation should be advanced by one frame,
-   * or false if there is no fling or the fling has ended.
-   */
-  bool DoFling(const TimeDuration& aDelta);
-
-  /**
    * Gets the current frame metrics. This is *not* the Gecko copy stored in the
    * layers code.
    */
   const FrameMetrics& GetFrameMetrics();
 
   /**
    * Sets the timer for content response to a series of touch events, if it
    * hasn't been already. This is to prevent us from batching up touch events
@@ -772,16 +758,30 @@ private:
   TouchBlockState mTouchBlockState;
 
   // Extra offset to add in SampleContentTransformForFrame for testing
   CSSPoint mTestAsyncScrollOffset;
 
   RefPtr<AsyncPanZoomAnimation> mAnimation;
 
   friend class Axis;
+
+
+  /* ===================================================================
+   * The functions and members in this section are used to manage
+   * fling animations.
+   */
+public:
+  /**
+   * Take over a fling with the given velocity from another APZC. Used for
+   * during overscroll handoff for a fling.
+   */
+  void TakeOverFling(ScreenPoint aVelocity);
+
+private:
   friend class FlingAnimation;
 
 
   /* ===================================================================
    * The functions and members in this section are used to build a tree
    * structure out of APZC instances. This tree can only be walked or
    * manipulated while holding the lock in the associated APZCTreeManager
    * instance.