Index: content/browser/renderer_host/render_widget_host_impl.cc |
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc |
index 33652c937ee5c1599bab26bc3c4dec61772b7265..3556a19fa95099c191f42f1fedb61658f3191751 100644 |
--- a/content/browser/renderer_host/render_widget_host_impl.cc |
+++ b/content/browser/renderer_host/render_widget_host_impl.cc |
@@ -824,10 +824,10 @@ void RenderWidgetHostImpl::ForwardGestureEvent( |
return; |
if (gesture_event_pending_) { |
- if (coalesced_gesture_events_.empty() || |
- !ShouldCoalesceGestureEvents(coalesced_gesture_events_.back(), |
+ if (coalesced_gesture_events_.empty() || |
+ !ShouldCoalesceGestureEvents(coalesced_gesture_events_.back(), |
gesture_event)) { |
- coalesced_gesture_events_.push_back(gesture_event); |
+ coalesced_gesture_events_.push_back(gesture_event); |
} else { |
WebGestureEvent* last_gesture_event = |
&coalesced_gesture_events_.back(); |
@@ -839,11 +839,16 @@ void RenderWidgetHostImpl::ForwardGestureEvent( |
} |
return; |
} |
- gesture_event_pending_ = true; |
- if (gesture_event.type == WebInputEvent::GestureFlingCancel) |
+ if (gesture_event.type == WebInputEvent::GestureFlingCancel) { |
+ // We don't throttle FlingCancel, because it usually goes right through to |
+ // the WebKit thread and blocking on WebKit is bad. |
tap_suppression_controller_->GestureFlingCancel( |
gesture_event.timeStampSeconds); |
+ } else { |
+ gesture_event_pending_ = true; |
+ } |
+ |
ForwardInputEvent(gesture_event, sizeof(WebGestureEvent), false); |
} |
@@ -1489,17 +1494,18 @@ void RenderWidgetHostImpl::ProcessWheelAck(bool processed) { |
} |
void RenderWidgetHostImpl::ProcessGestureAck(bool processed, int type) { |
- if (type == WebInputEvent::GestureFlingCancel) |
+ if (type == WebInputEvent::GestureFlingCancel) { |
tap_suppression_controller_->GestureFlingCancelAck(processed); |
- |
- gesture_event_pending_ = false; |
- |
- // Now send the next (coalesced) gesture event. |
- if (!coalesced_gesture_events_.empty()) { |
- WebGestureEvent next_gesture_event = |
- coalesced_gesture_events_.front(); |
- coalesced_gesture_events_.pop_front(); |
- ForwardGestureEvent(next_gesture_event); |
+ } else { |
+ gesture_event_pending_ = false; |
+ |
+ // Now flush out the queued events until we hit one that needs another ack. |
+ while (!gesture_event_pending_ && !coalesced_gesture_events_.empty()) { |
+ WebGestureEvent next_gesture_event = |
+ coalesced_gesture_events_.front(); |
+ coalesced_gesture_events_.pop_front(); |
+ ForwardGestureEvent(next_gesture_event); |
+ } |
} |
} |