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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 2317253005: SourceEventType added to LatencyInfo (Closed)
Patch Set: Changed the patch to only contain source event type plumbing. Created 4 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
tdresser 2016/09/12 14:23:08 Should we add a test for logic in this file?
sahel 2016/09/12 17:02:26 There is no unittest files available for render_wi
tdresser 2016/09/12 18:03:44 Bah, of course.
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/android/build_info.h" 11 #include "base/android/build_info.h"
12 #include "base/android/context_utils.h" 12 #include "base/android/context_utils.h"
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/callback_helpers.h" 14 #include "base/callback_helpers.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #include "third_party/khronos/GLES2/gl2ext.h" 74 #include "third_party/khronos/GLES2/gl2ext.h"
75 #include "third_party/skia/include/core/SkCanvas.h" 75 #include "third_party/skia/include/core/SkCanvas.h"
76 #include "ui/android/delegated_frame_host_android.h" 76 #include "ui/android/delegated_frame_host_android.h"
77 #include "ui/android/window_android.h" 77 #include "ui/android/window_android.h"
78 #include "ui/android/window_android_compositor.h" 78 #include "ui/android/window_android_compositor.h"
79 #include "ui/base/layout.h" 79 #include "ui/base/layout.h"
80 #include "ui/display/display.h" 80 #include "ui/display/display.h"
81 #include "ui/display/screen.h" 81 #include "ui/display/screen.h"
82 #include "ui/events/blink/blink_event_util.h" 82 #include "ui/events/blink/blink_event_util.h"
83 #include "ui/events/blink/did_overscroll_params.h" 83 #include "ui/events/blink/did_overscroll_params.h"
84 #include "ui/events/blink/web_input_event_traits.h"
84 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" 85 #include "ui/events/gesture_detection/gesture_provider_config_helper.h"
85 #include "ui/events/gesture_detection/motion_event.h" 86 #include "ui/events/gesture_detection/motion_event.h"
86 #include "ui/gfx/android/device_display_info.h" 87 #include "ui/gfx/android/device_display_info.h"
87 #include "ui/gfx/android/java_bitmap.h" 88 #include "ui/gfx/android/java_bitmap.h"
88 #include "ui/gfx/android/view_configuration.h" 89 #include "ui/gfx/android/view_configuration.h"
89 #include "ui/gfx/geometry/dip_util.h" 90 #include "ui/gfx/geometry/dip_util.h"
90 #include "ui/gfx/geometry/size_conversions.h" 91 #include "ui/gfx/geometry/size_conversions.h"
91 #include "ui/touch_selection/touch_selection_controller.h" 92 #include "ui/touch_selection/touch_selection_controller.h"
92 93
93 namespace content { 94 namespace content {
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 return true; 690 return true;
690 } 691 }
691 692
692 ui::FilteredGestureProvider::TouchHandlingResult result = 693 ui::FilteredGestureProvider::TouchHandlingResult result =
693 gesture_provider_.OnTouchEvent(event); 694 gesture_provider_.OnTouchEvent(event);
694 if (!result.succeeded) 695 if (!result.succeeded)
695 return false; 696 return false;
696 697
697 blink::WebTouchEvent web_event = ui::CreateWebTouchEventFromMotionEvent( 698 blink::WebTouchEvent web_event = ui::CreateWebTouchEventFromMotionEvent(
698 event, result.moved_beyond_slop_region); 699 event, result.moved_beyond_slop_region);
699 ui::LatencyInfo latency_info; 700 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH);
700 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 701 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
701 host_->ForwardTouchEventWithLatencyInfo(web_event, latency_info); 702 host_->ForwardTouchEventWithLatencyInfo(web_event, latency_info);
702 703
703 // Send a proactive BeginFrame for this vsync to reduce scroll latency for 704 // Send a proactive BeginFrame for this vsync to reduce scroll latency for
704 // scroll-inducing touch events. Note that Android's Choreographer ensures 705 // scroll-inducing touch events. Note that Android's Choreographer ensures
705 // that BeginFrame requests made during ACTION_MOVE dispatch will be honored 706 // that BeginFrame requests made during ACTION_MOVE dispatch will be honored
706 // in the same vsync phase. 707 // in the same vsync phase.
707 if (observing_root_window_ && result.moved_beyond_slop_region) 708 if (observing_root_window_ && result.moved_beyond_slop_region)
708 RequestVSyncUpdate(BEGIN_FRAME); 709 RequestVSyncUpdate(BEGIN_FRAME);
709 710
(...skipping 12 matching lines...) Expand all
722 if (!current_down_event) { 723 if (!current_down_event) {
723 // A hard reset ensures prevention of any timer-based events that might fire 724 // A hard reset ensures prevention of any timer-based events that might fire
724 // after a touch sequence has ended. 725 // after a touch sequence has ended.
725 gesture_provider_.ResetDetection(); 726 gesture_provider_.ResetDetection();
726 return; 727 return;
727 } 728 }
728 729
729 std::unique_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel(); 730 std::unique_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel();
730 if (gesture_provider_.OnTouchEvent(*cancel_event).succeeded) { 731 if (gesture_provider_.OnTouchEvent(*cancel_event).succeeded) {
731 bool causes_scrolling = false; 732 bool causes_scrolling = false;
733 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH);
734 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
732 host_->ForwardTouchEventWithLatencyInfo( 735 host_->ForwardTouchEventWithLatencyInfo(
733 ui::CreateWebTouchEventFromMotionEvent(*cancel_event, causes_scrolling), 736 ui::CreateWebTouchEventFromMotionEvent(*cancel_event, causes_scrolling),
734 ui::LatencyInfo()); 737 latency_info);
735 } 738 }
736 } 739 }
737 740
738 void RenderWidgetHostViewAndroid::OnDidNavigateMainFrameToNewPage() { 741 void RenderWidgetHostViewAndroid::OnDidNavigateMainFrameToNewPage() {
739 ResetGestureDetection(); 742 ResetGestureDetection();
740 } 743 }
741 744
742 void RenderWidgetHostViewAndroid::SetDoubleTapSupportEnabled(bool enabled) { 745 void RenderWidgetHostViewAndroid::SetDoubleTapSupportEnabled(bool enabled) {
743 gesture_provider_.SetDoubleTapSupportForPlatformEnabled(enabled); 746 gesture_provider_.SetDoubleTapSupportForPlatformEnabled(enabled);
744 } 747 }
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 1495
1493 void RenderWidgetHostViewAndroid::SendMouseEvent( 1496 void RenderWidgetHostViewAndroid::SendMouseEvent(
1494 const blink::WebMouseEvent& event) { 1497 const blink::WebMouseEvent& event) {
1495 if (host_) 1498 if (host_)
1496 host_->ForwardMouseEvent(event); 1499 host_->ForwardMouseEvent(event);
1497 } 1500 }
1498 1501
1499 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( 1502 void RenderWidgetHostViewAndroid::SendMouseWheelEvent(
1500 const blink::WebMouseWheelEvent& event) { 1503 const blink::WebMouseWheelEvent& event) {
1501 if (host_) { 1504 if (host_) {
1502 ui::LatencyInfo latency_info; 1505 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL);
1503 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 1506 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
1504 host_->ForwardWheelEventWithLatencyInfo(event, latency_info); 1507 host_->ForwardWheelEventWithLatencyInfo(event, latency_info);
1505 } 1508 }
1506 } 1509 }
1507 1510
1508 void RenderWidgetHostViewAndroid::SendGestureEvent( 1511 void RenderWidgetHostViewAndroid::SendGestureEvent(
1509 const blink::WebGestureEvent& event) { 1512 const blink::WebGestureEvent& event) {
1510 // Sending a gesture that may trigger overscroll should resume the effect. 1513 // Sending a gesture that may trigger overscroll should resume the effect.
1511 if (overscroll_controller_) 1514 if (overscroll_controller_)
1512 overscroll_controller_->Enable(); 1515 overscroll_controller_->Enable();
1513 1516
1514 if (host_) 1517 if (host_) {
1515 host_->ForwardGestureEventWithLatencyInfo(event, ui::LatencyInfo()); 1518 ui::LatencyInfo latency_info =
1519 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent(event);
1520 host_->ForwardGestureEventWithLatencyInfo(event, latency_info);
1521 }
1516 } 1522 }
1517 1523
1518 void RenderWidgetHostViewAndroid::MoveCaret(const gfx::Point& point) { 1524 void RenderWidgetHostViewAndroid::MoveCaret(const gfx::Point& point) {
1519 if (host_) 1525 if (host_)
1520 host_->MoveCaret(point); 1526 host_->MoveCaret(point);
1521 } 1527 }
1522 1528
1523 void RenderWidgetHostViewAndroid::DismissTextHandles() { 1529 void RenderWidgetHostViewAndroid::DismissTextHandles() {
1524 if (selection_controller_) 1530 if (selection_controller_)
1525 selection_controller_->HideAndDisallowShowingAutomatically(); 1531 selection_controller_->HideAndDisallowShowingAutomatically();
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 case ui::MotionEvent::ACTION_UP: 1880 case ui::MotionEvent::ACTION_UP:
1875 case ui::MotionEvent::ACTION_POINTER_UP: 1881 case ui::MotionEvent::ACTION_POINTER_UP:
1876 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", 1882 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED",
1877 delta.InMicroseconds(), 1, 1000000, 50); 1883 delta.InMicroseconds(), 1, 1000000, 50);
1878 default: 1884 default:
1879 return; 1885 return;
1880 } 1886 }
1881 } 1887 }
1882 1888
1883 } // namespace content 1889 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698