Chromium Code Reviews| Index: content/browser/renderer_host/input/immediate_input_router.cc |
| diff --git a/content/browser/renderer_host/input/immediate_input_router.cc b/content/browser/renderer_host/input/immediate_input_router.cc |
| index a4c69054fd16cb8838053438b95b287a81ae904c..dcccee0323f417b1666bfe3dcac65db29212e47a 100644 |
| --- a/content/browser/renderer_host/input/immediate_input_router.cc |
| +++ b/content/browser/renderer_host/input/immediate_input_router.cc |
| @@ -306,9 +306,10 @@ bool ImmediateInputRouter::OnMessageReceived(const IPC::Message& message) { |
| } |
| void ImmediateInputRouter::OnTouchEventAck( |
| - const TouchEventWithLatencyInfo& event, |
| - InputEventAckState ack_result) { |
| - ack_handler_->OnTouchEventAck(event, ack_result); |
| + const WebKit::WebTouchEvent& event, |
| + InputEventAckState ack_result, |
| + ui::LatencyInfo* latency) { |
| + ack_handler_->OnTouchEventAck(event, ack_result, latency); |
| } |
| bool ImmediateInputRouter::SendSelectRange(scoped_ptr<IPC::Message> message) { |
| @@ -358,6 +359,7 @@ void ImmediateInputRouter::FilterAndSendWebInputEvent( |
| DCHECK(!process_->IgnoreInputEvents()); |
| + ui::LatencyInfo renderer_latency; |
| // Perform optional, synchronous event handling, sending ACK messages for |
| // processed events, or proceeding as usual. |
| InputEventAckState filter_ack = client_->FilterInputEvent(input_event, |
| @@ -367,7 +369,7 @@ void ImmediateInputRouter::FilterAndSendWebInputEvent( |
| case INPUT_EVENT_ACK_STATE_CONSUMED: |
| case INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS: |
| next_mouse_move_.reset(); |
| - ProcessInputEventAck(input_event.type, filter_ack, latency_info); |
| + ProcessInputEventAck(input_event.type, filter_ack, &renderer_latency); |
| // WARNING: |this| may be deleted at this point. |
| return; |
| @@ -396,7 +398,7 @@ void ImmediateInputRouter::FilterAndSendWebInputEvent( |
| // processed, to make sure that the touch-scroll gesture that initiated |
| // the overscroll is updated properly. |
| touch_event_queue_->ProcessTouchAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, |
| - latency_info); |
| + renderer_latency); |
| } |
| return; |
| } |
| @@ -427,14 +429,14 @@ void ImmediateInputRouter::FilterAndSendWebInputEvent( |
| void ImmediateInputRouter::OnInputEventAck( |
| WebInputEvent::Type event_type, |
| InputEventAckState ack_result, |
| - const ui::LatencyInfo& latency_info) { |
| + ui::LatencyInfo latency_info) { |
|
jdduke (slow)
2013/10/08 16:28:08
So, we're copying the ui::LatencyInfo here, only t
Yufeng Shen (Slow to review)
2013/10/08 19:35:59
Done.
|
| // Log the time delta for processing an input event. |
| TimeDelta delta = TimeTicks::Now() - input_event_start_time_; |
| UMA_HISTOGRAM_TIMES("MPArch.IIR_InputEventDelta", delta); |
| client_->DecrementInFlightEventCount(); |
| - ProcessInputEventAck(event_type, ack_result, latency_info); |
| + ProcessInputEventAck(event_type, ack_result, &latency_info); |
| } |
| void ImmediateInputRouter::OnMsgMoveCaretAck() { |
| @@ -461,7 +463,7 @@ void ImmediateInputRouter::OnHasTouchEventHandlers(bool has_handlers) { |
| void ImmediateInputRouter::ProcessInputEventAck( |
| WebInputEvent::Type event_type, |
| InputEventAckState ack_result, |
| - const ui::LatencyInfo& latency_info) { |
| + ui::LatencyInfo* latency_info) { |
| TRACE_EVENT1("input", "ImmediateInputRouter::ProcessInputEventAck", |
| "ack", GetEventAckName(ack_result)); |
| @@ -481,11 +483,11 @@ void ImmediateInputRouter::ProcessInputEventAck( |
| } else if (WebInputEvent::isKeyboardEventType(type)) { |
| ProcessKeyboardAck(type, ack_result); |
| } else if (type == WebInputEvent::MouseWheel) { |
| - ProcessWheelAck(ack_result); |
| + ProcessWheelAck(ack_result, latency_info); |
| } else if (WebInputEvent::isTouchEventType(type)) { |
| - ProcessTouchAck(ack_result, latency_info); |
| + ProcessTouchAck(ack_result, *latency_info); |
| } else if (WebInputEvent::isGestureEventType(type)) { |
| - ProcessGestureAck(type, ack_result); |
| + ProcessGestureAck(type, ack_result, latency_info); |
| } |
| // WARNING: |this| may be deleted at this point. |
| @@ -524,13 +526,20 @@ void ImmediateInputRouter::ProcessKeyboardAck( |
| } |
| } |
| -void ImmediateInputRouter::ProcessWheelAck(InputEventAckState ack_result) { |
| +void ImmediateInputRouter::ProcessWheelAck(InputEventAckState ack_result, |
| + ui::LatencyInfo* latency) { |
| mouse_wheel_pending_ = false; |
| + // TODO(miletus): Add renderer side latency to each uncoalesced mouse |
| + // wheel event and add terminal component to each of them. |
| + ui::LatencyInfo combined_latency = current_wheel_event_.latency; |
| + combined_latency.AddNewLatencyFrom(*latency); |
| // Process the unhandled wheel event here before calling |
| // ForwardWheelEventWithLatencyInfo() since it will mutate |
| // current_wheel_event_. |
| - ack_handler_->OnWheelEventAck(current_wheel_event_.event, ack_result); |
| + ack_handler_->OnWheelEventAck(current_wheel_event_.event, |
| + ack_result, |
| + &combined_latency); |
| // Now send the next (coalesced) mouse wheel event. |
| if (!coalesced_mouse_wheel_events_.empty()) { |
| @@ -542,10 +551,13 @@ void ImmediateInputRouter::ProcessWheelAck(InputEventAckState ack_result) { |
| } |
| void ImmediateInputRouter::ProcessGestureAck(int type, |
| - InputEventAckState ack_result) { |
| + InputEventAckState ack_result, |
| + ui::LatencyInfo* latency) { |
| const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result); |
| + // TODO(miletus): Add renderer side latency to each uncoalesced gesture |
| + // event event and add terminal component to each of them. |
| ack_handler_->OnGestureEventAck( |
| - gesture_event_filter_->GetGestureEventAwaitingAck(), ack_result); |
| + gesture_event_filter_->GetGestureEventAwaitingAck(), ack_result, latency); |
| gesture_event_filter_->ProcessGestureAck(processed, type); |
| } |