Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2080)

Unified Diff: ui/events/gestures/gesture_recognizer_impl.cc

Issue 2789203006: Routes touch ACK events to the correct GestureProvider (Closed)
Patch Set: Added Bug specific unit test Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/events/gestures/gesture_recognizer_impl.cc
diff --git a/ui/events/gestures/gesture_recognizer_impl.cc b/ui/events/gestures/gesture_recognizer_impl.cc
index 206ef82c178bf176cb6c3c40ecc5edf0ed95f2e8..7ea6660879a7b9668335d45a9109d1277aa7c8ad 100644
--- a/ui/events/gestures/gesture_recognizer_impl.cc
+++ b/ui/events/gestures/gesture_recognizer_impl.cc
@@ -273,6 +273,7 @@ bool GestureRecognizerImpl::ProcessTouchEventPreDispatch(
GestureProviderAura* gesture_provider =
GetGestureProviderForConsumer(consumer);
+ event_to_gesture_provider_[event->unique_event_id()] = gesture_provider;
tdresser 2017/04/06 20:59:52 Can we put this in SetupTargets?
malaykeshav 2017/04/07 01:07:59 Done
return gesture_provider->OnTouchEvent(event);
}
@@ -280,8 +281,16 @@ GestureRecognizer::Gestures GestureRecognizerImpl::AckTouchEvent(
uint32_t unique_event_id,
ui::EventResult result,
GestureConsumer* consumer) {
- GestureProviderAura* gesture_provider =
- GetGestureProviderForConsumer(consumer);
+ GestureProviderAura* gesture_provider = nullptr;
+
+ // Check if we have already processed this event before dispatch and have a
+ // consumer associated with it.
+ if (event_to_gesture_provider_.count(unique_event_id)) {
+ gesture_provider = event_to_gesture_provider_[unique_event_id];
+ event_to_gesture_provider_.erase(unique_event_id);
tdresser 2017/04/06 20:59:52 This is performing three lookups into this map. H
malaykeshav 2017/04/07 01:07:59 Done
+ } else {
+ gesture_provider = GetGestureProviderForConsumer(consumer);
+ }
gesture_provider->OnTouchEventAck(unique_event_id, result != ER_UNHANDLED);
return gesture_provider->GetAndResetPendingGestures();
}
« ui/events/gestures/gesture_recognizer_impl.h ('K') | « ui/events/gestures/gesture_recognizer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698