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

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

Issue 25022003: Report LatencyInfo through trace buffer (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 2 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/immediate_input_router.h" 5 #include "content/browser/renderer_host/input/immediate_input_router.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "content/browser/renderer_host/input/gesture_event_filter.h" 9 #include "content/browser/renderer_host/input/gesture_event_filter.h"
10 #include "content/browser/renderer_host/input/input_ack_handler.h" 10 #include "content/browser/renderer_host/input/input_ack_handler.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 // now, we can send the next mouse move event 474 // now, we can send the next mouse move event
475 if (next_mouse_move_) { 475 if (next_mouse_move_) {
476 DCHECK(next_mouse_move_->event.type == WebInputEvent::MouseMove); 476 DCHECK(next_mouse_move_->event.type == WebInputEvent::MouseMove);
477 scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move 477 scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move
478 = next_mouse_move_.Pass(); 478 = next_mouse_move_.Pass();
479 SendMouseEvent(*next_mouse_move); 479 SendMouseEvent(*next_mouse_move);
480 } 480 }
481 } else if (WebInputEvent::isKeyboardEventType(type)) { 481 } else if (WebInputEvent::isKeyboardEventType(type)) {
482 ProcessKeyboardAck(type, ack_result); 482 ProcessKeyboardAck(type, ack_result);
483 } else if (type == WebInputEvent::MouseWheel) { 483 } else if (type == WebInputEvent::MouseWheel) {
484 ProcessWheelAck(ack_result); 484 ProcessWheelAck(ack_result, latency_info);
485 } else if (WebInputEvent::isTouchEventType(type)) { 485 } else if (WebInputEvent::isTouchEventType(type)) {
486 ProcessTouchAck(ack_result, latency_info); 486 ProcessTouchAck(ack_result, latency_info);
487 } else if (WebInputEvent::isGestureEventType(type)) { 487 } else if (WebInputEvent::isGestureEventType(type)) {
488 ProcessGestureAck(type, ack_result); 488 ProcessGestureAck(type, ack_result, latency_info);
489 } 489 }
490 490
491 // WARNING: |this| may be deleted at this point. 491 // WARNING: |this| may be deleted at this point.
492 492
493 // This is used only for testing, and the other end does not use the 493 // This is used only for testing, and the other end does not use the
494 // source object. On linux, specifying 494 // source object. On linux, specifying
495 // Source<RenderWidgetHost> results in a very strange 495 // Source<RenderWidgetHost> results in a very strange
496 // runtime error in the epilogue of the enclosing 496 // runtime error in the epilogue of the enclosing
497 // (ProcessInputEventAck) method, but not on other platforms; using 497 // (ProcessInputEventAck) method, but not on other platforms; using
498 // 'void' instead is just as safe (since NotificationSource 498 // 'void' instead is just as safe (since NotificationSource
(...skipping 18 matching lines...) Expand all
517 NativeWebKeyboardEvent front_item = key_queue_.front(); 517 NativeWebKeyboardEvent front_item = key_queue_.front();
518 key_queue_.pop_front(); 518 key_queue_.pop_front();
519 519
520 ack_handler_->OnKeyboardEventAck(front_item, ack_result); 520 ack_handler_->OnKeyboardEventAck(front_item, ack_result);
521 // WARNING: This ImmediateInputRouter can be deallocated at this point 521 // WARNING: This ImmediateInputRouter can be deallocated at this point
522 // (i.e. in the case of Ctrl+W, where the call to 522 // (i.e. in the case of Ctrl+W, where the call to
523 // HandleKeyboardEvent destroys this ImmediateInputRouter). 523 // HandleKeyboardEvent destroys this ImmediateInputRouter).
524 } 524 }
525 } 525 }
526 526
527 void ImmediateInputRouter::ProcessWheelAck(InputEventAckState ack_result) { 527 void ImmediateInputRouter::ProcessWheelAck(InputEventAckState ack_result,
528 const ui::LatencyInfo& latency) {
528 mouse_wheel_pending_ = false; 529 mouse_wheel_pending_ = false;
529 530
530 // Process the unhandled wheel event here before calling 531 // Process the unhandled wheel event here before calling
531 // ForwardWheelEventWithLatencyInfo() since it will mutate 532 // ForwardWheelEventWithLatencyInfo() since it will mutate
532 // current_wheel_event_. 533 // current_wheel_event_.
533 ack_handler_->OnWheelEventAck(current_wheel_event_.event, ack_result); 534 MouseWheelEventWithLatencyInfo event(current_wheel_event_.event, latency);
535 ack_handler_->OnWheelEventAck(event, ack_result);
534 536
535 // Now send the next (coalesced) mouse wheel event. 537 // Now send the next (coalesced) mouse wheel event.
536 if (!coalesced_mouse_wheel_events_.empty()) { 538 if (!coalesced_mouse_wheel_events_.empty()) {
537 MouseWheelEventWithLatencyInfo next_wheel_event = 539 MouseWheelEventWithLatencyInfo next_wheel_event =
538 coalesced_mouse_wheel_events_.front(); 540 coalesced_mouse_wheel_events_.front();
539 coalesced_mouse_wheel_events_.pop_front(); 541 coalesced_mouse_wheel_events_.pop_front();
540 SendWheelEvent(next_wheel_event); 542 SendWheelEvent(next_wheel_event);
541 } 543 }
542 } 544 }
543 545
544 void ImmediateInputRouter::ProcessGestureAck(int type, 546 void ImmediateInputRouter::ProcessGestureAck(int type,
545 InputEventAckState ack_result) { 547 InputEventAckState ack_result,
548 const ui::LatencyInfo& latency) {
546 const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result); 549 const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result);
547 ack_handler_->OnGestureEventAck( 550 GestureEventWithLatencyInfo event(
548 gesture_event_filter_->GetGestureEventAwaitingAck(), ack_result); 551 gesture_event_filter_->GetGestureEventAwaitingAck(), latency);
552 ack_handler_->OnGestureEventAck(event, ack_result);
549 gesture_event_filter_->ProcessGestureAck(processed, type); 553 gesture_event_filter_->ProcessGestureAck(processed, type);
550 } 554 }
551 555
552 void ImmediateInputRouter::ProcessTouchAck( 556 void ImmediateInputRouter::ProcessTouchAck(
553 InputEventAckState ack_result, 557 InputEventAckState ack_result,
554 const ui::LatencyInfo& latency_info) { 558 const ui::LatencyInfo& latency_info) {
555 // |touch_event_queue_| will forward to OnTouchEventAck when appropriate. 559 // |touch_event_queue_| will forward to OnTouchEventAck when appropriate.
556 touch_event_queue_->ProcessTouchAck(ack_result, latency_info); 560 touch_event_queue_->ProcessTouchAck(ack_result, latency_info);
557 } 561 }
558 562
559 void ImmediateInputRouter::HandleGestureScroll( 563 void ImmediateInputRouter::HandleGestureScroll(
560 const GestureEventWithLatencyInfo& gesture_event) { 564 const GestureEventWithLatencyInfo& gesture_event) {
561 if (!enable_no_touch_to_renderer_while_scrolling_) 565 if (!enable_no_touch_to_renderer_while_scrolling_)
562 return; 566 return;
563 567
564 // Once scrolling is started stop forwarding touch move events to renderer. 568 // Once scrolling is started stop forwarding touch move events to renderer.
565 if (gesture_event.event.type == WebInputEvent::GestureScrollBegin) 569 if (gesture_event.event.type == WebInputEvent::GestureScrollBegin)
566 touch_event_queue_->set_no_touch_move_to_renderer(true); 570 touch_event_queue_->set_no_touch_move_to_renderer(true);
567 571
568 if (gesture_event.event.type == WebInputEvent::GestureScrollEnd || 572 if (gesture_event.event.type == WebInputEvent::GestureScrollEnd ||
569 gesture_event.event.type == WebInputEvent::GestureFlingStart) { 573 gesture_event.event.type == WebInputEvent::GestureFlingStart) {
570 touch_event_queue_->set_no_touch_move_to_renderer(false); 574 touch_event_queue_->set_no_touch_move_to_renderer(false);
571 } 575 }
572 } 576 }
573 577
574 } // namespace content 578 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698