Bug 1289432 - Miscellaneous function renaming and documentation touchups. r?botond draft
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 12 Sep 2016 22:42:33 -0400
changeset 412864 9d074607e285fe42a00b40fada0bca522b3fe4f2
parent 412863 4af799e8d8ce68a45c02997f448b506a6682cb4e
child 531083 7f4be95e9b9e13133d8407feeda2080fe41f97b1
push id29274
push userkgupta@mozilla.com
push dateTue, 13 Sep 2016 02:44:31 +0000
reviewersbotond
bugs1289432
milestone51.0a1
Bug 1289432 - Miscellaneous function renaming and documentation touchups. r?botond MozReview-Commit-ID: HZYMhRTVLhZ
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/apz/src/AsyncPanZoomController.cpp
gfx/layers/apz/src/InputBlockState.h
gfx/layers/apz/src/InputQueue.cpp
gfx/layers/apz/src/InputQueue.h
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -1054,17 +1054,17 @@ APZCTreeManager::ProcessTouchInput(Multi
 
   return result;
 }
 
 void
 APZCTreeManager::UpdateWheelTransaction(LayoutDeviceIntPoint aRefPoint,
                                         EventMessage aEventMessage)
 {
-  WheelBlockState* txn = mInputQueue->GetCurrentWheelTransaction();
+  WheelBlockState* txn = mInputQueue->GetActiveWheelTransaction();
   if (!txn) {
     return;
   }
 
   // If the transaction has simply timed out, we don't need to do anything
   // else.
   if (txn->MaybeTimeout(TimeStamp::Now())) {
     return;
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1670,17 +1670,17 @@ ScrollInputMethodForWheelDeltaType(Scrol
 
 nsEventStatus AsyncPanZoomController::OnScrollWheel(const ScrollWheelInput& aEvent)
 {
   ParentLayerPoint delta = GetScrollWheelDelta(aEvent);
   APZC_LOG("%p got a scroll-wheel with delta %s\n", this, Stringify(delta).c_str());
 
   if ((delta.x || delta.y) && !CanScrollWithWheel(delta)) {
     // We can't scroll this apz anymore, so we simply drop the event.
-    if (mInputQueue->GetCurrentWheelTransaction() &&
+    if (mInputQueue->GetActiveWheelTransaction() &&
         gfxPrefs::MouseScrollTestingEnabled()) {
       if (RefPtr<GeckoContentController> controller = GetGeckoContentController()) {
         controller->NotifyMozMouseScrollEvent(
           mFrameMetrics.GetScrollId(),
           NS_LITERAL_STRING("MozMouseScrollFailed"));
       }
     }
     return nsEventStatus_eConsumeNoDefault;
--- a/gfx/layers/apz/src/InputBlockState.h
+++ b/gfx/layers/apz/src/InputBlockState.h
@@ -25,17 +25,16 @@ class OverscrollHandoffChain;
 class CancelableBlockState;
 class TouchBlockState;
 class WheelBlockState;
 class DragBlockState;
 class PanGestureBlockState;
 
 /**
  * A base class that stores state common to various input blocks.
- * Currently, it just stores the overscroll handoff chain.
  * Note that the InputBlockState constructor acquires the tree lock, so callers
  * from inside AsyncPanZoomController should ensure that the APZC lock is not
  * held.
  */
 class InputBlockState : public RefCounted<InputBlockState>
 {
 public:
   MOZ_DECLARE_REFCOUNTED_TYPENAME(InputBlockState)
--- a/gfx/layers/apz/src/InputQueue.cpp
+++ b/gfx/layers/apz/src/InputQueue.cpp
@@ -149,17 +149,17 @@ InputQueue::ReceiveTouchInput(const RefP
     } else {
       result = nsEventStatus_eConsumeDoDefault;
     }
   } else if (block->UpdateSlopState(aEvent.AsMultiTouchInput(), false)) {
     INPQ_LOG("dropping event due to block %p being in mini-slop\n", block);
     result = nsEventStatus_eConsumeNoDefault;
   }
   mQueuedInputs.AppendElement(MakeUnique<QueuedInput>(aEvent.AsMultiTouchInput(), *block));
-  ProcessInputBlocks();
+  ProcessQueue();
   return result;
 }
 
 nsEventStatus
 InputQueue::ReceiveMouseInput(const RefPtr<AsyncPanZoomController>& aTarget,
                               bool aTargetConfirmed,
                               const MouseInput& aEvent,
                               uint64_t* aOutInputBlockId) {
@@ -201,17 +201,17 @@ InputQueue::ReceiveMouseInput(const RefP
     MaybeRequestContentResponse(aTarget, block);
   }
 
   if (aOutInputBlockId) {
     *aOutInputBlockId = block->GetBlockId();
   }
 
   mQueuedInputs.AppendElement(MakeUnique<QueuedInput>(aEvent.AsMouseInput(), *block));
-  ProcessInputBlocks();
+  ProcessQueue();
 
   if (DragTracker::EndsDrag(aEvent)) {
     block->MarkMouseUpReceived();
   }
 
   // The event is part of a drag block and could potentially cause
   // scrolling, so return DoDefault.
   return nsEventStatus_eConsumeDoDefault;
@@ -254,19 +254,19 @@ InputQueue::ReceiveScrollWheelInput(cons
   // Copy the event, since WheelBlockState needs to affix a counter.
   ScrollWheelInput event(aEvent);
   block->Update(event);
 
   // Note that the |aTarget| the APZCTM sent us may contradict the confirmed
   // target set on the block. In this case the confirmed target (which may be
   // null) should take priority. This is equivalent to just always using the
   // target (confirmed or not) from the block, which is what
-  // ProcessInputBlocks() does.
+  // ProcessQueue() does.
   mQueuedInputs.AppendElement(MakeUnique<QueuedInput>(event, *block));
-  ProcessInputBlocks();
+  ProcessQueue();
 
   return nsEventStatus_eConsumeDoDefault;
 }
 
 static bool
 CanScrollTargetHorizontally(const PanGestureInput& aInitialEvent,
                             PanGestureBlockState* aBlock)
 {
@@ -334,19 +334,19 @@ InputQueue::ReceivePanGestureInput(const
   if (aOutInputBlockId) {
     *aOutInputBlockId = block->GetBlockId();
   }
 
   // Note that the |aTarget| the APZCTM sent us may contradict the confirmed
   // target set on the block. In this case the confirmed target (which may be
   // null) should take priority. This is equivalent to just always using the
   // target (confirmed or not) from the block, which is what
-  // ProcessInputBlocks() does.
+  // ProcessQueue() does.
   mQueuedInputs.AppendElement(MakeUnique<QueuedInput>(event.AsPanGestureInput(), *block));
-  ProcessInputBlocks();
+  ProcessQueue();
 
   return result;
 }
 
 void
 InputQueue::CancelAnimationsForNewBlock(CancelableBlockState* aBlock)
 {
   // We want to cancel animations here as soon as possible (i.e. without waiting for
@@ -453,17 +453,17 @@ InputQueue::GetCurrentDragBlock() const
 PanGestureBlockState*
 InputQueue::GetCurrentPanGestureBlock() const
 {
   CancelableBlockState* block = GetCurrentBlock();
   return block ? block->AsPanGestureBlock() : mActivePanGestureBlock.get();
 }
 
 WheelBlockState*
-InputQueue::GetCurrentWheelTransaction() const
+InputQueue::GetActiveWheelTransaction() const
 {
   WheelBlockState* block = mActiveWheelBlock.get();
   if (!block || !block->InTransaction()) {
     return nullptr;
   }
   return block;
 }
 
@@ -556,33 +556,33 @@ InputQueue::MainThreadTimeout(const uint
     // fast enough.
     success = block->TimeoutContentResponse();
     success |= block->SetConfirmedTargetApzc(
         block->GetTargetApzc(),
         InputBlockState::TargetConfirmationState::eTimedOut,
         firstInput);
   }
   if (success) {
-    ProcessInputBlocks();
+    ProcessQueue();
   }
 }
 
 void
 InputQueue::ContentReceivedInputBlock(uint64_t aInputBlockId, bool aPreventDefault) {
   APZThreadUtils::AssertOnControllerThread();
 
   INPQ_LOG("got a content response; block=%" PRIu64 "\n", aInputBlockId);
   bool success = false;
   CancelableBlockState* block = FindBlockForId(aInputBlockId, nullptr);
   if (block) {
     success = block->SetContentResponse(aPreventDefault);
     block->RecordContentResponseTime();
   }
   if (success) {
-    ProcessInputBlocks();
+    ProcessQueue();
   }
 }
 
 void
 InputQueue::SetConfirmedTargetApzc(uint64_t aInputBlockId, const RefPtr<AsyncPanZoomController>& aTargetApzc) {
   APZThreadUtils::AssertOnControllerThread();
 
   INPQ_LOG("got a target apzc; block=%" PRIu64 " guid=%s\n",
@@ -592,17 +592,17 @@ InputQueue::SetConfirmedTargetApzc(uint6
   CancelableBlockState* block = FindBlockForId(aInputBlockId, &firstInput);
   if (block) {
     success = block->SetConfirmedTargetApzc(aTargetApzc,
         InputBlockState::TargetConfirmationState::eConfirmed,
         firstInput);
     block->RecordContentResponseTime();
   }
   if (success) {
-    ProcessInputBlocks();
+    ProcessQueue();
   }
 }
 
 void
 InputQueue::ConfirmDragBlock(uint64_t aInputBlockId, const RefPtr<AsyncPanZoomController>& aTargetApzc,
                                    const AsyncDragMetrics& aDragMetrics)
 {
   APZThreadUtils::AssertOnControllerThread();
@@ -615,17 +615,17 @@ InputQueue::ConfirmDragBlock(uint64_t aI
   if (block && block->AsDragBlock()) {
     block->AsDragBlock()->SetDragMetrics(aDragMetrics);
     success = block->SetConfirmedTargetApzc(aTargetApzc,
         InputBlockState::TargetConfirmationState::eConfirmed,
         firstInput);
     block->RecordContentResponseTime();
   }
   if (success) {
-    ProcessInputBlocks();
+    ProcessQueue();
   }
 }
 
 void
 InputQueue::SetAllowedTouchBehavior(uint64_t aInputBlockId, const nsTArray<TouchBehaviorFlags>& aBehaviors) {
   APZThreadUtils::AssertOnControllerThread();
 
   INPQ_LOG("got allowed touch behaviours; block=%" PRIu64 "\n", aInputBlockId);
@@ -633,22 +633,22 @@ InputQueue::SetAllowedTouchBehavior(uint
   CancelableBlockState* block = FindBlockForId(aInputBlockId, nullptr);
   if (block && block->AsTouchBlock()) {
     success = block->AsTouchBlock()->SetAllowedTouchBehaviors(aBehaviors);
     block->RecordContentResponseTime();
   } else if (block) {
     NS_WARNING("input block is not a touch block");
   }
   if (success) {
-    ProcessInputBlocks();
+    ProcessQueue();
   }
 }
 
 void
-InputQueue::ProcessInputBlocks() {
+InputQueue::ProcessQueue() {
   APZThreadUtils::AssertOnControllerThread();
 
   while (!mQueuedInputs.IsEmpty()) {
     CancelableBlockState* curBlock = mQueuedInputs[0]->Block();
     if (!curBlock->IsReadyForHandling()) {
       break;
     }
 
--- a/gfx/layers/apz/src/InputQueue.h
+++ b/gfx/layers/apz/src/InputQueue.h
@@ -28,19 +28,18 @@ class CancelableBlockState;
 class TouchBlockState;
 class WheelBlockState;
 class DragBlockState;
 class PanGestureBlockState;
 class AsyncDragMetrics;
 class QueuedInput;
 
 /**
- * This class stores incoming input events, separated into "input blocks", until
- * they are ready for handling. Currently input blocks are only created from
- * touch input.
+ * This class stores incoming input events, associated with "input blocks", until
+ * they are ready for handling.
  */
 class InputQueue {
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(InputQueue)
 
 public:
   InputQueue();
 
   /**
@@ -102,25 +101,27 @@ public:
    * a depleted but still active input block, and returns that if found. These
    * functions may return null if no block is found.
    */
   TouchBlockState* GetCurrentTouchBlock() const;
   WheelBlockState* GetCurrentWheelBlock() const;
   DragBlockState* GetCurrentDragBlock() const;
   PanGestureBlockState* GetCurrentPanGestureBlock() const;
   /**
-   * Returns true iff the pending block at the head of the queue is ready for
-   * handling.
+   * Returns true iff the pending block at the head of the queue is a touch
+   * block and is ready for handling.
    */
   bool HasReadyTouchBlock() const;
   /**
-   * If there is a wheel transaction, returns the WheelBlockState representing
-   * the transaction. Otherwise, returns null.
+   * If there is an active wheel transaction, returns the WheelBlockState
+   * representing the transaction. Otherwise, returns null. "Active" in this
+   * function name is the same kind of "active" as in mActiveWheelBlock - that
+   * is, new incoming wheel events will go into the "active" block.
    */
-  WheelBlockState* GetCurrentWheelTransaction() const;
+  WheelBlockState* GetActiveWheelTransaction() const;
   /**
    * Remove all input blocks from the input queue.
    */
   void Clear();
   /**
    * Whether the current pending block allows scroll handoff.
    */
   bool AllowScrollHandoff() const;
@@ -176,17 +177,17 @@ private:
    * non-null if the block id provided matches one of the depleted-but-still-
    * active blocks (mActiveTouchBlock, mActiveWheelBlock, etc.).
    */
   CancelableBlockState* FindBlockForId(const uint64_t& aInputBlockId,
                                        InputData** aOutFirstInput);
   void ScheduleMainThreadTimeout(const RefPtr<AsyncPanZoomController>& aTarget,
                                  CancelableBlockState* aBlock);
   void MainThreadTimeout(const uint64_t& aInputBlockId);
-  void ProcessInputBlocks();
+  void ProcessQueue();
   bool CanDiscardBlock(CancelableBlockState* aBlock);
   void UpdateActiveApzc(const RefPtr<AsyncPanZoomController>& aNewActive);
 
 private:
   // The queue of input events that have not yet been fully processed.
   // This member must only be accessed on the controller/UI thread.
   nsTArray<UniquePtr<QueuedInput>> mQueuedInputs;