OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 Loading... | |
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 Loading... | |
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 = CreateInputEventLatencyInfoIfNotExist( |
1002 CreateRWHLatencyInfoIfNotExist(&ui_latency, | 1002 &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); |
1013 } | 1013 } |
1014 return; | 1014 return; |
1015 } | 1015 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 Loading... | |
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 Loading... | |
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("Wheel", 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 Loading... | |
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("Touch", touch_event.latency); |
1952 | 1955 |
1953 if (touch_emulator_ && | 1956 if (touch_emulator_ && |
1954 touch_emulator_->HandleTouchEventAck(event.event, ack_result)) { | 1957 touch_emulator_->HandleTouchEventAck(event.event, ack_result)) { |
1955 return; | 1958 return; |
1956 } | 1959 } |
1957 | 1960 |
1958 if (view_) | 1961 if (view_) |
1959 view_->ProcessAckedTouchEvent(touch_event, ack_result); | 1962 view_->ProcessAckedTouchEvent(touch_event, ack_result); |
1960 } | 1963 } |
1961 | 1964 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2072 if (!should_auto_resize_) | 2075 if (!should_auto_resize_) |
2073 return; | 2076 return; |
2074 | 2077 |
2075 OnRenderAutoResized(new_size); | 2078 OnRenderAutoResized(new_size); |
2076 } | 2079 } |
2077 | 2080 |
2078 void RenderWidgetHostImpl::DetachDelegate() { | 2081 void RenderWidgetHostImpl::DetachDelegate() { |
2079 delegate_ = NULL; | 2082 delegate_ = NULL; |
2080 } | 2083 } |
2081 | 2084 |
2082 void RenderWidgetHostImpl::ComputeTouchLatency( | 2085 void RenderWidgetHostImpl::ComputeInputLatencyHistograms( |
2083 const ui::LatencyInfo& latency_info) { | 2086 const char* type, |
jar (doing other things)
2014/11/01 17:54:30
If this is latency sensitive.... which I'm guessin
| |
2084 ui::LatencyInfo::LatencyComponent ui_component; | 2087 const ui::LatencyInfo& latency_info) const { |
2088 // Note that it is necessary to update the histograms XML file any time that | |
2089 // new event types are added. The only event types currently supported are | |
2090 // Touch and Wheel. | |
2091 DCHECK(type == std::string("Touch") || type == std::string("Wheel")); | |
2092 | |
2085 ui::LatencyInfo::LatencyComponent rwh_component; | 2093 ui::LatencyInfo::LatencyComponent rwh_component; |
2086 ui::LatencyInfo::LatencyComponent acked_component; | 2094 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(), | 2095 GetLatencyComponentId(), |
2093 &rwh_component)) | 2096 &rwh_component)) |
2094 return; | 2097 return; |
2098 DCHECK_EQ(rwh_component.event_count, 1u); | |
2095 | 2099 |
2096 DCHECK(ui_component.event_count == 1); | 2100 ui::LatencyInfo::LatencyComponent ui_component; |
2097 DCHECK(rwh_component.event_count == 1); | 2101 if (latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, |
2102 0, | |
jar (doing other things)
2014/11/01 17:54:30
nit: undent 1 space
| |
2103 &ui_component)) { | |
2104 DCHECK_EQ(ui_component.event_count, 1u); | |
2098 | 2105 |
2099 base::TimeDelta ui_delta = | 2106 base::TimeDelta ui_delta = |
2100 rwh_component.event_time - ui_component.event_time; | 2107 rwh_component.event_time - ui_component.event_time; |
2101 UMA_HISTOGRAM_CUSTOM_COUNTS( | 2108 base::HistogramBase* counter_for_type = base::Histogram::FactoryGet( |
2102 "Event.Latency.Browser.TouchUI", | 2109 base::StringPrintf("Event.Latency.Browser.%sUI", type), |
jar (doing other things)
2014/11/01 17:54:30
nit: I'd also expect the repeated use of StringPri
| |
2103 ui_delta.InMicroseconds(), | 2110 1, |
2104 1, | 2111 20000, |
2105 20000, | 2112 100, |
2106 100); | 2113 base::HistogramBase::kUmaTargetedHistogramFlag); |
2114 counter_for_type->Add(ui_delta.InMicroseconds()); | |
2115 } | |
2107 | 2116 |
2108 if (latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, | 2117 ui::LatencyInfo::LatencyComponent acked_component; |
2118 if (latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, | |
2109 0, | 2119 0, |
2110 &acked_component)) { | 2120 &acked_component)) { |
2111 DCHECK(acked_component.event_count == 1); | 2121 DCHECK_EQ(acked_component.event_count, 1u); |
2112 base::TimeDelta acked_delta = | 2122 base::TimeDelta acked_delta = |
2113 acked_component.event_time - rwh_component.event_time; | 2123 acked_component.event_time - rwh_component.event_time; |
2114 UMA_HISTOGRAM_CUSTOM_COUNTS( | 2124 base::HistogramBase* counter_for_type = base::Histogram::FactoryGet( |
2115 "Event.Latency.Browser.TouchAcked", | 2125 base::StringPrintf("Event.Latency.Browser.%sAcked", type), |
2116 acked_delta.InMicroseconds(), | |
2117 1, | 2126 1, |
2118 1000000, | 2127 1000000, |
2119 100); | 2128 100, |
2129 base::HistogramBase::kUmaTargetedHistogramFlag); | |
2130 counter_for_type->Add(acked_delta.InMicroseconds()); | |
2120 } | 2131 } |
2121 } | 2132 } |
2122 | 2133 |
2123 void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { | 2134 void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { |
2124 ui::LatencyInfo::LatencyComponent window_snapshot_component; | 2135 ui::LatencyInfo::LatencyComponent window_snapshot_component; |
2125 if (latency_info.FindLatency(ui::WINDOW_OLD_SNAPSHOT_FRAME_NUMBER_COMPONENT, | 2136 if (latency_info.FindLatency(ui::WINDOW_OLD_SNAPSHOT_FRAME_NUMBER_COMPONENT, |
2126 GetLatencyComponentId(), | 2137 GetLatencyComponentId(), |
2127 &window_snapshot_component)) { | 2138 &window_snapshot_component)) { |
2128 WindowOldSnapshotReachedScreen( | 2139 WindowOldSnapshotReachedScreen( |
2129 static_cast<int>(window_snapshot_component.sequence_number)); | 2140 static_cast<int>(window_snapshot_component.sequence_number)); |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2399 } | 2410 } |
2400 #endif | 2411 #endif |
2401 | 2412 |
2402 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2413 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2403 if (view_) | 2414 if (view_) |
2404 return view_->PreferredReadbackFormat(); | 2415 return view_->PreferredReadbackFormat(); |
2405 return kN32_SkColorType; | 2416 return kN32_SkColorType; |
2406 } | 2417 } |
2407 | 2418 |
2408 } // namespace content | 2419 } // namespace content |
OLD | NEW |