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

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

Issue 2317253005: SourceEventType added to LatencyInfo (Closed)
Patch Set: Added a fake return to the end of EventTypeToLatencySourceEventType, for compilers that don't know … 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"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #include "third_party/khronos/GLES2/gl2ext.h" 75 #include "third_party/khronos/GLES2/gl2ext.h"
76 #include "third_party/skia/include/core/SkCanvas.h" 76 #include "third_party/skia/include/core/SkCanvas.h"
77 #include "ui/android/delegated_frame_host_android.h" 77 #include "ui/android/delegated_frame_host_android.h"
78 #include "ui/android/window_android.h" 78 #include "ui/android/window_android.h"
79 #include "ui/android/window_android_compositor.h" 79 #include "ui/android/window_android_compositor.h"
80 #include "ui/base/layout.h" 80 #include "ui/base/layout.h"
81 #include "ui/display/display.h" 81 #include "ui/display/display.h"
82 #include "ui/display/screen.h" 82 #include "ui/display/screen.h"
83 #include "ui/events/blink/blink_event_util.h" 83 #include "ui/events/blink/blink_event_util.h"
84 #include "ui/events/blink/did_overscroll_params.h" 84 #include "ui/events/blink/did_overscroll_params.h"
85 #include "ui/events/blink/web_input_event_traits.h"
85 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" 86 #include "ui/events/gesture_detection/gesture_provider_config_helper.h"
86 #include "ui/events/gesture_detection/motion_event.h" 87 #include "ui/events/gesture_detection/motion_event.h"
87 #include "ui/gfx/android/device_display_info.h" 88 #include "ui/gfx/android/device_display_info.h"
88 #include "ui/gfx/android/java_bitmap.h" 89 #include "ui/gfx/android/java_bitmap.h"
89 #include "ui/gfx/android/view_configuration.h" 90 #include "ui/gfx/android/view_configuration.h"
90 #include "ui/gfx/geometry/dip_util.h" 91 #include "ui/gfx/geometry/dip_util.h"
91 #include "ui/gfx/geometry/size_conversions.h" 92 #include "ui/gfx/geometry/size_conversions.h"
92 #include "ui/touch_selection/touch_selection_controller.h" 93 #include "ui/touch_selection/touch_selection_controller.h"
93 94
94 namespace content { 95 namespace content {
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 return true; 692 return true;
692 } 693 }
693 694
694 ui::FilteredGestureProvider::TouchHandlingResult result = 695 ui::FilteredGestureProvider::TouchHandlingResult result =
695 gesture_provider_.OnTouchEvent(event); 696 gesture_provider_.OnTouchEvent(event);
696 if (!result.succeeded) 697 if (!result.succeeded)
697 return false; 698 return false;
698 699
699 blink::WebTouchEvent web_event = ui::CreateWebTouchEventFromMotionEvent( 700 blink::WebTouchEvent web_event = ui::CreateWebTouchEventFromMotionEvent(
700 event, result.moved_beyond_slop_region); 701 event, result.moved_beyond_slop_region);
701 ui::LatencyInfo latency_info; 702 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH);
702 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 703 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
703 host_->ForwardTouchEventWithLatencyInfo(web_event, latency_info); 704 host_->ForwardTouchEventWithLatencyInfo(web_event, latency_info);
704 705
705 // Send a proactive BeginFrame for this vsync to reduce scroll latency for 706 // Send a proactive BeginFrame for this vsync to reduce scroll latency for
706 // scroll-inducing touch events. Note that Android's Choreographer ensures 707 // scroll-inducing touch events. Note that Android's Choreographer ensures
707 // that BeginFrame requests made during ACTION_MOVE dispatch will be honored 708 // that BeginFrame requests made during ACTION_MOVE dispatch will be honored
708 // in the same vsync phase. 709 // in the same vsync phase.
709 if (observing_root_window_ && result.moved_beyond_slop_region) 710 if (observing_root_window_ && result.moved_beyond_slop_region)
710 RequestVSyncUpdate(BEGIN_FRAME); 711 RequestVSyncUpdate(BEGIN_FRAME);
711 712
(...skipping 12 matching lines...) Expand all
724 if (!current_down_event) { 725 if (!current_down_event) {
725 // A hard reset ensures prevention of any timer-based events that might fire 726 // A hard reset ensures prevention of any timer-based events that might fire
726 // after a touch sequence has ended. 727 // after a touch sequence has ended.
727 gesture_provider_.ResetDetection(); 728 gesture_provider_.ResetDetection();
728 return; 729 return;
729 } 730 }
730 731
731 std::unique_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel(); 732 std::unique_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel();
732 if (gesture_provider_.OnTouchEvent(*cancel_event).succeeded) { 733 if (gesture_provider_.OnTouchEvent(*cancel_event).succeeded) {
733 bool causes_scrolling = false; 734 bool causes_scrolling = false;
735 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH);
736 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
734 host_->ForwardTouchEventWithLatencyInfo( 737 host_->ForwardTouchEventWithLatencyInfo(
735 ui::CreateWebTouchEventFromMotionEvent(*cancel_event, causes_scrolling), 738 ui::CreateWebTouchEventFromMotionEvent(*cancel_event, causes_scrolling),
736 ui::LatencyInfo()); 739 latency_info);
737 } 740 }
738 } 741 }
739 742
740 void RenderWidgetHostViewAndroid::OnDidNavigateMainFrameToNewPage() { 743 void RenderWidgetHostViewAndroid::OnDidNavigateMainFrameToNewPage() {
741 ResetGestureDetection(); 744 ResetGestureDetection();
742 } 745 }
743 746
744 void RenderWidgetHostViewAndroid::SetDoubleTapSupportEnabled(bool enabled) { 747 void RenderWidgetHostViewAndroid::SetDoubleTapSupportEnabled(bool enabled) {
745 gesture_provider_.SetDoubleTapSupportForPlatformEnabled(enabled); 748 gesture_provider_.SetDoubleTapSupportForPlatformEnabled(enabled);
746 } 749 }
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 1502
1500 void RenderWidgetHostViewAndroid::SendMouseEvent( 1503 void RenderWidgetHostViewAndroid::SendMouseEvent(
1501 const blink::WebMouseEvent& event) { 1504 const blink::WebMouseEvent& event) {
1502 if (host_) 1505 if (host_)
1503 host_->ForwardMouseEvent(event); 1506 host_->ForwardMouseEvent(event);
1504 } 1507 }
1505 1508
1506 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( 1509 void RenderWidgetHostViewAndroid::SendMouseWheelEvent(
1507 const blink::WebMouseWheelEvent& event) { 1510 const blink::WebMouseWheelEvent& event) {
1508 if (host_) { 1511 if (host_) {
1509 ui::LatencyInfo latency_info; 1512 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL);
1510 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 1513 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
1511 host_->ForwardWheelEventWithLatencyInfo(event, latency_info); 1514 host_->ForwardWheelEventWithLatencyInfo(event, latency_info);
1512 } 1515 }
1513 } 1516 }
1514 1517
1515 void RenderWidgetHostViewAndroid::SendGestureEvent( 1518 void RenderWidgetHostViewAndroid::SendGestureEvent(
1516 const blink::WebGestureEvent& event) { 1519 const blink::WebGestureEvent& event) {
1517 // Sending a gesture that may trigger overscroll should resume the effect. 1520 // Sending a gesture that may trigger overscroll should resume the effect.
1518 if (overscroll_controller_) 1521 if (overscroll_controller_)
1519 overscroll_controller_->Enable(); 1522 overscroll_controller_->Enable();
1520 1523
1521 if (host_) 1524 if (host_) {
1522 host_->ForwardGestureEventWithLatencyInfo(event, ui::LatencyInfo()); 1525 ui::LatencyInfo latency_info =
1526 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent(event);
1527 host_->ForwardGestureEventWithLatencyInfo(event, latency_info);
1528 }
1523 } 1529 }
1524 1530
1525 void RenderWidgetHostViewAndroid::MoveCaret(const gfx::Point& point) { 1531 void RenderWidgetHostViewAndroid::MoveCaret(const gfx::Point& point) {
1526 if (host_) 1532 if (host_)
1527 host_->MoveCaret(point); 1533 host_->MoveCaret(point);
1528 } 1534 }
1529 1535
1530 void RenderWidgetHostViewAndroid::DismissTextHandles() { 1536 void RenderWidgetHostViewAndroid::DismissTextHandles() {
1531 if (selection_controller_) 1537 if (selection_controller_)
1532 selection_controller_->HideAndDisallowShowingAutomatically(); 1538 selection_controller_->HideAndDisallowShowingAutomatically();
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 case ui::MotionEvent::ACTION_UP: 1887 case ui::MotionEvent::ACTION_UP:
1882 case ui::MotionEvent::ACTION_POINTER_UP: 1888 case ui::MotionEvent::ACTION_POINTER_UP:
1883 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", 1889 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED",
1884 delta.InMicroseconds(), 1, 1000000, 50); 1890 delta.InMicroseconds(), 1, 1000000, 50);
1885 default: 1891 default:
1886 return; 1892 return;
1887 } 1893 }
1888 } 1894 }
1889 1895
1890 } // namespace content 1896 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698