Chromium Code Reviews| Index: content/browser/renderer_host/input/gesture_event_filter.cc |
| diff --git a/content/browser/renderer_host/input/gesture_event_filter.cc b/content/browser/renderer_host/input/gesture_event_filter.cc |
| index 9a80a06b4ffade3b286d785690c46c528f0d118f..d0ca86a6f0348a3930cec03599ffb1b6f02865a0 100644 |
| --- a/content/browser/renderer_host/input/gesture_event_filter.cc |
| +++ b/content/browser/renderer_host/input/gesture_event_filter.cc |
| @@ -239,10 +239,17 @@ bool GestureEventFilter::ShouldForwardForCoalescing( |
| break; |
| } |
| coalesced_gesture_events_.push_back(gesture_event); |
| + |
| + // Ensure that if the added event is asynchonous, it is fired and |
| + // removed from |coalesced_gesture_events_|. |
| + SendAsynchEvents(); |
| return ShouldHandleEventNow(); |
| } |
| void GestureEventFilter::ProcessGestureAck(bool processed, int type) { |
| + if (IsGestureEventTypeAsync(type)) |
| + return; |
|
jdduke (slow)
2013/09/30 15:42:56
As I mention below, we might be able to use a retu
|
| + |
| if (coalesced_gesture_events_.empty()) { |
| DLOG(ERROR) << "Received unexpected ACK for event type " << type; |
| return; |
| @@ -256,6 +263,9 @@ void GestureEventFilter::ProcessGestureAck(bool processed, int type) { |
| touchpad_tap_suppression_controller_->GestureFlingCancelAck(processed); |
| } |
| coalesced_gesture_events_.pop_front(); |
| + // If the event which was just ACKed was blocking asynchronous |
| + // events, fire those asynchronous events now. |
| + SendAsynchEvents(); |
| if (ignore_next_ack_) { |
| ignore_next_ack_ = false; |
| } else if (!coalesced_gesture_events_.empty()) { |
| @@ -436,4 +446,23 @@ gfx::Transform GestureEventFilter::GetTransformForEvent( |
| } |
| return gesture_transform; |
| } |
| + |
| +void GestureEventFilter::SendAsynchEvents() { |
| + GestureEventWithLatencyInfo gesture_event; |
| + while (!coalesced_gesture_events_.empty()) { |
| + if (GestureEventFilter::IsGestureEventTypeAsync( |
|
jochen (gone - plz use gerrit)
2013/09/30 15:19:03
nit. can you invert the condition so you can retur
tdresser
2013/09/30 15:34:48
Good call, thanks. Done.
jdduke (slow)
2013/09/30 15:42:56
+1
|
| + coalesced_gesture_events_.front().event.type)) { |
| + gesture_event = coalesced_gesture_events_.front(); |
| + coalesced_gesture_events_.pop_front(); |
| + input_router_->SendGestureEventImmediately(gesture_event); |
| + } else { |
| + return; |
| + } |
| + } |
| +} |
| + |
| +bool GestureEventFilter::IsGestureEventTypeAsync(int type) { |
| + return type == WebInputEvent::GestureTapDown; |
| +} |
| + |
| } // namespace content |