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

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

Issue 2393783005: re-land the "SourceEventType added to LatencyInfo." (Closed)
Patch Set: Created 4 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 (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"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #include "third_party/khronos/GLES2/gl2ext.h" 77 #include "third_party/khronos/GLES2/gl2ext.h"
78 #include "third_party/skia/include/core/SkCanvas.h" 78 #include "third_party/skia/include/core/SkCanvas.h"
79 #include "ui/android/delegated_frame_host_android.h" 79 #include "ui/android/delegated_frame_host_android.h"
80 #include "ui/android/window_android.h" 80 #include "ui/android/window_android.h"
81 #include "ui/android/window_android_compositor.h" 81 #include "ui/android/window_android_compositor.h"
82 #include "ui/base/layout.h" 82 #include "ui/base/layout.h"
83 #include "ui/display/display.h" 83 #include "ui/display/display.h"
84 #include "ui/display/screen.h" 84 #include "ui/display/screen.h"
85 #include "ui/events/blink/blink_event_util.h" 85 #include "ui/events/blink/blink_event_util.h"
86 #include "ui/events/blink/did_overscroll_params.h" 86 #include "ui/events/blink/did_overscroll_params.h"
87 #include "ui/events/blink/web_input_event_traits.h"
87 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" 88 #include "ui/events/gesture_detection/gesture_provider_config_helper.h"
88 #include "ui/events/gesture_detection/motion_event.h" 89 #include "ui/events/gesture_detection/motion_event.h"
89 #include "ui/gfx/android/device_display_info.h" 90 #include "ui/gfx/android/device_display_info.h"
90 #include "ui/gfx/android/java_bitmap.h" 91 #include "ui/gfx/android/java_bitmap.h"
91 #include "ui/gfx/android/view_configuration.h" 92 #include "ui/gfx/android/view_configuration.h"
92 #include "ui/gfx/geometry/dip_util.h" 93 #include "ui/gfx/geometry/dip_util.h"
93 #include "ui/gfx/geometry/size_conversions.h" 94 #include "ui/gfx/geometry/size_conversions.h"
94 #include "ui/touch_selection/touch_selection_controller.h" 95 #include "ui/touch_selection/touch_selection_controller.h"
95 96
96 namespace content { 97 namespace content {
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 return true; 837 return true;
837 } 838 }
838 839
839 ui::FilteredGestureProvider::TouchHandlingResult result = 840 ui::FilteredGestureProvider::TouchHandlingResult result =
840 gesture_provider_.OnTouchEvent(event); 841 gesture_provider_.OnTouchEvent(event);
841 if (!result.succeeded) 842 if (!result.succeeded)
842 return false; 843 return false;
843 844
844 blink::WebTouchEvent web_event = ui::CreateWebTouchEventFromMotionEvent( 845 blink::WebTouchEvent web_event = ui::CreateWebTouchEventFromMotionEvent(
845 event, result.moved_beyond_slop_region); 846 event, result.moved_beyond_slop_region);
846 ui::LatencyInfo latency_info; 847 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH);
847 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 848 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
848 host_->ForwardTouchEventWithLatencyInfo(web_event, latency_info); 849 host_->ForwardTouchEventWithLatencyInfo(web_event, latency_info);
849 850
850 // Send a proactive BeginFrame for this vsync to reduce scroll latency for 851 // Send a proactive BeginFrame for this vsync to reduce scroll latency for
851 // scroll-inducing touch events. Note that Android's Choreographer ensures 852 // scroll-inducing touch events. Note that Android's Choreographer ensures
852 // that BeginFrame requests made during ACTION_MOVE dispatch will be honored 853 // that BeginFrame requests made during ACTION_MOVE dispatch will be honored
853 // in the same vsync phase. 854 // in the same vsync phase.
854 if (observing_root_window_ && result.moved_beyond_slop_region) 855 if (observing_root_window_ && result.moved_beyond_slop_region)
855 RequestVSyncUpdate(BEGIN_FRAME); 856 RequestVSyncUpdate(BEGIN_FRAME);
856 857
(...skipping 12 matching lines...) Expand all
869 if (!current_down_event) { 870 if (!current_down_event) {
870 // A hard reset ensures prevention of any timer-based events that might fire 871 // A hard reset ensures prevention of any timer-based events that might fire
871 // after a touch sequence has ended. 872 // after a touch sequence has ended.
872 gesture_provider_.ResetDetection(); 873 gesture_provider_.ResetDetection();
873 return; 874 return;
874 } 875 }
875 876
876 std::unique_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel(); 877 std::unique_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel();
877 if (gesture_provider_.OnTouchEvent(*cancel_event).succeeded) { 878 if (gesture_provider_.OnTouchEvent(*cancel_event).succeeded) {
878 bool causes_scrolling = false; 879 bool causes_scrolling = false;
880 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH);
881 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
879 host_->ForwardTouchEventWithLatencyInfo( 882 host_->ForwardTouchEventWithLatencyInfo(
880 ui::CreateWebTouchEventFromMotionEvent(*cancel_event, causes_scrolling), 883 ui::CreateWebTouchEventFromMotionEvent(*cancel_event, causes_scrolling),
881 ui::LatencyInfo()); 884 latency_info);
882 } 885 }
883 } 886 }
884 887
885 void RenderWidgetHostViewAndroid::OnDidNavigateMainFrameToNewPage() { 888 void RenderWidgetHostViewAndroid::OnDidNavigateMainFrameToNewPage() {
886 ResetGestureDetection(); 889 ResetGestureDetection();
887 } 890 }
888 891
889 void RenderWidgetHostViewAndroid::SetDoubleTapSupportEnabled(bool enabled) { 892 void RenderWidgetHostViewAndroid::SetDoubleTapSupportEnabled(bool enabled) {
890 gesture_provider_.SetDoubleTapSupportForPlatformEnabled(enabled); 893 gesture_provider_.SetDoubleTapSupportForPlatformEnabled(enabled);
891 } 894 }
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 1653
1651 void RenderWidgetHostViewAndroid::SendMouseEvent( 1654 void RenderWidgetHostViewAndroid::SendMouseEvent(
1652 const blink::WebMouseEvent& event) { 1655 const blink::WebMouseEvent& event) {
1653 if (host_) 1656 if (host_)
1654 host_->ForwardMouseEvent(event); 1657 host_->ForwardMouseEvent(event);
1655 } 1658 }
1656 1659
1657 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( 1660 void RenderWidgetHostViewAndroid::SendMouseWheelEvent(
1658 const blink::WebMouseWheelEvent& event) { 1661 const blink::WebMouseWheelEvent& event) {
1659 if (host_) { 1662 if (host_) {
1660 ui::LatencyInfo latency_info; 1663 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL);
1661 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 1664 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
1662 host_->ForwardWheelEventWithLatencyInfo(event, latency_info); 1665 host_->ForwardWheelEventWithLatencyInfo(event, latency_info);
1663 } 1666 }
1664 } 1667 }
1665 1668
1666 void RenderWidgetHostViewAndroid::SendGestureEvent( 1669 void RenderWidgetHostViewAndroid::SendGestureEvent(
1667 const blink::WebGestureEvent& event) { 1670 const blink::WebGestureEvent& event) {
1668 // Sending a gesture that may trigger overscroll should resume the effect. 1671 // Sending a gesture that may trigger overscroll should resume the effect.
1669 if (overscroll_controller_) 1672 if (overscroll_controller_)
1670 overscroll_controller_->Enable(); 1673 overscroll_controller_->Enable();
1671 1674
1672 if (host_) 1675 if (host_) {
1673 host_->ForwardGestureEventWithLatencyInfo(event, ui::LatencyInfo()); 1676 ui::LatencyInfo latency_info =
1677 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent(event);
1678 host_->ForwardGestureEventWithLatencyInfo(event, latency_info);
1679 }
1674 } 1680 }
1675 1681
1676 void RenderWidgetHostViewAndroid::MoveCaret(const gfx::Point& point) { 1682 void RenderWidgetHostViewAndroid::MoveCaret(const gfx::Point& point) {
1677 if (host_) 1683 if (host_)
1678 host_->MoveCaret(point); 1684 host_->MoveCaret(point);
1679 } 1685 }
1680 1686
1681 void RenderWidgetHostViewAndroid::DismissTextHandles() { 1687 void RenderWidgetHostViewAndroid::DismissTextHandles() {
1682 if (selection_controller_) 1688 if (selection_controller_)
1683 selection_controller_->HideAndDisallowShowingAutomatically(); 1689 selection_controller_->HideAndDisallowShowingAutomatically();
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1976 case ui::MotionEvent::ACTION_UP: 1982 case ui::MotionEvent::ACTION_UP:
1977 case ui::MotionEvent::ACTION_POINTER_UP: 1983 case ui::MotionEvent::ACTION_POINTER_UP:
1978 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", 1984 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED",
1979 delta.InMicroseconds(), 1, 1000000, 50); 1985 delta.InMicroseconds(), 1, 1000000, 50);
1980 default: 1986 default:
1981 return; 1987 return;
1982 } 1988 }
1983 } 1989 }
1984 1990
1985 } // namespace content 1991 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698