Chromium Code Reviews| 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 d433291906ddfc5c024d2362fa9e4c3a101f7c79..2da2a9952135452d5e5926ccfbe55fb5dfa3ceac 100644 |
| --- a/content/browser/renderer_host/render_widget_host_impl.cc |
| +++ b/content/browser/renderer_host/render_widget_host_impl.cc |
| @@ -1139,7 +1139,7 @@ void RenderWidgetHostImpl::ForwardInputEvent(const WebInputEvent& input_event, |
| return; |
| } |
| - in_process_event_types_.push(input_event.type); |
| + in_process_event_types_.push_back(input_event.type); |
| // Transmit any pending wheel events on a non-wheel event. This ensures that |
| // the renderer receives the final PhaseEnded wheel event, which is necessary |
| @@ -1693,9 +1693,43 @@ void RenderWidgetHostImpl::OnInputEventAck( |
| TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnInputEventAck"); |
| bool processed = (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED); |
| - if (!in_process_event_types_.empty() && |
| - in_process_event_types_.front() == event_type) |
| - in_process_event_types_.pop(); |
| + if (!in_process_event_types_.empty()) { |
| + bool found = false; |
|
nduca
2013/01/10 20:34:33
Should we pull this edit out to its own cl? This s
bulach
2013/01/11 10:42:07
good idea! I split it into:
https://codereview.chr
|
| + for (std::deque<WebKit::WebInputEvent::Type>::iterator i = |
| + in_process_event_types_.begin(); |
| + i != in_process_event_types_.end(); ++ i) { |
|
Sami
2013/01/10 19:45:34
Nit: no space between ++ and i.
bulach
2013/01/11 10:42:07
Done.
|
| + if (*i == event_type) { |
| + in_process_event_types_.erase(i); |
| + found = true; |
| + break; |
| + } else { |
| + // Ensure we're not ACK'ing out of |type| order. The reason is that |
| + // we push the event stream in system order |in_process_event_types_|, |
| + // however there are various internal queues for gesture / touch / etc |
| + // that may ACK in their own internal order. When traversing |
| + // |in_process_event_types_|, ensure we don't jump over an event of the |
| + // the same category. |
| + int ack_type = static_cast<int>(event_type); |
| + int queue_type = static_cast<int>(*i); |
| + bool out_of_order = |
| + ack_type == WebInputEvent::MouseMove || |
|
Sami
2013/01/10 19:45:34
Why not use WebInputEvent::isMouseEventType? Becau
bulach
2013/01/11 10:42:07
Done.
|
| + ack_type == WebInputEvent::MouseWheel || |
| + (WebInputEvent::isKeyboardEventType(ack_type) && |
| + WebInputEvent::isKeyboardEventType(queue_type)) || |
| + (WebInputEvent::isTouchEventType(ack_type) && |
| + WebInputEvent::isTouchEventType(queue_type)) || |
| + (WebInputEvent::isGestureEventType(ack_type) && |
| + WebInputEvent::isGestureEventType(queue_type)); |
| + if (out_of_order) { |
| + DVLOG(1) << "OnInputEventAck out of order " << ack_type << " " |
| + << queue_type; |
| + break; |
| + } |
| + } |
| + } |
| + if (!found) |
| + DVLOG(1) << "OnInputEventAck not found " << event_type; |
| + } |
| // Log the time delta for processing an input event. |
| TimeDelta delta = TimeTicks::Now() - input_event_start_time_; |
| @@ -1762,6 +1796,7 @@ void RenderWidgetHostImpl::OnBeginSmoothScroll( |
| // until we get an input ack. |
| if (!in_process_event_types_.empty()) |
| return; |
| + |
| if (tick_active_smooth_scroll_gestures_task_posted_) |
| return; |
| TickActiveSmoothScrollGesture(); |