Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: content/browser/renderer_host/input/input_router_impl.cc

Issue 281723010: Bundle DidOverscrollParams with the InputEventAck (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/input/input_router_impl.h" 5 #include "content/browser/renderer_host/input/input_router_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 264
265 // A fixed page scale or mobile viewport should disable the touch ack timeout. 265 // A fixed page scale or mobile viewport should disable the touch ack timeout.
266 UpdateTouchAckTimeoutEnabled(); 266 UpdateTouchAckTimeoutEnabled();
267 } 267 }
268 268
269 bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) { 269 bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) {
270 bool handled = true; 270 bool handled = true;
271 bool message_is_ok = true; 271 bool message_is_ok = true;
272 IPC_BEGIN_MESSAGE_MAP_EX(InputRouterImpl, message, message_is_ok) 272 IPC_BEGIN_MESSAGE_MAP_EX(InputRouterImpl, message, message_is_ok)
273 IPC_MESSAGE_HANDLER(InputHostMsg_HandleInputEvent_ACK, OnInputEventAck) 273 IPC_MESSAGE_HANDLER(InputHostMsg_HandleInputEvent_ACK, OnInputEventAck)
274 IPC_MESSAGE_HANDLER(InputHostMsg_DidOverscroll, OnDidOverscroll)
274 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveCaret_ACK, OnMsgMoveCaretAck) 275 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveCaret_ACK, OnMsgMoveCaretAck)
275 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnSelectRangeAck) 276 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnSelectRangeAck)
276 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, 277 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers,
277 OnHasTouchEventHandlers) 278 OnHasTouchEventHandlers)
278 IPC_MESSAGE_HANDLER(InputHostMsg_SetTouchAction, 279 IPC_MESSAGE_HANDLER(InputHostMsg_SetTouchAction,
279 OnSetTouchAction) 280 OnSetTouchAction)
280 IPC_MESSAGE_UNHANDLED(handled = false) 281 IPC_MESSAGE_UNHANDLED(handled = false)
281 IPC_END_MESSAGE_MAP() 282 IPC_END_MESSAGE_MAP()
282 283
283 if (!message_is_ok) 284 if (!message_is_ok)
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 wheelEvent.deltaY = 100.0f * log(pinch_event.event.data.pinchUpdate.scale); 484 wheelEvent.deltaY = 100.0f * log(pinch_event.event.data.pinchUpdate.scale);
484 wheelEvent.hasPreciseScrollingDeltas = true; 485 wheelEvent.hasPreciseScrollingDeltas = true;
485 wheelEvent.wheelTicksX = 0; 486 wheelEvent.wheelTicksX = 0;
486 wheelEvent.wheelTicksY = 487 wheelEvent.wheelTicksY =
487 pinch_event.event.data.pinchUpdate.scale > 1 ? 1 : -1; 488 pinch_event.event.data.pinchUpdate.scale > 1 ? 1 : -1;
488 489
489 SendWheelEvent(QueuedWheelEvent( 490 SendWheelEvent(QueuedWheelEvent(
490 MouseWheelEventWithLatencyInfo(wheelEvent, pinch_event.latency), true)); 491 MouseWheelEventWithLatencyInfo(wheelEvent, pinch_event.latency), true));
491 } 492 }
492 493
493 void InputRouterImpl::OnInputEventAck(WebInputEvent::Type event_type, 494 void InputRouterImpl::OnInputEventAck(const InputEventAck& ack) {
494 InputEventAckState ack_result,
495 const ui::LatencyInfo& latency_info) {
496 client_->DecrementInFlightEventCount(); 495 client_->DecrementInFlightEventCount();
497 496
498 // Log the time delta for processing an input event. 497 // Log the time delta for processing an input event.
499 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; 498 TimeDelta delta = TimeTicks::Now() - input_event_start_time_;
500 UMA_HISTOGRAM_TIMES("MPArch.IIR_InputEventDelta", delta); 499 UMA_HISTOGRAM_TIMES("MPArch.IIR_InputEventDelta", delta);
501 500
502 ProcessInputEventAck(event_type, ack_result, latency_info, RENDERER); 501 if (ack.overscroll)
tdresser 2014/05/14 18:20:08 Although its redundant, I think it would be cleare
jdduke (slow) 2014/05/19 20:48:02 Done.
502 OnDidOverscroll(*ack.overscroll);
503
504 ProcessInputEventAck(ack.type, ack.state, ack.latency, RENDERER);
503 // WARNING: |this| may be deleted at this point. 505 // WARNING: |this| may be deleted at this point.
504 506
505 // This is used only for testing, and the other end does not use the 507 // This is used only for testing, and the other end does not use the
506 // source object. On linux, specifying 508 // source object. On linux, specifying
507 // Source<RenderWidgetHost> results in a very strange 509 // Source<RenderWidgetHost> results in a very strange
508 // runtime error in the epilogue of the enclosing 510 // runtime error in the epilogue of the enclosing
509 // (ProcessInputEventAck) method, but not on other platforms; using 511 // (ProcessInputEventAck) method, but not on other platforms; using
510 // 'void' instead is just as safe (since NotificationSource 512 // 'void' instead is just as safe (since NotificationSource
511 // is not actually typesafe) and avoids this error. 513 // is not actually typesafe) and avoids this error.
512 int type = static_cast<int>(event_type); 514 int type = static_cast<int>(ack.type);
513 NotificationService::current()->Notify( 515 NotificationService::current()->Notify(
514 NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, 516 NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK,
515 Source<void>(this), 517 Source<void>(this),
516 Details<int>(&type)); 518 Details<int>(&type));
517 } 519 }
518 520
521 void InputRouterImpl::OnDidOverscroll(const DidOverscrollParams& params) {
522 client_->DidOverscroll(params);
523 }
524
519 void InputRouterImpl::OnMsgMoveCaretAck() { 525 void InputRouterImpl::OnMsgMoveCaretAck() {
520 move_caret_pending_ = false; 526 move_caret_pending_ = false;
521 if (next_move_caret_) 527 if (next_move_caret_)
522 SendMoveCaret(next_move_caret_.Pass()); 528 SendMoveCaret(next_move_caret_.Pass());
523 } 529 }
524 530
525 void InputRouterImpl::OnSelectRangeAck() { 531 void InputRouterImpl::OnSelectRangeAck() {
526 select_range_pending_ = false; 532 select_range_pending_ = false;
527 if (next_selection_range_) 533 if (next_selection_range_)
528 SendSelectRange(next_selection_range_.Pass()); 534 SendSelectRange(next_selection_range_.Pass());
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 InputRouterImpl::QueuedWheelEvent::QueuedWheelEvent( 746 InputRouterImpl::QueuedWheelEvent::QueuedWheelEvent(
741 const MouseWheelEventWithLatencyInfo& event, 747 const MouseWheelEventWithLatencyInfo& event,
742 bool synthesized_from_pinch) 748 bool synthesized_from_pinch)
743 : event(event), synthesized_from_pinch(synthesized_from_pinch) { 749 : event(event), synthesized_from_pinch(synthesized_from_pinch) {
744 } 750 }
745 751
746 InputRouterImpl::QueuedWheelEvent::~QueuedWheelEvent() { 752 InputRouterImpl::QueuedWheelEvent::~QueuedWheelEvent() {
747 } 753 }
748 754
749 } // namespace content 755 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698