Bug 1374682 - Clean up processing of non-cancelable input blocks in InputQueue. r?botond draft
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 21 Jun 2017 14:22:18 -0400
changeset 598434 8b5847ad726716f7bacb8e3460e81eaad07e2181
parent 598405 6779547fa0fca357851739ebee9bfd461675c7aa
child 634476 1820323e949ca11a074d002582af6551aa918eb3
push id65202
push userkgupta@mozilla.com
push dateWed, 21 Jun 2017 18:22:42 +0000
reviewersbotond
bugs1374682
milestone56.0a1
Bug 1374682 - Clean up processing of non-cancelable input blocks in InputQueue. r?botond The main changes here are: - Make QueuedInput store a InputBlockState instead of a CancelableBlockState, and propagate these changes outwards as necessary. - Hoist some virtual functions from CancelableBlockState up into InputBlockState. These are mostly downcast-type functions but also a couple of others (DispatchEvent and MustStayActive) that are generally applicable to input blocks and not specific to block cancellation. - Modify the signatures of a few other functions in InputQueue (such as CanDiscardBlock) to take a InputBlockState even though all the current call sites pass in a CancelableBlockState. This will make it easier to plumb in a new non-cancelable block because the function can still be used without modification. MozReview-Commit-ID: IzhCxVjkKoj
gfx/layers/apz/src/AsyncPanZoomController.cpp
gfx/layers/apz/src/AsyncPanZoomController.h
gfx/layers/apz/src/InputBlockState.cpp
gfx/layers/apz/src/InputBlockState.h
gfx/layers/apz/src/InputQueue.cpp
gfx/layers/apz/src/InputQueue.h
gfx/layers/apz/src/QueuedInput.cpp
gfx/layers/apz/src/QueuedInput.h
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -2419,17 +2419,17 @@ bool AsyncPanZoomController::AttemptScro
     bool xChanged = mX.AdjustDisplacement(displacement.x, adjustedDisplacement.x, overscroll.x);
 
     if (xChanged || yChanged) {
       ScheduleComposite();
     }
 
     if (!IsZero(adjustedDisplacement)) {
       ScrollBy(adjustedDisplacement / mFrameMetrics.GetZoom());
-      if (CancelableBlockState* block = GetCurrentInputBlock()) {
+      if (InputBlockState* block = GetCurrentInputBlock()) {
 #if defined(MOZ_WIDGET_ANDROID)
         if (block->AsTouchBlock() && (block->GetScrolledApzc() != this) && IsRootContent()) {
           if (APZCTreeManager* manager = GetApzcTreeManager()) {
             AndroidDynamicToolbarAnimator* animator = manager->GetAndroidDynamicToolbarAnimator();
             MOZ_ASSERT(animator);
             animator->SetScrollingRootContent();
           }
         }
@@ -3751,17 +3751,17 @@ void AsyncPanZoomController::ZoomToRect(
           (&AsyncPanZoomController::RequestContentRepaint);
       controller->DispatchToRepaintThread(
           NewRunnableMethod<FrameMetrics, ParentLayerPoint>(
               this, func, endZoomToMetrics, velocity));
     }
   }
 }
 
-CancelableBlockState*
+InputBlockState*
 AsyncPanZoomController::GetCurrentInputBlock() const
 {
   return GetInputQueue()->GetCurrentBlock();
 }
 
 TouchBlockState*
 AsyncPanZoomController::GetCurrentTouchBlock() const
 {
--- a/gfx/layers/apz/src/AsyncPanZoomController.h
+++ b/gfx/layers/apz/src/AsyncPanZoomController.h
@@ -900,17 +900,17 @@ public:
    * Gets a ref to the input queue that is shared across the entire tree manager.
    */
   const RefPtr<InputQueue>& GetInputQueue() const;
 
 private:
   void CancelAnimationAndGestureState();
 
   RefPtr<InputQueue> mInputQueue;
-  CancelableBlockState* GetCurrentInputBlock() const;
+  InputBlockState* GetCurrentInputBlock() const;
   TouchBlockState* GetCurrentTouchBlock() const;
   bool HasReadyTouchBlock() const;
 
   PanGestureBlockState* GetCurrentPanGestureBlock() const;
 
 private:
   /* ===================================================================
    * The functions and members in this section are used to manage
--- a/gfx/layers/apz/src/InputBlockState.cpp
+++ b/gfx/layers/apz/src/InputBlockState.cpp
@@ -148,16 +148,22 @@ InputBlockState::GetScrolledApzc() const
 bool
 InputBlockState::IsDownchainOfScrolledApzc(AsyncPanZoomController* aApzc) const
 {
   MOZ_ASSERT(aApzc && mScrolledApzc);
 
   return IsDownchainOf(mScrolledApzc, aApzc);
 }
 
+void
+InputBlockState::DispatchEvent(const InputData& aEvent) const
+{
+  GetTargetApzc()->HandleInputEvent(aEvent, mTransformToApzc);
+}
+
 CancelableBlockState::CancelableBlockState(const RefPtr<AsyncPanZoomController>& aTargetApzc,
                                            bool aTargetConfirmed)
   : InputBlockState(aTargetApzc, aTargetConfirmed)
   , mPreventDefault(false)
   , mContentResponded(false)
   , mContentResponseTimerExpired(false)
 {
 }
@@ -221,22 +227,16 @@ CancelableBlockState::IsReadyForHandling
 {
   if (!IsTargetConfirmed()) {
     return false;
   }
   return mContentResponded || mContentResponseTimerExpired;
 }
 
 void
-CancelableBlockState::DispatchEvent(const InputData& aEvent) const
-{
-  GetTargetApzc()->HandleInputEvent(aEvent, mTransformToApzc);
-}
-
-void
 CancelableBlockState::RecordContentResponseTime()
 {
   if (!mContentResponseTimer) {
     // We might get responses from content even though we didn't wait for them.
     // In that case, ignore the time on them, because they're not relevant for
     // tuning our timeout value. Also this function might get called multiple
     // times on the same input block, so we should only record the time from the
     // first successful call.
--- a/gfx/layers/apz/src/InputBlockState.h
+++ b/gfx/layers/apz/src/InputBlockState.h
@@ -48,30 +48,58 @@ public:
     eConfirmed
   };
 
   explicit InputBlockState(const RefPtr<AsyncPanZoomController>& aTargetApzc,
                            bool aTargetConfirmed);
   virtual ~InputBlockState()
   {}
 
+  virtual CancelableBlockState* AsCancelableBlock() {
+    return nullptr;
+  }
+  virtual TouchBlockState* AsTouchBlock() {
+    return nullptr;
+  }
+  virtual WheelBlockState* AsWheelBlock() {
+    return nullptr;
+  }
+  virtual DragBlockState* AsDragBlock() {
+    return nullptr;
+  }
+  virtual PanGestureBlockState* AsPanGestureBlock() {
+    return nullptr;
+  }
+
   virtual bool SetConfirmedTargetApzc(const RefPtr<AsyncPanZoomController>& aTargetApzc,
                                       TargetConfirmationState aState,
                                       InputData* aFirstInput);
   const RefPtr<AsyncPanZoomController>& GetTargetApzc() const;
   const RefPtr<const OverscrollHandoffChain>& GetOverscrollHandoffChain() const;
   uint64_t GetBlockId() const;
 
   bool IsTargetConfirmed() const;
   bool HasReceivedRealConfirmedTarget() const;
 
   void SetScrolledApzc(AsyncPanZoomController* aApzc);
   AsyncPanZoomController* GetScrolledApzc() const;
   bool IsDownchainOfScrolledApzc(AsyncPanZoomController* aApzc) const;
 
+  /**
+   * Dispatch the event to the target APZC. Mostly this is a hook for
+   * subclasses to do any per-event processing they need to.
+   */
+  virtual void DispatchEvent(const InputData& aEvent) const;
+
+  /**
+   * Return true if this input block must stay active if it would otherwise
+   * be removed as the last item in the pending queue.
+   */
+  virtual bool MustStayActive() = 0;
+
 protected:
   virtual void UpdateTargetApzc(const RefPtr<AsyncPanZoomController>& aTargetApzc);
 
 private:
   // Checks whether |aA| is an ancestor of |aB| (or the same as |aB|) in
   // |mOverscrollHandoffChain|.
   bool IsDownchainOf(AsyncPanZoomController* aA, AsyncPanZoomController* aB) const;
 
@@ -108,27 +136,18 @@ protected:
  * occurred.
  */
 class CancelableBlockState : public InputBlockState
 {
 public:
   CancelableBlockState(const RefPtr<AsyncPanZoomController>& aTargetApzc,
                        bool aTargetConfirmed);
 
-  virtual TouchBlockState *AsTouchBlock() {
-    return nullptr;
-  }
-  virtual WheelBlockState *AsWheelBlock() {
-    return nullptr;
-  }
-  virtual DragBlockState *AsDragBlock() {
-    return nullptr;
-  }
-  virtual PanGestureBlockState *AsPanGestureBlock() {
-    return nullptr;
+  CancelableBlockState* AsCancelableBlock() override {
+    return this;
   }
 
   /**
    * Record whether or not content cancelled this block of events.
    * @param aPreventDefault true iff the block is cancelled.
    * @return false if this block has already received a response from
    *         web content, true if not.
    */
@@ -160,40 +179,28 @@ public:
   bool IsContentResponseTimerExpired() const;
 
   /**
    * @return true iff web content cancelled this block of events.
    */
   bool IsDefaultPrevented() const;
 
   /**
-   * Dispatch the event to the target APZC. Mostly this is a hook for
-   * subclasses to do any per-event processing they need to.
-   */
-  virtual void DispatchEvent(const InputData& aEvent) const;
-
-  /**
    * @return true iff this block has received all the information it could
    *         have gotten from the content thread.
    */
   virtual bool HasReceivedAllContentNotifications() const;
 
   /**
    * @return true iff this block has received all the information needed
    *         to properly dispatch the events in the block.
    */
   virtual bool IsReadyForHandling() const;
 
   /**
-   * Return true if this input block must stay active if it would otherwise
-   * be removed as the last item in the pending queue.
-   */
-  virtual bool MustStayActive() = 0;
-
-  /**
    * Return a descriptive name for the block kind.
    */
   virtual const char* Type() = 0;
 
 private:
   TimeStamp mContentResponseTimer;
   bool mPreventDefault;
   bool mContentResponded;
--- a/gfx/layers/apz/src/InputQueue.cpp
+++ b/gfx/layers/apz/src/InputQueue.cpp
@@ -344,17 +344,17 @@ InputQueue::ReceivePanGestureInput(const
   // ProcessQueue() does.
   mQueuedInputs.AppendElement(MakeUnique<QueuedInput>(event, *block));
   ProcessQueue();
 
   return result;
 }
 
 void
-InputQueue::CancelAnimationsForNewBlock(CancelableBlockState* aBlock,
+InputQueue::CancelAnimationsForNewBlock(InputBlockState* aBlock,
                                         CancelAnimationFlags aExtraFlags)
 {
   // We want to cancel animations here as soon as possible (i.e. without waiting for
   // content responses) because a finger has gone down and we don't want to keep moving
   // the content under the finger. However, to prevent "future" touchstart events from
   // interfering with "past" animations (i.e. from a previous touch block that is still
   // being processed) we only do this animation-cancellation if there are no older
   // touch blocks still in the queue.
@@ -421,48 +421,48 @@ InputQueue::StartNewTouchBlock(const Ref
     MOZ_ASSERT(GetCurrentTouchBlock());
     newBlock->CopyPropertiesFrom(*GetCurrentTouchBlock());
   }
 
   mActiveTouchBlock = newBlock;
   return newBlock;
 }
 
-CancelableBlockState*
+InputBlockState*
 InputQueue::GetCurrentBlock() const
 {
   APZThreadUtils::AssertOnControllerThread();
   return mQueuedInputs.IsEmpty() ? nullptr : mQueuedInputs[0]->Block();
 }
 
 TouchBlockState*
 InputQueue::GetCurrentTouchBlock() const
 {
-  CancelableBlockState* block = GetCurrentBlock();
+  InputBlockState* block = GetCurrentBlock();
   return block ? block->AsTouchBlock() : mActiveTouchBlock.get();
 }
 
 WheelBlockState*
 InputQueue::GetCurrentWheelBlock() const
 {
-  CancelableBlockState* block = GetCurrentBlock();
+  InputBlockState* block = GetCurrentBlock();
   return block ? block->AsWheelBlock() : mActiveWheelBlock.get();
 }
 
 DragBlockState*
 InputQueue::GetCurrentDragBlock() const
 {
-  CancelableBlockState* block = GetCurrentBlock();
+  InputBlockState* block = GetCurrentBlock();
   return block ? block->AsDragBlock() : mActiveDragBlock.get();
 }
 
 PanGestureBlockState*
 InputQueue::GetCurrentPanGestureBlock() const
 {
-  CancelableBlockState* block = GetCurrentBlock();
+  InputBlockState* block = GetCurrentBlock();
   return block ? block->AsPanGestureBlock() : mActivePanGestureBlock.get();
 }
 
 WheelBlockState*
 InputQueue::GetActiveWheelTransaction() const
 {
   WheelBlockState* block = mActiveWheelBlock.get();
   if (!block || !block->InTransaction()) {
@@ -471,17 +471,17 @@ InputQueue::GetActiveWheelTransaction() 
   return block;
 }
 
 bool
 InputQueue::HasReadyTouchBlock() const
 {
   return !mQueuedInputs.IsEmpty() &&
       mQueuedInputs[0]->Block()->AsTouchBlock() &&
-      mQueuedInputs[0]->Block()->IsReadyForHandling();
+      mQueuedInputs[0]->Block()->AsTouchBlock()->IsReadyForHandling();
 }
 
 bool
 InputQueue::AllowScrollHandoff() const
 {
   if (GetCurrentWheelBlock()) {
     return GetCurrentWheelBlock()->AllowScrollHandoff();
   }
@@ -510,17 +510,17 @@ InputQueue::ScheduleMainThreadTimeout(co
   INPQ_LOG("scheduling main thread timeout for target %p\n", aTarget.get());
   aBlock->StartContentResponseTimer();
   aTarget->PostDelayedTask(NewRunnableMethod<uint64_t>(this,
                                                        &InputQueue::MainThreadTimeout,
                                                        aBlock->GetBlockId()),
                            gfxPrefs::APZContentResponseTimeout());
 }
 
-CancelableBlockState*
+InputBlockState*
 InputQueue::FindBlockForId(uint64_t aInputBlockId,
                            InputData** aOutFirstInput)
 {
   for (const auto& queuedInput : mQueuedInputs) {
     if (queuedInput->Block()->GetBlockId() == aInputBlockId) {
       if (aOutFirstInput) {
         *aOutFirstInput = queuedInput->Input();
       }
@@ -548,127 +548,139 @@ InputQueue::FindBlockForId(uint64_t aInp
 
 void
 InputQueue::MainThreadTimeout(uint64_t aInputBlockId) {
   APZThreadUtils::AssertOnControllerThread();
 
   INPQ_LOG("got a main thread timeout; block=%" PRIu64 "\n", aInputBlockId);
   bool success = false;
   InputData* firstInput = nullptr;
-  CancelableBlockState* block = FindBlockForId(aInputBlockId, &firstInput);
-  if (block) {
+  InputBlockState* inputBlock = FindBlockForId(aInputBlockId, &firstInput);
+  if (inputBlock && inputBlock->AsCancelableBlock()) {
+    CancelableBlockState* block = inputBlock->AsCancelableBlock();
     // time out the touch-listener response and also confirm the existing
     // target apzc in the case where the main thread doesn't get back to us
     // fast enough.
     success = block->TimeoutContentResponse();
     success |= block->SetConfirmedTargetApzc(
         block->GetTargetApzc(),
         InputBlockState::TargetConfirmationState::eTimedOut,
         firstInput);
+  } else if (inputBlock) {
+    NS_WARNING("input block is not a cancelable block");
   }
   if (success) {
     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) {
+  InputBlockState* inputBlock = FindBlockForId(aInputBlockId, nullptr);
+  if (inputBlock && inputBlock->AsCancelableBlock()) {
+    CancelableBlockState* block = inputBlock->AsCancelableBlock();
     success = block->SetContentResponse(aPreventDefault);
     block->RecordContentResponseTime();
+  } else if (inputBlock) {
+    NS_WARNING("input block is not a cancelable block");
   }
   if (success) {
     ProcessQueue();
   }
 }
 
 void
 InputQueue::SetConfirmedTargetApzc(uint64_t aInputBlockId, const RefPtr<AsyncPanZoomController>& aTargetApzc) {
   APZThreadUtils::AssertOnControllerThread();
 
   INPQ_LOG("got a target apzc; block=%" PRIu64 " guid=%s\n",
     aInputBlockId, aTargetApzc ? Stringify(aTargetApzc->GetGuid()).c_str() : "");
   bool success = false;
   InputData* firstInput = nullptr;
-  CancelableBlockState* block = FindBlockForId(aInputBlockId, &firstInput);
-  if (block) {
+  InputBlockState* inputBlock = FindBlockForId(aInputBlockId, &firstInput);
+  if (inputBlock && inputBlock->AsCancelableBlock()) {
+    CancelableBlockState* block = inputBlock->AsCancelableBlock();
     success = block->SetConfirmedTargetApzc(aTargetApzc,
         InputBlockState::TargetConfirmationState::eConfirmed,
         firstInput);
     block->RecordContentResponseTime();
+  } else if (inputBlock) {
+    NS_WARNING("input block is not a cancelable block");
   }
   if (success) {
     ProcessQueue();
   }
 }
 
 void
 InputQueue::ConfirmDragBlock(uint64_t aInputBlockId, const RefPtr<AsyncPanZoomController>& aTargetApzc,
                                    const AsyncDragMetrics& aDragMetrics)
 {
   APZThreadUtils::AssertOnControllerThread();
 
   INPQ_LOG("got a target apzc; block=%" PRIu64 " guid=%s\n",
     aInputBlockId, aTargetApzc ? Stringify(aTargetApzc->GetGuid()).c_str() : "");
   bool success = false;
   InputData* firstInput = nullptr;
-  CancelableBlockState* block = FindBlockForId(aInputBlockId, &firstInput);
-  if (block && block->AsDragBlock()) {
-    block->AsDragBlock()->SetDragMetrics(aDragMetrics);
+  InputBlockState* inputBlock = FindBlockForId(aInputBlockId, &firstInput);
+  if (inputBlock && inputBlock->AsDragBlock()) {
+    DragBlockState* block = inputBlock->AsDragBlock();
+    block->SetDragMetrics(aDragMetrics);
     success = block->SetConfirmedTargetApzc(aTargetApzc,
         InputBlockState::TargetConfirmationState::eConfirmed,
         firstInput);
     block->RecordContentResponseTime();
   }
   if (success) {
     ProcessQueue();
   }
 }
 
 void
 InputQueue::SetAllowedTouchBehavior(uint64_t aInputBlockId, const nsTArray<TouchBehaviorFlags>& aBehaviors) {
   APZThreadUtils::AssertOnControllerThread();
 
   INPQ_LOG("got allowed touch behaviours; block=%" PRIu64 "\n", aInputBlockId);
   bool success = false;
-  CancelableBlockState* block = FindBlockForId(aInputBlockId, nullptr);
-  if (block && block->AsTouchBlock()) {
-    success = block->AsTouchBlock()->SetAllowedTouchBehaviors(aBehaviors);
+  InputBlockState* inputBlock = FindBlockForId(aInputBlockId, nullptr);
+  if (inputBlock && inputBlock->AsTouchBlock()) {
+    TouchBlockState* block = inputBlock->AsTouchBlock();
+    success = block->SetAllowedTouchBehaviors(aBehaviors);
     block->RecordContentResponseTime();
-  } else if (block) {
+  } else if (inputBlock) {
     NS_WARNING("input block is not a touch block");
   }
   if (success) {
     ProcessQueue();
   }
 }
 
 void
 InputQueue::ProcessQueue() {
   APZThreadUtils::AssertOnControllerThread();
 
   while (!mQueuedInputs.IsEmpty()) {
-    CancelableBlockState* curBlock = mQueuedInputs[0]->Block();
-    if (!curBlock->IsReadyForHandling()) {
+    InputBlockState* curBlock = mQueuedInputs[0]->Block();
+    CancelableBlockState* cancelable = curBlock->AsCancelableBlock();
+    if (cancelable && !cancelable->IsReadyForHandling()) {
       break;
     }
 
     INPQ_LOG("processing input from block %p; preventDefault %d target %p\n",
-        curBlock, curBlock->IsDefaultPrevented(),
+        curBlock, cancelable && cancelable->IsDefaultPrevented(),
         curBlock->GetTargetApzc().get());
     RefPtr<AsyncPanZoomController> target = curBlock->GetTargetApzc();
     // target may be null here if the initial target was unconfirmed and then
     // we later got a confirmed null target. in that case drop the events.
     if (target) {
-      if (curBlock->IsDefaultPrevented()) {
+      if (cancelable && cancelable->IsDefaultPrevented()) {
         if (curBlock->AsTouchBlock()) {
           target->ResetTouchInputState();
         }
       } else {
         UpdateActiveApzc(target);
         curBlock->DispatchEvent(*(mQueuedInputs[0]->Input()));
       }
     }
@@ -685,20 +697,20 @@ InputQueue::ProcessQueue() {
     mActiveDragBlock = nullptr;
   }
   if (CanDiscardBlock(mActivePanGestureBlock)) {
     mActivePanGestureBlock = nullptr;
   }
 }
 
 bool
-InputQueue::CanDiscardBlock(CancelableBlockState* aBlock)
+InputQueue::CanDiscardBlock(InputBlockState* aBlock)
 {
   if (!aBlock ||
-      !aBlock->IsReadyForHandling() ||
+      (aBlock->AsCancelableBlock() && !aBlock->AsCancelableBlock()->IsReadyForHandling()) ||
       aBlock->MustStayActive()) {
     return false;
   }
   InputData* firstInput = nullptr;
   FindBlockForId(aBlock->GetBlockId(), &firstInput);
   if (firstInput) {
     // The block has at least one input event still in the queue, so it's
     // not depleted
--- a/gfx/layers/apz/src/InputQueue.h
+++ b/gfx/layers/apz/src/InputQueue.h
@@ -19,16 +19,17 @@ namespace mozilla {
 
 class InputData;
 class MultiTouchInput;
 class ScrollWheelInput;
 
 namespace layers {
 
 class AsyncPanZoomController;
+class InputBlockState;
 class CancelableBlockState;
 class TouchBlockState;
 class WheelBlockState;
 class DragBlockState;
 class PanGestureBlockState;
 class AsyncDragMetrics;
 class QueuedInput;
 
@@ -88,17 +89,17 @@ public:
    * triggers the creation of a new touch block. Returns the input block id
    * of the the newly-created block.
    */
   uint64_t InjectNewTouchBlock(AsyncPanZoomController* aTarget);
   /**
    * Returns the pending input block at the head of the queue, if there is one.
    * This may return null if there all input events have been processed.
    */
-  CancelableBlockState* GetCurrentBlock() const;
+  InputBlockState* GetCurrentBlock() const;
   /*
    * Returns the current pending input block as a specific kind of block. If
    * GetCurrentBlock() returns null, these functions additionally check the
    * mActiveXXXBlock field of the corresponding input type to see if there is
    * 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;
@@ -138,17 +139,17 @@ private:
   TouchBlockState* StartNewTouchBlock(const RefPtr<AsyncPanZoomController>& aTarget,
                                       bool aTargetConfirmed,
                                       bool aCopyPropertiesFromCurrent);
 
   /**
    * If animations are present for the current pending input block, cancel
    * them as soon as possible.
    */
-  void CancelAnimationsForNewBlock(CancelableBlockState* aBlock,
+  void CancelAnimationsForNewBlock(InputBlockState* aBlock,
                                    CancelAnimationFlags aExtraFlags = Default);
 
   /**
    * If we need to wait for a content response, schedule that now.
    */
   void MaybeRequestContentResponse(const RefPtr<AsyncPanZoomController>& aTarget,
                                    CancelableBlockState* aBlock);
 
@@ -173,23 +174,23 @@ private:
    * Helper function that searches mQueuedInputs for the first block matching
    * the given id, and returns it. If |aOutFirstInput| is non-null, it is
    * populated with a pointer to the first input in mQueuedInputs that
    * corresponds to the block, or null if no such input was found. Note that
    * even if there are no inputs in mQueuedInputs, this function can return
    * non-null if the block id provided matches one of the depleted-but-still-
    * active blocks (mActiveTouchBlock, mActiveWheelBlock, etc.).
    */
-  CancelableBlockState* FindBlockForId(uint64_t aInputBlockId,
-                                       InputData** aOutFirstInput);
+  InputBlockState* FindBlockForId(uint64_t aInputBlockId,
+                                  InputData** aOutFirstInput);
   void ScheduleMainThreadTimeout(const RefPtr<AsyncPanZoomController>& aTarget,
                                  CancelableBlockState* aBlock);
   void MainThreadTimeout(uint64_t aInputBlockId);
   void ProcessQueue();
-  bool CanDiscardBlock(CancelableBlockState* aBlock);
+  bool CanDiscardBlock(InputBlockState* 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;
 
   // These are the most recently created blocks of each input type. They are
--- a/gfx/layers/apz/src/QueuedInput.cpp
+++ b/gfx/layers/apz/src/QueuedInput.cpp
@@ -39,16 +39,16 @@ QueuedInput::QueuedInput(const PanGestur
 }
 
 InputData*
 QueuedInput::Input()
 {
   return mInput.get();
 }
 
-CancelableBlockState*
+InputBlockState*
 QueuedInput::Block()
 {
   return mBlock.get();
 }
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/apz/src/QueuedInput.h
+++ b/gfx/layers/apz/src/QueuedInput.h
@@ -15,17 +15,17 @@ namespace mozilla {
 class InputData;
 class MultiTouchInput;
 class ScrollWheelInput;
 class MouseInput;
 class PanGestureInput;
 
 namespace layers {
 
-class CancelableBlockState;
+class InputBlockState;
 class TouchBlockState;
 class WheelBlockState;
 class DragBlockState;
 class PanGestureBlockState;
 
 /**
  * This lightweight class holds a pointer to an input event that has not yet
  * been completely processed, along with the input block that the input event
@@ -35,24 +35,24 @@ class QueuedInput
 {
 public:
   QueuedInput(const MultiTouchInput& aInput, TouchBlockState& aBlock);
   QueuedInput(const ScrollWheelInput& aInput, WheelBlockState& aBlock);
   QueuedInput(const MouseInput& aInput, DragBlockState& aBlock);
   QueuedInput(const PanGestureInput& aInput, PanGestureBlockState& aBlock);
 
   InputData* Input();
-  CancelableBlockState* Block();
+  InputBlockState* Block();
 
 private:
   // A copy of the input event that is provided to the constructor. This must
   // be non-null, and is owned by this QueuedInput instance (hence the
   // UniquePtr).
   UniquePtr<InputData> mInput;
   // A pointer to the block that the input event is associated with. This must
   // be non-null.
-  RefPtr<CancelableBlockState> mBlock;
+  RefPtr<InputBlockState> mBlock;
 };
 
 } // namespace layers
 } // namespace mozilla
 
 #endif // mozilla_layers_QueuedInput_h