Bug 1289432 - Update a couple more functions to stop fishing around inside mInputBlockQueue. r?botond
MozReview-Commit-ID: Bxionzr8bFo
--- a/gfx/layers/apz/src/InputQueue.cpp
+++ b/gfx/layers/apz/src/InputQueue.cpp
@@ -603,23 +603,20 @@ InputQueue::MainThreadTimeout(const uint
}
void
InputQueue::ContentReceivedInputBlock(uint64_t aInputBlockId, bool aPreventDefault) {
APZThreadUtils::AssertOnControllerThread();
INPQ_LOG("got a content response; block=%" PRIu64 "\n", aInputBlockId);
bool success = false;
- for (size_t i = 0; i < mInputBlockQueue.Length(); i++) {
- CancelableBlockState* block = mInputBlockQueue[i].get();
- if (block->GetBlockId() == aInputBlockId) {
- success = block->SetContentResponse(aPreventDefault);
- block->RecordContentResponseTime();
- break;
- }
+ CancelableBlockState* block = FindBlockForId(aInputBlockId, nullptr);
+ if (block) {
+ success = block->SetContentResponse(aPreventDefault);
+ block->RecordContentResponseTime();
}
if (success) {
ProcessInputBlocks();
}
}
void
InputQueue::SetConfirmedTargetApzc(uint64_t aInputBlockId, const RefPtr<AsyncPanZoomController>& aTargetApzc) {
@@ -665,27 +662,22 @@ InputQueue::ConfirmDragBlock(uint64_t aI
}
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;
- for (size_t i = 0; i < mInputBlockQueue.Length(); i++) {
- if (mInputBlockQueue[i]->GetBlockId() == aInputBlockId) {
- TouchBlockState *block = mInputBlockQueue[i]->AsTouchBlock();
- if (block) {
- success = block->SetAllowedTouchBehaviors(aBehaviors);
- block->RecordContentResponseTime();
- } else {
- NS_WARNING("input block is not a touch block");
- }
- break;
- }
+ 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();
}
}
void
InputQueue::ProcessInputBlocks() {