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

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

Issue 2394593002: revert "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 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"
86 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" 85 #include "ui/events/gesture_detection/gesture_provider_config_helper.h"
87 #include "ui/events/gesture_detection/motion_event.h" 86 #include "ui/events/gesture_detection/motion_event.h"
88 #include "ui/gfx/android/device_display_info.h" 87 #include "ui/gfx/android/device_display_info.h"
89 #include "ui/gfx/android/java_bitmap.h" 88 #include "ui/gfx/android/java_bitmap.h"
90 #include "ui/gfx/android/view_configuration.h" 89 #include "ui/gfx/android/view_configuration.h"
91 #include "ui/gfx/geometry/dip_util.h" 90 #include "ui/gfx/geometry/dip_util.h"
92 #include "ui/gfx/geometry/size_conversions.h" 91 #include "ui/gfx/geometry/size_conversions.h"
93 #include "ui/touch_selection/touch_selection_controller.h" 92 #include "ui/touch_selection/touch_selection_controller.h"
94 93
95 namespace content { 94 namespace content {
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 return true; 692 return true;
694 } 693 }
695 694
696 ui::FilteredGestureProvider::TouchHandlingResult result = 695 ui::FilteredGestureProvider::TouchHandlingResult result =
697 gesture_provider_.OnTouchEvent(event); 696 gesture_provider_.OnTouchEvent(event);
698 if (!result.succeeded) 697 if (!result.succeeded)
699 return false; 698 return false;
700 699
701 blink::WebTouchEvent web_event = ui::CreateWebTouchEventFromMotionEvent( 700 blink::WebTouchEvent web_event = ui::CreateWebTouchEventFromMotionEvent(
702 event, result.moved_beyond_slop_region); 701 event, result.moved_beyond_slop_region);
703 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH); 702 ui::LatencyInfo latency_info;
704 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 703 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
705 host_->ForwardTouchEventWithLatencyInfo(web_event, latency_info); 704 host_->ForwardTouchEventWithLatencyInfo(web_event, latency_info);
706 705
707 // 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
708 // scroll-inducing touch events. Note that Android's Choreographer ensures 707 // scroll-inducing touch events. Note that Android's Choreographer ensures
709 // that BeginFrame requests made during ACTION_MOVE dispatch will be honored 708 // that BeginFrame requests made during ACTION_MOVE dispatch will be honored
710 // in the same vsync phase. 709 // in the same vsync phase.
711 if (observing_root_window_ && result.moved_beyond_slop_region) 710 if (observing_root_window_ && result.moved_beyond_slop_region)
712 RequestVSyncUpdate(BEGIN_FRAME); 711 RequestVSyncUpdate(BEGIN_FRAME);
713 712
(...skipping 12 matching lines...) Expand all
726 if (!current_down_event) { 725 if (!current_down_event) {
727 // 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
728 // after a touch sequence has ended. 727 // after a touch sequence has ended.
729 gesture_provider_.ResetDetection(); 728 gesture_provider_.ResetDetection();
730 return; 729 return;
731 } 730 }
732 731
733 std::unique_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel(); 732 std::unique_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel();
734 if (gesture_provider_.OnTouchEvent(*cancel_event).succeeded) { 733 if (gesture_provider_.OnTouchEvent(*cancel_event).succeeded) {
735 bool causes_scrolling = false; 734 bool causes_scrolling = false;
736 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH);
737 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
738 host_->ForwardTouchEventWithLatencyInfo( 735 host_->ForwardTouchEventWithLatencyInfo(
739 ui::CreateWebTouchEventFromMotionEvent(*cancel_event, causes_scrolling), 736 ui::CreateWebTouchEventFromMotionEvent(*cancel_event, causes_scrolling),
740 latency_info); 737 ui::LatencyInfo());
741 } 738 }
742 } 739 }
743 740
744 void RenderWidgetHostViewAndroid::OnDidNavigateMainFrameToNewPage() { 741 void RenderWidgetHostViewAndroid::OnDidNavigateMainFrameToNewPage() {
745 ResetGestureDetection(); 742 ResetGestureDetection();
746 } 743 }
747 744
748 void RenderWidgetHostViewAndroid::SetDoubleTapSupportEnabled(bool enabled) { 745 void RenderWidgetHostViewAndroid::SetDoubleTapSupportEnabled(bool enabled) {
749 gesture_provider_.SetDoubleTapSupportForPlatformEnabled(enabled); 746 gesture_provider_.SetDoubleTapSupportForPlatformEnabled(enabled);
750 } 747 }
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 1503
1507 void RenderWidgetHostViewAndroid::SendMouseEvent( 1504 void RenderWidgetHostViewAndroid::SendMouseEvent(
1508 const blink::WebMouseEvent& event) { 1505 const blink::WebMouseEvent& event) {
1509 if (host_) 1506 if (host_)
1510 host_->ForwardMouseEvent(event); 1507 host_->ForwardMouseEvent(event);
1511 } 1508 }
1512 1509
1513 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( 1510 void RenderWidgetHostViewAndroid::SendMouseWheelEvent(
1514 const blink::WebMouseWheelEvent& event) { 1511 const blink::WebMouseWheelEvent& event) {
1515 if (host_) { 1512 if (host_) {
1516 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); 1513 ui::LatencyInfo latency_info;
1517 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 1514 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
1518 host_->ForwardWheelEventWithLatencyInfo(event, latency_info); 1515 host_->ForwardWheelEventWithLatencyInfo(event, latency_info);
1519 } 1516 }
1520 } 1517 }
1521 1518
1522 void RenderWidgetHostViewAndroid::SendGestureEvent( 1519 void RenderWidgetHostViewAndroid::SendGestureEvent(
1523 const blink::WebGestureEvent& event) { 1520 const blink::WebGestureEvent& event) {
1524 // Sending a gesture that may trigger overscroll should resume the effect. 1521 // Sending a gesture that may trigger overscroll should resume the effect.
1525 if (overscroll_controller_) 1522 if (overscroll_controller_)
1526 overscroll_controller_->Enable(); 1523 overscroll_controller_->Enable();
1527 1524
1528 if (host_) { 1525 if (host_)
1529 ui::LatencyInfo latency_info = 1526 host_->ForwardGestureEventWithLatencyInfo(event, ui::LatencyInfo());
1530 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent(event);
1531 host_->ForwardGestureEventWithLatencyInfo(event, latency_info);
1532 }
1533 } 1527 }
1534 1528
1535 void RenderWidgetHostViewAndroid::MoveCaret(const gfx::Point& point) { 1529 void RenderWidgetHostViewAndroid::MoveCaret(const gfx::Point& point) {
1536 if (host_) 1530 if (host_)
1537 host_->MoveCaret(point); 1531 host_->MoveCaret(point);
1538 } 1532 }
1539 1533
1540 void RenderWidgetHostViewAndroid::DismissTextHandles() { 1534 void RenderWidgetHostViewAndroid::DismissTextHandles() {
1541 if (selection_controller_) 1535 if (selection_controller_)
1542 selection_controller_->HideAndDisallowShowingAutomatically(); 1536 selection_controller_->HideAndDisallowShowingAutomatically();
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1896 case ui::MotionEvent::ACTION_UP: 1890 case ui::MotionEvent::ACTION_UP:
1897 case ui::MotionEvent::ACTION_POINTER_UP: 1891 case ui::MotionEvent::ACTION_POINTER_UP:
1898 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", 1892 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED",
1899 delta.InMicroseconds(), 1, 1000000, 50); 1893 delta.InMicroseconds(), 1, 1000000, 50);
1900 default: 1894 default:
1901 return; 1895 return;
1902 } 1896 }
1903 } 1897 }
1904 1898
1905 } // namespace content 1899 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698