Chromium Code Reviews| 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(); |
| } |