зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1289432 - Drop the DispatchImmediate codepath. r=botond
Instead of having this special shortcut case that goes through MaybeHandleCurrentBlock and DispatchImmediate, we can just add the input to the queue normally and call ProcessInputBlocks() which effectively does the same thing. Doing it this way also guarantees that mQueuedInputs is non-empty and mQueuedInputs[0] is the input currently being processed. This is useful for future patches because it will allow us to maintain the guarantee that the input block for the input currently being processed can be readily accessed via GetCurrentInputBlock(). MozReview-Commit-ID: JuVbpsFLURo
This commit is contained in:
Родитель
f8d4e33b0b
Коммит
e9b2ac2229
|
@ -224,14 +224,6 @@ CancelableBlockState::IsReadyForHandling() const
|
|||
return mContentResponded || mContentResponseTimerExpired;
|
||||
}
|
||||
|
||||
void
|
||||
CancelableBlockState::DispatchImmediate(const InputData& aEvent) const
|
||||
{
|
||||
MOZ_ASSERT(!HasEvents());
|
||||
MOZ_ASSERT(GetTargetApzc());
|
||||
DispatchEvent(aEvent);
|
||||
}
|
||||
|
||||
void
|
||||
CancelableBlockState::DispatchEvent(const InputData& aEvent) const
|
||||
{
|
||||
|
|
|
@ -164,13 +164,6 @@ public:
|
|||
*/
|
||||
bool IsDefaultPrevented() const;
|
||||
|
||||
/**
|
||||
* Process the given event using this input block's target apzc.
|
||||
* This input block must not have pending events, and its apzc must not be
|
||||
* nullptr.
|
||||
*/
|
||||
void DispatchImmediate(const InputData& aEvent) const;
|
||||
|
||||
/**
|
||||
* Dispatch the event to the target APZC. Mostly this is a hook for
|
||||
* subclasses to do any per-event processing they need to.
|
||||
|
|
|
@ -66,23 +66,6 @@ InputQueue::ReceiveInputEvent(const RefPtr<AsyncPanZoomController>& aTarget,
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
InputQueue::MaybeHandleCurrentBlock(CancelableBlockState *block,
|
||||
const InputData& aEvent) {
|
||||
if (mQueuedInputs.IsEmpty() && block->IsReadyForHandling()) {
|
||||
const RefPtr<AsyncPanZoomController>& target = block->GetTargetApzc();
|
||||
INPQ_LOG("current block is ready with target %p preventdefault %d\n",
|
||||
target.get(), block->IsDefaultPrevented());
|
||||
if (!target || block->IsDefaultPrevented()) {
|
||||
return true;
|
||||
}
|
||||
UpdateActiveApzc(block->GetTargetApzc());
|
||||
block->DispatchImmediate(aEvent);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
InputQueue::ReceiveTouchInput(const RefPtr<AsyncPanZoomController>& aTarget,
|
||||
bool aTargetConfirmed,
|
||||
|
@ -170,10 +153,9 @@ InputQueue::ReceiveTouchInput(const RefPtr<AsyncPanZoomController>& aTarget,
|
|||
INPQ_LOG("dropping event due to block %p being in mini-slop\n", block);
|
||||
result = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
if (!MaybeHandleCurrentBlock(block, aEvent)) {
|
||||
block->AddEvent(aEvent.AsMultiTouchInput());
|
||||
mQueuedInputs.AppendElement(MakeUnique<QueuedInput>(aEvent.AsMultiTouchInput(), *block));
|
||||
}
|
||||
block->AddEvent(aEvent.AsMultiTouchInput());
|
||||
mQueuedInputs.AppendElement(MakeUnique<QueuedInput>(aEvent.AsMultiTouchInput(), *block));
|
||||
ProcessInputBlocks();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -226,10 +208,9 @@ InputQueue::ReceiveMouseInput(const RefPtr<AsyncPanZoomController>& aTarget,
|
|||
*aOutInputBlockId = block->GetBlockId();
|
||||
}
|
||||
|
||||
if (!MaybeHandleCurrentBlock(block, aEvent)) {
|
||||
block->AddEvent(aEvent.AsMouseInput());
|
||||
mQueuedInputs.AppendElement(MakeUnique<QueuedInput>(aEvent.AsMouseInput(), *block));
|
||||
}
|
||||
block->AddEvent(aEvent.AsMouseInput());
|
||||
mQueuedInputs.AppendElement(MakeUnique<QueuedInput>(aEvent.AsMouseInput(), *block));
|
||||
ProcessInputBlocks();
|
||||
|
||||
if (DragTracker::EndsDrag(aEvent)) {
|
||||
block->MarkMouseUpReceived();
|
||||
|
@ -284,11 +265,10 @@ InputQueue::ReceiveScrollWheelInput(const RefPtr<AsyncPanZoomController>& aTarge
|
|||
// 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
|
||||
// MaybeHandleCurrentBlock() does.
|
||||
if (!MaybeHandleCurrentBlock(block, event)) {
|
||||
block->AddEvent(event);
|
||||
mQueuedInputs.AppendElement(MakeUnique<QueuedInput>(event, *block));
|
||||
}
|
||||
// ProcessInputBlocks() does.
|
||||
block->AddEvent(event);
|
||||
mQueuedInputs.AppendElement(MakeUnique<QueuedInput>(event, *block));
|
||||
ProcessInputBlocks();
|
||||
|
||||
return nsEventStatus_eConsumeDoDefault;
|
||||
}
|
||||
|
@ -368,11 +348,10 @@ InputQueue::ReceivePanGestureInput(const RefPtr<AsyncPanZoomController>& aTarget
|
|||
// 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
|
||||
// MaybeHandleCurrentBlock() does.
|
||||
if (!MaybeHandleCurrentBlock(block, event)) {
|
||||
block->AddEvent(event.AsPanGestureInput());
|
||||
mQueuedInputs.AppendElement(MakeUnique<QueuedInput>(event.AsPanGestureInput(), *block));
|
||||
}
|
||||
// ProcessInputBlocks() does.
|
||||
block->AddEvent(event.AsPanGestureInput());
|
||||
mQueuedInputs.AppendElement(MakeUnique<QueuedInput>(event.AsPanGestureInput(), *block));
|
||||
ProcessInputBlocks();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -172,13 +172,6 @@ private:
|
|||
*/
|
||||
void SweepDepletedBlocks();
|
||||
|
||||
/**
|
||||
* Processes the current block if it's ready for handling, using the block's
|
||||
* target APZC.
|
||||
*/
|
||||
bool MaybeHandleCurrentBlock(CancelableBlockState* block,
|
||||
const InputData& aEvent);
|
||||
|
||||
void ScheduleMainThreadTimeout(const RefPtr<AsyncPanZoomController>& aTarget,
|
||||
CancelableBlockState* aBlock);
|
||||
void MainThreadTimeout(const uint64_t& aInputBlockId);
|
||||
|
|
Загрузка…
Ссылка в новой задаче