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

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

Issue 681763003: Add input latency histograms for wheel events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix HISTOGRAM macro issue Created 6 years, 1 month 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_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 } 858 }
859 859
860 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( 860 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo(
861 const blink::WebMouseEvent& mouse_event, 861 const blink::WebMouseEvent& mouse_event,
862 const ui::LatencyInfo& ui_latency) { 862 const ui::LatencyInfo& ui_latency) {
863 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", 863 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent",
864 "x", mouse_event.x, "y", mouse_event.y); 864 "x", mouse_event.x, "y", mouse_event.y);
865 ui::LatencyInfo::InputCoordinate logical_coordinate(mouse_event.x, 865 ui::LatencyInfo::InputCoordinate logical_coordinate(mouse_event.x,
866 mouse_event.y); 866 mouse_event.y);
867 867
868 ui::LatencyInfo latency_info = CreateRWHLatencyInfoIfNotExist( 868 ui::LatencyInfo latency_info = CreateInputEventLatencyInfoIfNotExist(
869 &ui_latency, mouse_event.type, &logical_coordinate, 1); 869 &ui_latency, mouse_event.type, &logical_coordinate, 1);
870 870
871 for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) { 871 for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) {
872 if (mouse_event_callbacks_[i].Run(mouse_event)) 872 if (mouse_event_callbacks_[i].Run(mouse_event))
873 return; 873 return;
874 } 874 }
875 875
876 if (IgnoreInputEvents()) 876 if (IgnoreInputEvents())
877 return; 877 return;
878 878
(...skipping 13 matching lines...) Expand all
892 } 892 }
893 893
894 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( 894 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo(
895 const blink::WebMouseWheelEvent& wheel_event, 895 const blink::WebMouseWheelEvent& wheel_event,
896 const ui::LatencyInfo& ui_latency) { 896 const ui::LatencyInfo& ui_latency) {
897 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardWheelEvent"); 897 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardWheelEvent");
898 898
899 ui::LatencyInfo::InputCoordinate logical_coordinate(wheel_event.x, 899 ui::LatencyInfo::InputCoordinate logical_coordinate(wheel_event.x,
900 wheel_event.y); 900 wheel_event.y);
901 901
902 ui::LatencyInfo latency_info = CreateRWHLatencyInfoIfNotExist( 902 ui::LatencyInfo latency_info = CreateInputEventLatencyInfoIfNotExist(
903 &ui_latency, wheel_event.type, &logical_coordinate, 1); 903 &ui_latency, wheel_event.type, &logical_coordinate, 1);
904 904
905 if (IgnoreInputEvents()) 905 if (IgnoreInputEvents())
906 return; 906 return;
907 907
908 if (touch_emulator_ && touch_emulator_->HandleMouseWheelEvent(wheel_event)) 908 if (touch_emulator_ && touch_emulator_->HandleMouseWheelEvent(wheel_event))
909 return; 909 return;
910 910
911 input_router_->SendWheelEvent(MouseWheelEventWithLatencyInfo(wheel_event, 911 input_router_->SendWheelEvent(MouseWheelEventWithLatencyInfo(wheel_event,
912 latency_info)); 912 latency_info));
(...skipping 11 matching lines...) Expand all
924 // Early out if necessary, prior to performing latency logic. 924 // Early out if necessary, prior to performing latency logic.
925 if (IgnoreInputEvents()) 925 if (IgnoreInputEvents())
926 return; 926 return;
927 927
928 if (delegate_->PreHandleGestureEvent(gesture_event)) 928 if (delegate_->PreHandleGestureEvent(gesture_event))
929 return; 929 return;
930 930
931 ui::LatencyInfo::InputCoordinate logical_coordinate(gesture_event.x, 931 ui::LatencyInfo::InputCoordinate logical_coordinate(gesture_event.x,
932 gesture_event.y); 932 gesture_event.y);
933 933
934 ui::LatencyInfo latency_info = CreateRWHLatencyInfoIfNotExist( 934 ui::LatencyInfo latency_info = CreateInputEventLatencyInfoIfNotExist(
935 &ui_latency, gesture_event.type, &logical_coordinate, 1); 935 &ui_latency, gesture_event.type, &logical_coordinate, 1);
936 936
937 if (gesture_event.type == blink::WebInputEvent::GestureScrollUpdate) { 937 if (gesture_event.type == blink::WebInputEvent::GestureScrollUpdate) {
938 latency_info.AddLatencyNumber( 938 latency_info.AddLatencyNumber(
939 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_RWH_COMPONENT, 939 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_RWH_COMPONENT,
940 GetLatencyComponentId(), 940 GetLatencyComponentId(),
941 ++last_input_number_); 941 ++last_input_number_);
942 942
943 // Make a copy of the INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT with a 943 // Make a copy of the INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT with a
944 // different name INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT. 944 // different name INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT.
(...skipping 22 matching lines...) Expand all
967 ui::LatencyInfo::InputCoordinate 967 ui::LatencyInfo::InputCoordinate
968 logical_coordinates[ui::LatencyInfo::kMaxInputCoordinates]; 968 logical_coordinates[ui::LatencyInfo::kMaxInputCoordinates];
969 size_t logical_coordinates_size = 969 size_t logical_coordinates_size =
970 std::min(arraysize(logical_coordinates), 970 std::min(arraysize(logical_coordinates),
971 static_cast<size_t>(touch_event.touchesLength)); 971 static_cast<size_t>(touch_event.touchesLength));
972 for (size_t i = 0; i < logical_coordinates_size; i++) { 972 for (size_t i = 0; i < logical_coordinates_size; i++) {
973 logical_coordinates[i] = ui::LatencyInfo::InputCoordinate( 973 logical_coordinates[i] = ui::LatencyInfo::InputCoordinate(
974 touch_event.touches[i].position.x, touch_event.touches[i].position.y); 974 touch_event.touches[i].position.x, touch_event.touches[i].position.y);
975 } 975 }
976 976
977 ui::LatencyInfo latency_info = CreateRWHLatencyInfoIfNotExist( 977 ui::LatencyInfo latency_info = CreateInputEventLatencyInfoIfNotExist(
978 NULL, touch_event.type, logical_coordinates, logical_coordinates_size); 978 NULL, touch_event.type, logical_coordinates, logical_coordinates_size);
979 TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info); 979 TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info);
980 input_router_->SendTouchEvent(touch_with_latency); 980 input_router_->SendTouchEvent(touch_with_latency);
981 } 981 }
982 982
983 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( 983 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo(
984 const blink::WebTouchEvent& touch_event, 984 const blink::WebTouchEvent& touch_event,
985 const ui::LatencyInfo& ui_latency) { 985 const ui::LatencyInfo& ui_latency) {
986 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent"); 986 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent");
987 987
988 // Always forward TouchEvents for touch stream consistency. They will be 988 // Always forward TouchEvents for touch stream consistency. They will be
989 // ignored if appropriate in FilterInputEvent(). 989 // ignored if appropriate in FilterInputEvent().
990 990
991 ui::LatencyInfo::InputCoordinate 991 ui::LatencyInfo::InputCoordinate
992 logical_coordinates[ui::LatencyInfo::kMaxInputCoordinates]; 992 logical_coordinates[ui::LatencyInfo::kMaxInputCoordinates];
993 size_t logical_coordinates_size = 993 size_t logical_coordinates_size =
994 std::min(arraysize(logical_coordinates), 994 std::min(arraysize(logical_coordinates),
995 static_cast<size_t>(touch_event.touchesLength)); 995 static_cast<size_t>(touch_event.touchesLength));
996 for (size_t i = 0; i < logical_coordinates_size; i++) { 996 for (size_t i = 0; i < logical_coordinates_size; i++) {
997 logical_coordinates[i] = ui::LatencyInfo::InputCoordinate( 997 logical_coordinates[i] = ui::LatencyInfo::InputCoordinate(
998 touch_event.touches[i].position.x, touch_event.touches[i].position.y); 998 touch_event.touches[i].position.x, touch_event.touches[i].position.y);
999 } 999 }
1000 1000
1001 ui::LatencyInfo latency_info = 1001 ui::LatencyInfo latency_info =
1002 CreateRWHLatencyInfoIfNotExist(&ui_latency, 1002 CreateInputEventLatencyInfoIfNotExist(&ui_latency,
1003 touch_event.type, 1003 touch_event.type,
1004 logical_coordinates, 1004 logical_coordinates,
1005 logical_coordinates_size); 1005 logical_coordinates_size);
1006 TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info); 1006 TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info);
1007 1007
1008 if (touch_emulator_ && 1008 if (touch_emulator_ &&
1009 touch_emulator_->HandleTouchEvent(touch_with_latency.event)) { 1009 touch_emulator_->HandleTouchEvent(touch_with_latency.event)) {
1010 if (view_) { 1010 if (view_) {
1011 view_->ProcessAckedTouchEvent( 1011 view_->ProcessAckedTouchEvent(
1012 touch_with_latency, INPUT_EVENT_ACK_STATE_CONSUMED); 1012 touch_with_latency, INPUT_EVENT_ACK_STATE_CONSUMED);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 1076
1077 if (key_event.type == WebKeyboardEvent::RawKeyDown) 1077 if (key_event.type == WebKeyboardEvent::RawKeyDown)
1078 suppress_next_char_events_ = false; 1078 suppress_next_char_events_ = false;
1079 } 1079 }
1080 1080
1081 if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event)) 1081 if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event))
1082 return; 1082 return;
1083 1083
1084 input_router_->SendKeyboardEvent( 1084 input_router_->SendKeyboardEvent(
1085 key_event, 1085 key_event,
1086 CreateRWHLatencyInfoIfNotExist(NULL, key_event.type, NULL, 0), 1086 CreateInputEventLatencyInfoIfNotExist(NULL, key_event.type, NULL, 0),
1087 is_shortcut); 1087 is_shortcut);
1088 } 1088 }
1089 1089
1090 void RenderWidgetHostImpl::QueueSyntheticGesture( 1090 void RenderWidgetHostImpl::QueueSyntheticGesture(
1091 scoped_ptr<SyntheticGesture> synthetic_gesture, 1091 scoped_ptr<SyntheticGesture> synthetic_gesture,
1092 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { 1092 const base::Callback<void(SyntheticGesture::Result)>& on_complete) {
1093 if (!synthetic_gesture_controller_ && view_) { 1093 if (!synthetic_gesture_controller_ && view_) {
1094 synthetic_gesture_controller_.reset( 1094 synthetic_gesture_controller_.reset(
1095 new SyntheticGestureController( 1095 new SyntheticGestureController(
1096 view_->CreateSyntheticGestureTarget().Pass())); 1096 view_->CreateSyntheticGestureTarget().Pass()));
(...skipping 12 matching lines...) Expand all
1109 1109
1110 void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) { 1110 void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) {
1111 Send(new ViewMsg_ShowContextMenu( 1111 Send(new ViewMsg_ShowContextMenu(
1112 GetRoutingID(), ui::MENU_SOURCE_MOUSE, point)); 1112 GetRoutingID(), ui::MENU_SOURCE_MOUSE, point));
1113 } 1113 }
1114 1114
1115 void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) { 1115 void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) {
1116 Send(new InputMsg_CursorVisibilityChange(GetRoutingID(), is_visible)); 1116 Send(new InputMsg_CursorVisibilityChange(GetRoutingID(), is_visible));
1117 } 1117 }
1118 1118
1119 int64 RenderWidgetHostImpl::GetLatencyComponentId() { 1119 int64 RenderWidgetHostImpl::GetLatencyComponentId() const {
1120 return GetRoutingID() | (static_cast<int64>(GetProcess()->GetID()) << 32); 1120 return GetRoutingID() | (static_cast<int64>(GetProcess()->GetID()) << 32);
1121 } 1121 }
1122 1122
1123 // static 1123 // static
1124 void RenderWidgetHostImpl::DisableResizeAckCheckForTesting() { 1124 void RenderWidgetHostImpl::DisableResizeAckCheckForTesting() {
1125 g_check_for_pending_resize_ack = false; 1125 g_check_for_pending_resize_ack = false;
1126 } 1126 }
1127 1127
1128 ui::LatencyInfo RenderWidgetHostImpl::CreateRWHLatencyInfoIfNotExist( 1128 ui::LatencyInfo RenderWidgetHostImpl::CreateInputEventLatencyInfoIfNotExist(
1129 const ui::LatencyInfo* original, 1129 const ui::LatencyInfo* original,
1130 WebInputEvent::Type type, 1130 WebInputEvent::Type type,
1131 const ui::LatencyInfo::InputCoordinate* logical_coordinates, 1131 const ui::LatencyInfo::InputCoordinate* logical_coordinates,
1132 size_t logical_coordinates_size) { 1132 size_t logical_coordinates_size) {
1133 ui::LatencyInfo info; 1133 ui::LatencyInfo info;
1134 if (original) 1134 if (original)
1135 info = *original; 1135 info = *original;
1136 // In Aura, gesture event will already carry its original touch event's 1136 // In Aura, gesture event will already carry its original touch event's
1137 // INPUT_EVENT_LATENCY_RWH_COMPONENT. 1137 // INPUT_EVENT_LATENCY_RWH_COMPONENT.
1138 if (!info.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1138 if (!info.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 1890
1891 // WARNING: This RenderWidgetHostImpl can be deallocated at this point 1891 // WARNING: This RenderWidgetHostImpl can be deallocated at this point
1892 // (i.e. in the case of Ctrl+W, where the call to 1892 // (i.e. in the case of Ctrl+W, where the call to
1893 // HandleKeyboardEvent destroys this RenderWidgetHostImpl). 1893 // HandleKeyboardEvent destroys this RenderWidgetHostImpl).
1894 } 1894 }
1895 } 1895 }
1896 1896
1897 void RenderWidgetHostImpl::OnWheelEventAck( 1897 void RenderWidgetHostImpl::OnWheelEventAck(
1898 const MouseWheelEventWithLatencyInfo& wheel_event, 1898 const MouseWheelEventWithLatencyInfo& wheel_event,
1899 InputEventAckState ack_result) { 1899 InputEventAckState ack_result) {
1900 ui::LatencyInfo latency = wheel_event.latency;
1901 latency.AddLatencyNumber(
1902 ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0);
1900 if (!wheel_event.latency.FindLatency( 1903 if (!wheel_event.latency.FindLatency(
1901 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { 1904 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) {
1902 // MouseWheelEvent latency ends when it is acked but does not cause any 1905 // MouseWheelEvent latency ends when it is acked but does not cause any
1903 // rendering scheduled. 1906 // rendering scheduled.
1904 ui::LatencyInfo latency = wheel_event.latency;
1905 latency.AddLatencyNumber( 1907 latency.AddLatencyNumber(
1906 ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, 0); 1908 ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, 0);
1907 } 1909 }
1910 ComputeInputLatencyHistograms(blink::WebInputEvent::MouseWheel, latency);
1908 1911
1909 if (!is_hidden() && view_) { 1912 if (!is_hidden() && view_) {
1910 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED && 1913 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED &&
1911 delegate_->HandleWheelEvent(wheel_event.event)) { 1914 delegate_->HandleWheelEvent(wheel_event.event)) {
1912 ack_result = INPUT_EVENT_ACK_STATE_CONSUMED; 1915 ack_result = INPUT_EVENT_ACK_STATE_CONSUMED;
1913 } 1916 }
1914 view_->WheelEventAck(wheel_event.event, ack_result); 1917 view_->WheelEventAck(wheel_event.event, ack_result);
1915 } 1918 }
1916 } 1919 }
1917 1920
(...skipping 16 matching lines...) Expand all
1934 1937
1935 if (view_) 1938 if (view_)
1936 view_->GestureEventAck(event.event, ack_result); 1939 view_->GestureEventAck(event.event, ack_result);
1937 } 1940 }
1938 1941
1939 void RenderWidgetHostImpl::OnTouchEventAck( 1942 void RenderWidgetHostImpl::OnTouchEventAck(
1940 const TouchEventWithLatencyInfo& event, 1943 const TouchEventWithLatencyInfo& event,
1941 InputEventAckState ack_result) { 1944 InputEventAckState ack_result) {
1942 TouchEventWithLatencyInfo touch_event = event; 1945 TouchEventWithLatencyInfo touch_event = event;
1943 touch_event.latency.AddLatencyNumber( 1946 touch_event.latency.AddLatencyNumber(
1944 ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, 0, 0); 1947 ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0);
1945 // TouchEvent latency ends at ack if it didn't cause any rendering. 1948 // TouchEvent latency ends at ack if it didn't cause any rendering.
1946 if (!touch_event.latency.FindLatency( 1949 if (!touch_event.latency.FindLatency(
1947 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { 1950 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) {
1948 touch_event.latency.AddLatencyNumber( 1951 touch_event.latency.AddLatencyNumber(
1949 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0); 1952 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0);
1950 } 1953 }
1951 ComputeTouchLatency(touch_event.latency); 1954 ComputeInputLatencyHistograms(
1955 blink::WebInputEvent::TouchStart, touch_event.latency);
1952 1956
1953 if (touch_emulator_ && 1957 if (touch_emulator_ &&
1954 touch_emulator_->HandleTouchEventAck(event.event, ack_result)) { 1958 touch_emulator_->HandleTouchEventAck(event.event, ack_result)) {
1955 return; 1959 return;
1956 } 1960 }
1957 1961
1958 if (view_) 1962 if (view_)
1959 view_->ProcessAckedTouchEvent(touch_event, ack_result); 1963 view_->ProcessAckedTouchEvent(touch_event, ack_result);
1960 } 1964 }
1961 1965
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 if (!should_auto_resize_) 2076 if (!should_auto_resize_)
2073 return; 2077 return;
2074 2078
2075 OnRenderAutoResized(new_size); 2079 OnRenderAutoResized(new_size);
2076 } 2080 }
2077 2081
2078 void RenderWidgetHostImpl::DetachDelegate() { 2082 void RenderWidgetHostImpl::DetachDelegate() {
2079 delegate_ = NULL; 2083 delegate_ = NULL;
2080 } 2084 }
2081 2085
2082 void RenderWidgetHostImpl::ComputeTouchLatency( 2086 void RenderWidgetHostImpl::ComputeInputLatencyHistograms(
2083 const ui::LatencyInfo& latency_info) { 2087 blink::WebInputEvent::Type type,
2084 ui::LatencyInfo::LatencyComponent ui_component; 2088 const ui::LatencyInfo& latency_info) const {
2085 ui::LatencyInfo::LatencyComponent rwh_component; 2089 ui::LatencyInfo::LatencyComponent rwh_component;
2086 ui::LatencyInfo::LatencyComponent acked_component; 2090 if (!latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
2087
2088 if (!latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_UI_COMPONENT,
2089 0,
2090 &ui_component) ||
2091 !latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
2092 GetLatencyComponentId(), 2091 GetLatencyComponentId(),
2093 &rwh_component)) 2092 &rwh_component))
2094 return; 2093 return;
2095
2096 DCHECK(ui_component.event_count == 1);
2097 DCHECK(rwh_component.event_count == 1); 2094 DCHECK(rwh_component.event_count == 1);
2098 2095
2099 base::TimeDelta ui_delta = 2096 ui::LatencyInfo::LatencyComponent ui_component;
2100 rwh_component.event_time - ui_component.event_time; 2097 if (latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_UI_COMPONENT,
2101 UMA_HISTOGRAM_CUSTOM_COUNTS( 2098 0,
2102 "Event.Latency.Browser.TouchUI", 2099 &ui_component)) {
2103 ui_delta.InMicroseconds(), 2100 DCHECK(ui_component.event_count == 1);
2104 1,
2105 20000,
2106 100);
2107 2101
2108 if (latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, 2102 base::TimeDelta ui_delta =
2103 rwh_component.event_time - ui_component.event_time;
2104
2105 // Note that the HISTOGRAM macros require a static string argument, so all
2106 // possible cases must be enumerated here.
2107 switch (type) {
Yufeng Shen (Slow to review) 2014/10/30 20:42:25 Does this help ? https://code.google.com/p/chromi
ccameron 2014/10/30 20:51:22 Thanks, yeah, that's the way it's supposed to be d
2108 case blink::WebInputEvent::MouseWheel:
2109 UMA_HISTOGRAM_CUSTOM_COUNTS(
2110 "Event.Latency.Browser.Wheel.UI",
2111 ui_delta.InMicroseconds(), 1, 20000, 100);
2112 break;
2113 case blink::WebInputEvent::TouchStart:
2114 UMA_HISTOGRAM_CUSTOM_COUNTS(
2115 "Event.Latency.Browser.Touch.UI",
2116 ui_delta.InMicroseconds(), 1, 20000, 100);
2117 break;
2118 default:
2119 NOTREACHED();
2120 break;
2121 }
2122 }
2123
2124 ui::LatencyInfo::LatencyComponent acked_component;
2125 if (latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT,
2109 0, 2126 0,
2110 &acked_component)) { 2127 &acked_component)) {
2111 DCHECK(acked_component.event_count == 1); 2128 DCHECK(acked_component.event_count == 1);
2112 base::TimeDelta acked_delta = 2129 base::TimeDelta acked_delta =
2113 acked_component.event_time - rwh_component.event_time; 2130 acked_component.event_time - rwh_component.event_time;
2114 UMA_HISTOGRAM_CUSTOM_COUNTS( 2131
2115 "Event.Latency.Browser.TouchAcked", 2132 switch (type) {
2116 acked_delta.InMicroseconds(), 2133 case blink::WebInputEvent::MouseWheel:
2117 1, 2134 UMA_HISTOGRAM_CUSTOM_COUNTS(
2118 1000000, 2135 "Event.Latency.Browser.Wheel.Acked",
2119 100); 2136 acked_delta.InMicroseconds(), 1, 1000000, 100);
2137 break;
2138 case blink::WebInputEvent::TouchStart:
2139 UMA_HISTOGRAM_CUSTOM_COUNTS(
2140 "Event.Latency.Browser.Touch.Acked",
2141 acked_delta.InMicroseconds(), 1, 1000000, 100);
2142 break;
2143 default:
2144 NOTREACHED();
2145 break;
2146 }
2120 } 2147 }
2121 } 2148 }
2122 2149
2123 void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { 2150 void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) {
2124 ui::LatencyInfo::LatencyComponent window_snapshot_component; 2151 ui::LatencyInfo::LatencyComponent window_snapshot_component;
2125 if (latency_info.FindLatency(ui::WINDOW_OLD_SNAPSHOT_FRAME_NUMBER_COMPONENT, 2152 if (latency_info.FindLatency(ui::WINDOW_OLD_SNAPSHOT_FRAME_NUMBER_COMPONENT,
2126 GetLatencyComponentId(), 2153 GetLatencyComponentId(),
2127 &window_snapshot_component)) { 2154 &window_snapshot_component)) {
2128 WindowOldSnapshotReachedScreen( 2155 WindowOldSnapshotReachedScreen(
2129 static_cast<int>(window_snapshot_component.sequence_number)); 2156 static_cast<int>(window_snapshot_component.sequence_number));
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
2399 } 2426 }
2400 #endif 2427 #endif
2401 2428
2402 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { 2429 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() {
2403 if (view_) 2430 if (view_)
2404 return view_->PreferredReadbackFormat(); 2431 return view_->PreferredReadbackFormat();
2405 return kN32_SkColorType; 2432 return kN32_SkColorType;
2406 } 2433 }
2407 2434
2408 } // namespace content 2435 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | ui/aura/gestures/gesture_recognizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698