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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 in_get_backing_store_(false), | 176 in_get_backing_store_(false), |
177 ignore_input_events_(false), | 177 ignore_input_events_(false), |
178 input_method_active_(false), | 178 input_method_active_(false), |
179 text_direction_updated_(false), | 179 text_direction_updated_(false), |
180 text_direction_(blink::WebTextDirectionLeftToRight), | 180 text_direction_(blink::WebTextDirectionLeftToRight), |
181 text_direction_canceled_(false), | 181 text_direction_canceled_(false), |
182 suppress_next_char_events_(false), | 182 suppress_next_char_events_(false), |
183 pending_mouse_lock_request_(false), | 183 pending_mouse_lock_request_(false), |
184 allow_privileged_mouse_lock_(false), | 184 allow_privileged_mouse_lock_(false), |
185 has_touch_handler_(false), | 185 has_touch_handler_(false), |
186 last_input_number_(static_cast<int64>(GetProcess()->GetID()) << 32), | |
187 subscribe_uniform_enabled_(false), | 186 subscribe_uniform_enabled_(false), |
188 next_browser_snapshot_id_(1), | 187 next_browser_snapshot_id_(1), |
189 weak_factory_(this) { | 188 weak_factory_(this) { |
190 CHECK(delegate_); | 189 CHECK(delegate_); |
191 if (routing_id_ == MSG_ROUTING_NONE) { | 190 if (routing_id_ == MSG_ROUTING_NONE) { |
192 routing_id_ = process_->GetNextRoutingID(); | 191 routing_id_ = process_->GetNextRoutingID(); |
193 surface_id_ = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( | 192 surface_id_ = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( |
194 process_->GetID(), | 193 process_->GetID(), |
195 routing_id_); | 194 routing_id_); |
196 } else { | 195 } else { |
(...skipping 14 matching lines...) Expand all Loading... |
211 g_routing_id_widget_map.Get().insert(std::make_pair( | 210 g_routing_id_widget_map.Get().insert(std::make_pair( |
212 RenderWidgetHostID(process->GetID(), routing_id_), this)); | 211 RenderWidgetHostID(process->GetID(), routing_id_), this)); |
213 CHECK(result.second) << "Inserting a duplicate item!"; | 212 CHECK(result.second) << "Inserting a duplicate item!"; |
214 process_->AddRoute(routing_id_, this); | 213 process_->AddRoute(routing_id_, this); |
215 | 214 |
216 // If we're initially visible, tell the process host that we're alive. | 215 // If we're initially visible, tell the process host that we're alive. |
217 // Otherwise we'll notify the process host when we are first shown. | 216 // Otherwise we'll notify the process host when we are first shown. |
218 if (!hidden) | 217 if (!hidden) |
219 process_->WidgetRestored(); | 218 process_->WidgetRestored(); |
220 | 219 |
| 220 latency_tracker_.Initialize(routing_id_, GetProcess()->GetID()); |
| 221 |
221 input_router_.reset(new InputRouterImpl( | 222 input_router_.reset(new InputRouterImpl( |
222 process_, this, this, routing_id_, GetInputRouterConfigForPlatform())); | 223 process_, this, this, routing_id_, GetInputRouterConfigForPlatform())); |
223 | 224 |
224 touch_emulator_.reset(); | 225 touch_emulator_.reset(); |
225 | 226 |
226 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 227 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
227 IsRenderView() ? RenderViewHost::From(this) : NULL); | 228 IsRenderView() ? RenderViewHost::From(this) : NULL); |
228 if (BrowserPluginGuest::IsGuest(rvh) || | 229 if (BrowserPluginGuest::IsGuest(rvh) || |
229 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 230 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
230 switches::kDisableHangMonitor)) { | 231 switches::kDisableHangMonitor)) { |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 | 879 |
879 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { | 880 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { |
880 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo()); | 881 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo()); |
881 } | 882 } |
882 | 883 |
883 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( | 884 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( |
884 const blink::WebMouseEvent& mouse_event, | 885 const blink::WebMouseEvent& mouse_event, |
885 const ui::LatencyInfo& ui_latency) { | 886 const ui::LatencyInfo& ui_latency) { |
886 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", | 887 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", |
887 "x", mouse_event.x, "y", mouse_event.y); | 888 "x", mouse_event.x, "y", mouse_event.y); |
888 ui::LatencyInfo::InputCoordinate logical_coordinate(mouse_event.x, | |
889 mouse_event.y); | |
890 | |
891 ui::LatencyInfo latency_info = CreateInputEventLatencyInfoIfNotExist( | |
892 &ui_latency, mouse_event.type, &logical_coordinate, 1); | |
893 | 889 |
894 for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) { | 890 for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) { |
895 if (mouse_event_callbacks_[i].Run(mouse_event)) | 891 if (mouse_event_callbacks_[i].Run(mouse_event)) |
896 return; | 892 return; |
897 } | 893 } |
898 | 894 |
899 if (IgnoreInputEvents()) | 895 if (IgnoreInputEvents()) |
900 return; | 896 return; |
901 | 897 |
902 if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) | 898 if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) |
903 return; | 899 return; |
904 | 900 |
905 input_router_->SendMouseEvent(MouseEventWithLatencyInfo(mouse_event, | 901 MouseEventWithLatencyInfo mouse_with_latency(mouse_event, ui_latency); |
906 latency_info)); | 902 latency_tracker_.OnInputEvent(mouse_event, &mouse_with_latency.latency); |
| 903 input_router_->SendMouseEvent(mouse_with_latency); |
907 | 904 |
908 // Pass mouse state to gpu service if the subscribe uniform | 905 // Pass mouse state to gpu service if the subscribe uniform |
909 // extension is enabled. | 906 // extension is enabled. |
910 // TODO(orglofch): Only pass mouse information if one of the GL Contexts | 907 // TODO(orglofch): Only pass mouse information if one of the GL Contexts |
911 // is subscribed to GL_MOUSE_POSITION_CHROMIUM | 908 // is subscribed to GL_MOUSE_POSITION_CHROMIUM |
912 if (subscribe_uniform_enabled_) { | 909 if (subscribe_uniform_enabled_) { |
913 gpu::ValueState state; | 910 gpu::ValueState state; |
914 state.int_value[0] = mouse_event.x; | 911 state.int_value[0] = mouse_event.x; |
915 state.int_value[1] = mouse_event.y; | 912 state.int_value[1] = mouse_event.y; |
916 GpuProcessHost::SendOnIO( | 913 GpuProcessHost::SendOnIO( |
(...skipping 10 matching lines...) Expand all Loading... |
927 void RenderWidgetHostImpl::ForwardWheelEvent( | 924 void RenderWidgetHostImpl::ForwardWheelEvent( |
928 const WebMouseWheelEvent& wheel_event) { | 925 const WebMouseWheelEvent& wheel_event) { |
929 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); | 926 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); |
930 } | 927 } |
931 | 928 |
932 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( | 929 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( |
933 const blink::WebMouseWheelEvent& wheel_event, | 930 const blink::WebMouseWheelEvent& wheel_event, |
934 const ui::LatencyInfo& ui_latency) { | 931 const ui::LatencyInfo& ui_latency) { |
935 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardWheelEvent"); | 932 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardWheelEvent"); |
936 | 933 |
937 ui::LatencyInfo::InputCoordinate logical_coordinate(wheel_event.x, | |
938 wheel_event.y); | |
939 | |
940 ui::LatencyInfo latency_info = CreateInputEventLatencyInfoIfNotExist( | |
941 &ui_latency, wheel_event.type, &logical_coordinate, 1); | |
942 | |
943 if (IgnoreInputEvents()) | 934 if (IgnoreInputEvents()) |
944 return; | 935 return; |
945 | 936 |
946 if (touch_emulator_ && touch_emulator_->HandleMouseWheelEvent(wheel_event)) | 937 if (touch_emulator_ && touch_emulator_->HandleMouseWheelEvent(wheel_event)) |
947 return; | 938 return; |
948 | 939 |
949 input_router_->SendWheelEvent(MouseWheelEventWithLatencyInfo(wheel_event, | 940 MouseWheelEventWithLatencyInfo wheel_with_latency(wheel_event, ui_latency); |
950 latency_info)); | 941 latency_tracker_.OnInputEvent(wheel_event, &wheel_with_latency.latency); |
| 942 input_router_->SendWheelEvent(wheel_with_latency); |
951 } | 943 } |
952 | 944 |
953 void RenderWidgetHostImpl::ForwardGestureEvent( | 945 void RenderWidgetHostImpl::ForwardGestureEvent( |
954 const blink::WebGestureEvent& gesture_event) { | 946 const blink::WebGestureEvent& gesture_event) { |
955 ForwardGestureEventWithLatencyInfo(gesture_event, ui::LatencyInfo()); | 947 ForwardGestureEventWithLatencyInfo(gesture_event, ui::LatencyInfo()); |
956 } | 948 } |
957 | 949 |
958 void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( | 950 void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( |
959 const blink::WebGestureEvent& gesture_event, | 951 const blink::WebGestureEvent& gesture_event, |
960 const ui::LatencyInfo& ui_latency) { | 952 const ui::LatencyInfo& ui_latency) { |
961 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardGestureEvent"); | 953 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardGestureEvent"); |
962 // Early out if necessary, prior to performing latency logic. | 954 // Early out if necessary, prior to performing latency logic. |
963 if (IgnoreInputEvents()) | 955 if (IgnoreInputEvents()) |
964 return; | 956 return; |
965 | 957 |
966 if (delegate_->PreHandleGestureEvent(gesture_event)) | 958 if (delegate_->PreHandleGestureEvent(gesture_event)) |
967 return; | 959 return; |
968 | 960 |
969 ui::LatencyInfo::InputCoordinate logical_coordinate(gesture_event.x, | 961 GestureEventWithLatencyInfo gesture_with_latency(gesture_event, ui_latency); |
970 gesture_event.y); | 962 latency_tracker_.OnInputEvent(gesture_event, &gesture_with_latency.latency); |
971 | |
972 ui::LatencyInfo latency_info = CreateInputEventLatencyInfoIfNotExist( | |
973 &ui_latency, gesture_event.type, &logical_coordinate, 1); | |
974 | |
975 if (gesture_event.type == blink::WebInputEvent::GestureScrollUpdate) { | |
976 latency_info.AddLatencyNumber( | |
977 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_RWH_COMPONENT, | |
978 GetLatencyComponentId(), | |
979 ++last_input_number_); | |
980 | |
981 // Make a copy of the INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT with a | |
982 // different name INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT. | |
983 // So we can track the latency specifically for scroll update events. | |
984 ui::LatencyInfo::LatencyComponent original_component; | |
985 if (latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, | |
986 0, | |
987 &original_component)) { | |
988 latency_info.AddLatencyNumberWithTimestamp( | |
989 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, | |
990 GetLatencyComponentId(), | |
991 original_component.sequence_number, | |
992 original_component.event_time, | |
993 original_component.event_count); | |
994 } | |
995 } | |
996 | |
997 GestureEventWithLatencyInfo gesture_with_latency(gesture_event, latency_info); | |
998 input_router_->SendGestureEvent(gesture_with_latency); | 963 input_router_->SendGestureEvent(gesture_with_latency); |
999 } | 964 } |
1000 | 965 |
1001 void RenderWidgetHostImpl::ForwardEmulatedTouchEvent( | 966 void RenderWidgetHostImpl::ForwardEmulatedTouchEvent( |
1002 const blink::WebTouchEvent& touch_event) { | 967 const blink::WebTouchEvent& touch_event) { |
1003 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardEmulatedTouchEvent"); | 968 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardEmulatedTouchEvent"); |
1004 | 969 |
1005 ui::LatencyInfo::InputCoordinate | 970 TouchEventWithLatencyInfo touch_with_latency(touch_event); |
1006 logical_coordinates[ui::LatencyInfo::kMaxInputCoordinates]; | 971 latency_tracker_.OnInputEvent(touch_event, &touch_with_latency.latency); |
1007 size_t logical_coordinates_size = | |
1008 std::min(arraysize(logical_coordinates), | |
1009 static_cast<size_t>(touch_event.touchesLength)); | |
1010 for (size_t i = 0; i < logical_coordinates_size; i++) { | |
1011 logical_coordinates[i] = ui::LatencyInfo::InputCoordinate( | |
1012 touch_event.touches[i].position.x, touch_event.touches[i].position.y); | |
1013 } | |
1014 | |
1015 ui::LatencyInfo latency_info = CreateInputEventLatencyInfoIfNotExist( | |
1016 NULL, touch_event.type, logical_coordinates, logical_coordinates_size); | |
1017 TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info); | |
1018 input_router_->SendTouchEvent(touch_with_latency); | 972 input_router_->SendTouchEvent(touch_with_latency); |
1019 } | 973 } |
1020 | 974 |
1021 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( | 975 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( |
1022 const blink::WebTouchEvent& touch_event, | 976 const blink::WebTouchEvent& touch_event, |
1023 const ui::LatencyInfo& ui_latency) { | 977 const ui::LatencyInfo& ui_latency) { |
1024 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent"); | 978 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent"); |
1025 | 979 |
1026 // Always forward TouchEvents for touch stream consistency. They will be | 980 // Always forward TouchEvents for touch stream consistency. They will be |
1027 // ignored if appropriate in FilterInputEvent(). | 981 // ignored if appropriate in FilterInputEvent(). |
1028 | 982 |
1029 ui::LatencyInfo::InputCoordinate | 983 TouchEventWithLatencyInfo touch_with_latency(touch_event, ui_latency); |
1030 logical_coordinates[ui::LatencyInfo::kMaxInputCoordinates]; | |
1031 size_t logical_coordinates_size = | |
1032 std::min(arraysize(logical_coordinates), | |
1033 static_cast<size_t>(touch_event.touchesLength)); | |
1034 for (size_t i = 0; i < logical_coordinates_size; i++) { | |
1035 logical_coordinates[i] = ui::LatencyInfo::InputCoordinate( | |
1036 touch_event.touches[i].position.x, touch_event.touches[i].position.y); | |
1037 } | |
1038 | |
1039 ui::LatencyInfo latency_info = CreateInputEventLatencyInfoIfNotExist( | |
1040 &ui_latency, | |
1041 touch_event.type, | |
1042 logical_coordinates, | |
1043 logical_coordinates_size); | |
1044 TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info); | |
1045 | |
1046 if (touch_emulator_ && | 984 if (touch_emulator_ && |
1047 touch_emulator_->HandleTouchEvent(touch_with_latency.event)) { | 985 touch_emulator_->HandleTouchEvent(touch_with_latency.event)) { |
1048 if (view_) { | 986 if (view_) { |
1049 view_->ProcessAckedTouchEvent( | 987 view_->ProcessAckedTouchEvent( |
1050 touch_with_latency, INPUT_EVENT_ACK_STATE_CONSUMED); | 988 touch_with_latency, INPUT_EVENT_ACK_STATE_CONSUMED); |
1051 } | 989 } |
1052 return; | 990 return; |
1053 } | 991 } |
1054 | 992 |
| 993 latency_tracker_.OnInputEvent(touch_event, &touch_with_latency.latency); |
1055 input_router_->SendTouchEvent(touch_with_latency); | 994 input_router_->SendTouchEvent(touch_with_latency); |
1056 } | 995 } |
1057 | 996 |
1058 void RenderWidgetHostImpl::ForwardKeyboardEvent( | 997 void RenderWidgetHostImpl::ForwardKeyboardEvent( |
1059 const NativeWebKeyboardEvent& key_event) { | 998 const NativeWebKeyboardEvent& key_event) { |
1060 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardKeyboardEvent"); | 999 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardKeyboardEvent"); |
1061 if (IgnoreInputEvents()) | 1000 if (IgnoreInputEvents()) |
1062 return; | 1001 return; |
1063 | 1002 |
1064 if (!process_->HasConnection()) | 1003 if (!process_->HasConnection()) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 if (delegate_->PreHandleKeyboardEvent(key_event, &is_shortcut)) | 1051 if (delegate_->PreHandleKeyboardEvent(key_event, &is_shortcut)) |
1113 return; | 1052 return; |
1114 | 1053 |
1115 if (key_event.type == WebKeyboardEvent::RawKeyDown) | 1054 if (key_event.type == WebKeyboardEvent::RawKeyDown) |
1116 suppress_next_char_events_ = false; | 1055 suppress_next_char_events_ = false; |
1117 } | 1056 } |
1118 | 1057 |
1119 if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event)) | 1058 if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event)) |
1120 return; | 1059 return; |
1121 | 1060 |
1122 input_router_->SendKeyboardEvent( | 1061 ui::LatencyInfo latency; |
1123 key_event, | 1062 latency_tracker_.OnInputEvent(key_event, &latency); |
1124 CreateInputEventLatencyInfoIfNotExist(NULL, key_event.type, NULL, 0), | 1063 input_router_->SendKeyboardEvent(key_event, latency, is_shortcut); |
1125 is_shortcut); | |
1126 } | 1064 } |
1127 | 1065 |
1128 void RenderWidgetHostImpl::QueueSyntheticGesture( | 1066 void RenderWidgetHostImpl::QueueSyntheticGesture( |
1129 scoped_ptr<SyntheticGesture> synthetic_gesture, | 1067 scoped_ptr<SyntheticGesture> synthetic_gesture, |
1130 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { | 1068 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { |
1131 if (!synthetic_gesture_controller_ && view_) { | 1069 if (!synthetic_gesture_controller_ && view_) { |
1132 synthetic_gesture_controller_.reset( | 1070 synthetic_gesture_controller_.reset( |
1133 new SyntheticGestureController( | 1071 new SyntheticGestureController( |
1134 view_->CreateSyntheticGestureTarget().Pass())); | 1072 view_->CreateSyntheticGestureTarget().Pass())); |
1135 } | 1073 } |
(...skipping 12 matching lines...) Expand all Loading... |
1148 void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) { | 1086 void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) { |
1149 Send(new ViewMsg_ShowContextMenu( | 1087 Send(new ViewMsg_ShowContextMenu( |
1150 GetRoutingID(), ui::MENU_SOURCE_MOUSE, point)); | 1088 GetRoutingID(), ui::MENU_SOURCE_MOUSE, point)); |
1151 } | 1089 } |
1152 | 1090 |
1153 void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) { | 1091 void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) { |
1154 Send(new InputMsg_CursorVisibilityChange(GetRoutingID(), is_visible)); | 1092 Send(new InputMsg_CursorVisibilityChange(GetRoutingID(), is_visible)); |
1155 } | 1093 } |
1156 | 1094 |
1157 int64 RenderWidgetHostImpl::GetLatencyComponentId() const { | 1095 int64 RenderWidgetHostImpl::GetLatencyComponentId() const { |
1158 return GetRoutingID() | (static_cast<int64>(GetProcess()->GetID()) << 32); | 1096 return latency_tracker_.latency_component_id(); |
1159 } | 1097 } |
1160 | 1098 |
1161 // static | 1099 // static |
1162 void RenderWidgetHostImpl::DisableResizeAckCheckForTesting() { | 1100 void RenderWidgetHostImpl::DisableResizeAckCheckForTesting() { |
1163 g_check_for_pending_resize_ack = false; | 1101 g_check_for_pending_resize_ack = false; |
1164 } | 1102 } |
1165 | 1103 |
1166 ui::LatencyInfo RenderWidgetHostImpl::CreateInputEventLatencyInfoIfNotExist( | |
1167 const ui::LatencyInfo* original, | |
1168 WebInputEvent::Type type, | |
1169 const ui::LatencyInfo::InputCoordinate* logical_coordinates, | |
1170 size_t logical_coordinates_size) { | |
1171 ui::LatencyInfo info; | |
1172 if (original) | |
1173 info = *original; | |
1174 // In Aura, gesture event will already carry its original touch event's | |
1175 // INPUT_EVENT_LATENCY_RWH_COMPONENT. | |
1176 if (!info.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, | |
1177 GetLatencyComponentId(), | |
1178 NULL)) { | |
1179 info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, | |
1180 GetLatencyComponentId(), | |
1181 ++last_input_number_); | |
1182 info.TraceEventType(WebInputEventTraits::GetName(type)); | |
1183 | |
1184 // Convert logical coordinates to physical coordinates, based on the | |
1185 // device scale factor. | |
1186 float device_scale_factor = | |
1187 screen_info_ ? screen_info_->deviceScaleFactor : 1; | |
1188 DCHECK(logical_coordinates_size <= ui::LatencyInfo::kMaxInputCoordinates); | |
1189 info.input_coordinates_size = logical_coordinates_size; | |
1190 for (size_t i = 0; i < info.input_coordinates_size; i++) { | |
1191 info.input_coordinates[i].x = | |
1192 logical_coordinates[i].x * device_scale_factor; | |
1193 info.input_coordinates[i].y = | |
1194 logical_coordinates[i].y * device_scale_factor; | |
1195 } | |
1196 } | |
1197 | |
1198 return info; | |
1199 } | |
1200 | |
1201 | |
1202 void RenderWidgetHostImpl::AddKeyPressEventCallback( | 1104 void RenderWidgetHostImpl::AddKeyPressEventCallback( |
1203 const KeyPressEventCallback& callback) { | 1105 const KeyPressEventCallback& callback) { |
1204 key_press_event_callbacks_.push_back(callback); | 1106 key_press_event_callbacks_.push_back(callback); |
1205 } | 1107 } |
1206 | 1108 |
1207 void RenderWidgetHostImpl::RemoveKeyPressEventCallback( | 1109 void RenderWidgetHostImpl::RemoveKeyPressEventCallback( |
1208 const KeyPressEventCallback& callback) { | 1110 const KeyPressEventCallback& callback) { |
1209 for (size_t i = 0; i < key_press_event_callbacks_.size(); ++i) { | 1111 for (size_t i = 0; i < key_press_event_callbacks_.size(); ++i) { |
1210 if (key_press_event_callbacks_[i].Equals(callback)) { | 1112 if (key_press_event_callbacks_[i].Equals(callback)) { |
1211 key_press_event_callbacks_.erase( | 1113 key_press_event_callbacks_.erase( |
(...skipping 17 matching lines...) Expand all Loading... |
1229 } | 1131 } |
1230 } | 1132 } |
1231 } | 1133 } |
1232 | 1134 |
1233 void RenderWidgetHostImpl::GetWebScreenInfo(blink::WebScreenInfo* result) { | 1135 void RenderWidgetHostImpl::GetWebScreenInfo(blink::WebScreenInfo* result) { |
1234 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::GetWebScreenInfo"); | 1136 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::GetWebScreenInfo"); |
1235 if (view_) | 1137 if (view_) |
1236 view_->GetScreenInfo(result); | 1138 view_->GetScreenInfo(result); |
1237 else | 1139 else |
1238 RenderWidgetHostViewBase::GetDefaultScreenInfo(result); | 1140 RenderWidgetHostViewBase::GetDefaultScreenInfo(result); |
| 1141 latency_tracker_.set_device_scale_factor(result->deviceScaleFactor); |
1239 screen_info_out_of_date_ = false; | 1142 screen_info_out_of_date_ = false; |
1240 } | 1143 } |
1241 | 1144 |
1242 const NativeWebKeyboardEvent* | 1145 const NativeWebKeyboardEvent* |
1243 RenderWidgetHostImpl::GetLastKeyboardEvent() const { | 1146 RenderWidgetHostImpl::GetLastKeyboardEvent() const { |
1244 return input_router_->GetLastKeyboardEvent(); | 1147 return input_router_->GetLastKeyboardEvent(); |
1245 } | 1148 } |
1246 | 1149 |
1247 void RenderWidgetHostImpl::NotifyScreenInfoChanged() { | 1150 void RenderWidgetHostImpl::NotifyScreenInfoChanged() { |
1248 // The resize message (which may not happen immediately) will carry with it | 1151 // The resize message (which may not happen immediately) will carry with it |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 TRACE_DISABLED_BY_DEFAULT("OnSwapCompositorFrame")); | 1437 TRACE_DISABLED_BY_DEFAULT("OnSwapCompositorFrame")); |
1535 ViewHostMsg_SwapCompositorFrame::Param param; | 1438 ViewHostMsg_SwapCompositorFrame::Param param; |
1536 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) | 1439 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) |
1537 return false; | 1440 return false; |
1538 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 1441 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); |
1539 uint32 output_surface_id = param.a; | 1442 uint32 output_surface_id = param.a; |
1540 param.b.AssignTo(frame.get()); | 1443 param.b.AssignTo(frame.get()); |
1541 std::vector<IPC::Message> messages_to_deliver_with_frame; | 1444 std::vector<IPC::Message> messages_to_deliver_with_frame; |
1542 messages_to_deliver_with_frame.swap(param.c); | 1445 messages_to_deliver_with_frame.swap(param.c); |
1543 | 1446 |
1544 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) | 1447 latency_tracker_.OnSwapCompositorFrame(&frame->metadata.latency_info); |
1545 AddLatencyInfoComponentIds(&frame->metadata.latency_info[i]); | |
1546 | 1448 |
1547 input_router_->OnViewUpdated( | 1449 input_router_->OnViewUpdated( |
1548 GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata)); | 1450 GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata)); |
1549 | 1451 |
1550 if (view_) { | 1452 if (view_) { |
1551 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); | 1453 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); |
1552 view_->DidReceiveRendererFrame(); | 1454 view_->DidReceiveRendererFrame(); |
1553 } else { | 1455 } else { |
1554 cc::CompositorFrameAck ack; | 1456 cc::CompositorFrameAck ack; |
1555 if (frame->gl_frame_data) { | 1457 if (frame->gl_frame_data) { |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1927 | 1829 |
1928 // WARNING: This RenderWidgetHostImpl can be deallocated at this point | 1830 // WARNING: This RenderWidgetHostImpl can be deallocated at this point |
1929 // (i.e. in the case of Ctrl+W, where the call to | 1831 // (i.e. in the case of Ctrl+W, where the call to |
1930 // HandleKeyboardEvent destroys this RenderWidgetHostImpl). | 1832 // HandleKeyboardEvent destroys this RenderWidgetHostImpl). |
1931 } | 1833 } |
1932 } | 1834 } |
1933 | 1835 |
1934 void RenderWidgetHostImpl::OnWheelEventAck( | 1836 void RenderWidgetHostImpl::OnWheelEventAck( |
1935 const MouseWheelEventWithLatencyInfo& wheel_event, | 1837 const MouseWheelEventWithLatencyInfo& wheel_event, |
1936 InputEventAckState ack_result) { | 1838 InputEventAckState ack_result) { |
1937 ui::LatencyInfo latency = wheel_event.latency; | 1839 latency_tracker_.OnInputEventAck(wheel_event.event, &wheel_event.latency); |
1938 latency.AddLatencyNumber( | |
1939 ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0); | |
1940 if (!wheel_event.latency.FindLatency( | |
1941 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { | |
1942 // MouseWheelEvent latency ends when it is acked but does not cause any | |
1943 // rendering scheduled. | |
1944 latency.AddLatencyNumber( | |
1945 ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, 0); | |
1946 } | |
1947 ComputeInputLatencyHistograms(blink::WebInputEvent::MouseWheel, latency); | |
1948 | 1840 |
1949 if (!is_hidden() && view_) { | 1841 if (!is_hidden() && view_) { |
1950 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED && | 1842 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED && |
1951 delegate_->HandleWheelEvent(wheel_event.event)) { | 1843 delegate_->HandleWheelEvent(wheel_event.event)) { |
1952 ack_result = INPUT_EVENT_ACK_STATE_CONSUMED; | 1844 ack_result = INPUT_EVENT_ACK_STATE_CONSUMED; |
1953 } | 1845 } |
1954 view_->WheelEventAck(wheel_event.event, ack_result); | 1846 view_->WheelEventAck(wheel_event.event, ack_result); |
1955 } | 1847 } |
1956 } | 1848 } |
1957 | 1849 |
1958 void RenderWidgetHostImpl::OnGestureEventAck( | 1850 void RenderWidgetHostImpl::OnGestureEventAck( |
1959 const GestureEventWithLatencyInfo& event, | 1851 const GestureEventWithLatencyInfo& event, |
1960 InputEventAckState ack_result) { | 1852 InputEventAckState ack_result) { |
1961 if (!event.latency.FindLatency( | 1853 latency_tracker_.OnInputEventAck(event.event, &event.latency); |
1962 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { | |
1963 // GestureEvent latency ends when it is acked but does not cause any | |
1964 // rendering scheduled. | |
1965 ui::LatencyInfo latency = event.latency; | |
1966 latency.AddLatencyNumber( | |
1967 ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT, 0 ,0); | |
1968 } | |
1969 | 1854 |
1970 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED) { | 1855 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED) { |
1971 if (delegate_->HandleGestureEvent(event.event)) | 1856 if (delegate_->HandleGestureEvent(event.event)) |
1972 ack_result = INPUT_EVENT_ACK_STATE_CONSUMED; | 1857 ack_result = INPUT_EVENT_ACK_STATE_CONSUMED; |
1973 } | 1858 } |
1974 | 1859 |
1975 if (view_) | 1860 if (view_) |
1976 view_->GestureEventAck(event.event, ack_result); | 1861 view_->GestureEventAck(event.event, ack_result); |
1977 } | 1862 } |
1978 | 1863 |
1979 void RenderWidgetHostImpl::OnTouchEventAck( | 1864 void RenderWidgetHostImpl::OnTouchEventAck( |
1980 const TouchEventWithLatencyInfo& event, | 1865 const TouchEventWithLatencyInfo& event, |
1981 InputEventAckState ack_result) { | 1866 InputEventAckState ack_result) { |
1982 TouchEventWithLatencyInfo touch_event = event; | 1867 latency_tracker_.OnInputEventAck(event.event, &event.latency); |
1983 touch_event.latency.AddLatencyNumber( | |
1984 ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0); | |
1985 // TouchEvent latency ends at ack if it didn't cause any rendering. | |
1986 if (!touch_event.latency.FindLatency( | |
1987 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { | |
1988 touch_event.latency.AddLatencyNumber( | |
1989 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0); | |
1990 } | |
1991 ComputeInputLatencyHistograms( | |
1992 blink::WebInputEvent::TouchTypeFirst, touch_event.latency); | |
1993 | 1868 |
1994 if (touch_emulator_ && | 1869 if (touch_emulator_ && |
1995 touch_emulator_->HandleTouchEventAck(event.event, ack_result)) { | 1870 touch_emulator_->HandleTouchEventAck(event.event, ack_result)) { |
1996 return; | 1871 return; |
1997 } | 1872 } |
1998 | 1873 |
1999 if (view_) | 1874 if (view_) |
2000 view_->ProcessAckedTouchEvent(touch_event, ack_result); | 1875 view_->ProcessAckedTouchEvent(event, ack_result); |
2001 } | 1876 } |
2002 | 1877 |
2003 void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { | 1878 void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { |
2004 if (type == BAD_ACK_MESSAGE) { | 1879 if (type == BAD_ACK_MESSAGE) { |
2005 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH2")); | 1880 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH2")); |
2006 process_->ReceivedBadMessage(); | 1881 process_->ReceivedBadMessage(); |
2007 } else if (type == UNEXPECTED_EVENT_TYPE) { | 1882 } else if (type == UNEXPECTED_EVENT_TYPE) { |
2008 suppress_next_char_events_ = false; | 1883 suppress_next_char_events_ = false; |
2009 } | 1884 } |
2010 } | 1885 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2113 if (!auto_resize_enabled_) | 1988 if (!auto_resize_enabled_) |
2114 return; | 1989 return; |
2115 | 1990 |
2116 OnRenderAutoResized(new_size); | 1991 OnRenderAutoResized(new_size); |
2117 } | 1992 } |
2118 | 1993 |
2119 void RenderWidgetHostImpl::DetachDelegate() { | 1994 void RenderWidgetHostImpl::DetachDelegate() { |
2120 delegate_ = NULL; | 1995 delegate_ = NULL; |
2121 } | 1996 } |
2122 | 1997 |
2123 void RenderWidgetHostImpl::ComputeInputLatencyHistograms( | |
2124 blink::WebInputEvent::Type type, | |
2125 const ui::LatencyInfo& latency_info) const { | |
2126 ui::LatencyInfo::LatencyComponent rwh_component; | |
2127 if (!latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, | |
2128 GetLatencyComponentId(), | |
2129 &rwh_component)) | |
2130 return; | |
2131 DCHECK_EQ(rwh_component.event_count, 1u); | |
2132 | |
2133 ui::LatencyInfo::LatencyComponent ui_component; | |
2134 if (latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, | |
2135 0, | |
2136 &ui_component)) { | |
2137 DCHECK_EQ(ui_component.event_count, 1u); | |
2138 base::TimeDelta ui_delta = | |
2139 rwh_component.event_time - ui_component.event_time; | |
2140 switch (type) { | |
2141 case blink::WebInputEvent::MouseWheel: | |
2142 UMA_HISTOGRAM_CUSTOM_COUNTS( | |
2143 "Event.Latency.Browser.WheelUI", | |
2144 ui_delta.InMicroseconds(), 1, 20000, 100); | |
2145 break; | |
2146 case blink::WebInputEvent::TouchTypeFirst: | |
2147 UMA_HISTOGRAM_CUSTOM_COUNTS( | |
2148 "Event.Latency.Browser.TouchUI", | |
2149 ui_delta.InMicroseconds(), 1, 20000, 100); | |
2150 break; | |
2151 default: | |
2152 NOTREACHED(); | |
2153 break; | |
2154 } | |
2155 } | |
2156 | |
2157 ui::LatencyInfo::LatencyComponent acked_component; | |
2158 if (latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, | |
2159 0, | |
2160 &acked_component)) { | |
2161 DCHECK_EQ(acked_component.event_count, 1u); | |
2162 base::TimeDelta acked_delta = | |
2163 acked_component.event_time - rwh_component.event_time; | |
2164 switch (type) { | |
2165 case blink::WebInputEvent::MouseWheel: | |
2166 UMA_HISTOGRAM_CUSTOM_COUNTS( | |
2167 "Event.Latency.Browser.WheelAcked", | |
2168 acked_delta.InMicroseconds(), 1, 1000000, 100); | |
2169 break; | |
2170 case blink::WebInputEvent::TouchTypeFirst: | |
2171 UMA_HISTOGRAM_CUSTOM_COUNTS( | |
2172 "Event.Latency.Browser.TouchAcked", | |
2173 acked_delta.InMicroseconds(), 1, 1000000, 100); | |
2174 break; | |
2175 default: | |
2176 NOTREACHED(); | |
2177 break; | |
2178 } | |
2179 } | |
2180 } | |
2181 | |
2182 void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { | 1998 void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { |
2183 ui::LatencyInfo::LatencyComponent window_snapshot_component; | 1999 ui::LatencyInfo::LatencyComponent window_snapshot_component; |
2184 if (latency_info.FindLatency(ui::WINDOW_OLD_SNAPSHOT_FRAME_NUMBER_COMPONENT, | 2000 if (latency_info.FindLatency(ui::WINDOW_OLD_SNAPSHOT_FRAME_NUMBER_COMPONENT, |
2185 GetLatencyComponentId(), | 2001 GetLatencyComponentId(), |
2186 &window_snapshot_component)) { | 2002 &window_snapshot_component)) { |
2187 WindowOldSnapshotReachedScreen( | 2003 WindowOldSnapshotReachedScreen( |
2188 static_cast<int>(window_snapshot_component.sequence_number)); | 2004 static_cast<int>(window_snapshot_component.sequence_number)); |
2189 } | 2005 } |
2190 if (latency_info.FindLatency(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, | 2006 if (latency_info.FindLatency(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, |
2191 GetLatencyComponentId(), | 2007 GetLatencyComponentId(), |
2192 &window_snapshot_component)) { | 2008 &window_snapshot_component)) { |
2193 int sequence_number = static_cast<int>( | 2009 int sequence_number = static_cast<int>( |
2194 window_snapshot_component.sequence_number); | 2010 window_snapshot_component.sequence_number); |
2195 #if defined(OS_MACOSX) | 2011 #if defined(OS_MACOSX) |
2196 // On Mac, when using CoreAnmation, there is a delay between when content | 2012 // On Mac, when using CoreAnmation, there is a delay between when content |
2197 // is drawn to the screen, and when the snapshot will actually pick up | 2013 // is drawn to the screen, and when the snapshot will actually pick up |
2198 // that content. Insert a manual delay of 1/6th of a second (to simulate | 2014 // that content. Insert a manual delay of 1/6th of a second (to simulate |
2199 // 10 frames at 60 fps) before actually taking the snapshot. | 2015 // 10 frames at 60 fps) before actually taking the snapshot. |
2200 base::MessageLoop::current()->PostDelayedTask( | 2016 base::MessageLoop::current()->PostDelayedTask( |
2201 FROM_HERE, | 2017 FROM_HERE, |
2202 base::Bind(&RenderWidgetHostImpl::WindowSnapshotReachedScreen, | 2018 base::Bind(&RenderWidgetHostImpl::WindowSnapshotReachedScreen, |
2203 weak_factory_.GetWeakPtr(), | 2019 weak_factory_.GetWeakPtr(), |
2204 sequence_number), | 2020 sequence_number), |
2205 base::TimeDelta::FromSecondsD(1. / 6)); | 2021 base::TimeDelta::FromSecondsD(1. / 6)); |
2206 #else | 2022 #else |
2207 WindowSnapshotReachedScreen(sequence_number); | 2023 WindowSnapshotReachedScreen(sequence_number); |
2208 #endif | 2024 #endif |
2209 } | 2025 } |
2210 | 2026 |
2211 ui::LatencyInfo::LatencyComponent swap_component; | 2027 latency_tracker_.OnFrameSwapped(latency_info); |
2212 if (!latency_info.FindLatency( | |
2213 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, | |
2214 0, | |
2215 &swap_component)) { | |
2216 return; | |
2217 } | |
2218 ui::LatencyInfo::LatencyComponent tab_switch_component; | |
2219 if (latency_info.FindLatency(ui::TAB_SHOW_COMPONENT, | |
2220 GetLatencyComponentId(), | |
2221 &tab_switch_component)) { | |
2222 base::TimeDelta delta = | |
2223 swap_component.event_time - tab_switch_component.event_time; | |
2224 for (size_t i = 0; i < tab_switch_component.event_count; i++) { | |
2225 UMA_HISTOGRAM_TIMES("MPArch.RWH_TabSwitchPaintDuration", delta); | |
2226 } | |
2227 } | |
2228 | |
2229 ui::LatencyInfo::LatencyComponent rwh_component; | |
2230 if (!latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, | |
2231 GetLatencyComponentId(), | |
2232 &rwh_component)) { | |
2233 return; | |
2234 } | |
2235 | |
2236 ui::LatencyInfo::LatencyComponent original_component; | |
2237 if (latency_info.FindLatency( | |
2238 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, | |
2239 GetLatencyComponentId(), | |
2240 &original_component)) { | |
2241 // This UMA metric tracks the time from when the original touch event is | |
2242 // created (averaged if there are multiple) to when the scroll gesture | |
2243 // results in final frame swap. | |
2244 base::TimeDelta delta = | |
2245 swap_component.event_time - original_component.event_time; | |
2246 for (size_t i = 0; i < original_component.event_count; i++) { | |
2247 UMA_HISTOGRAM_CUSTOM_COUNTS( | |
2248 "Event.Latency.TouchToScrollUpdateSwap", | |
2249 delta.InMicroseconds(), | |
2250 1, | |
2251 1000000, | |
2252 100); | |
2253 } | |
2254 } | |
2255 } | 2028 } |
2256 | 2029 |
2257 void RenderWidgetHostImpl::DidReceiveRendererFrame() { | 2030 void RenderWidgetHostImpl::DidReceiveRendererFrame() { |
2258 view_->DidReceiveRendererFrame(); | 2031 view_->DidReceiveRendererFrame(); |
2259 } | 2032 } |
2260 | 2033 |
2261 void RenderWidgetHostImpl::WindowSnapshotAsyncCallback( | 2034 void RenderWidgetHostImpl::WindowSnapshotAsyncCallback( |
2262 int routing_id, | 2035 int routing_id, |
2263 int snapshot_id, | 2036 int snapshot_id, |
2264 gfx::Size snapshot_size, | 2037 gfx::Size snapshot_size, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2380 continue; | 2153 continue; |
2381 } | 2154 } |
2382 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); | 2155 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); |
2383 if (rwhi_set.insert(rwhi).second) | 2156 if (rwhi_set.insert(rwhi).second) |
2384 rwhi->FrameSwapped(latency_info[i]); | 2157 rwhi->FrameSwapped(latency_info[i]); |
2385 } | 2158 } |
2386 } | 2159 } |
2387 } | 2160 } |
2388 } | 2161 } |
2389 | 2162 |
2390 void RenderWidgetHostImpl::AddLatencyInfoComponentIds( | |
2391 ui::LatencyInfo* latency_info) { | |
2392 ui::LatencyInfo::LatencyMap new_components; | |
2393 ui::LatencyInfo::LatencyMap::iterator lc = | |
2394 latency_info->latency_components.begin(); | |
2395 while (lc != latency_info->latency_components.end()) { | |
2396 ui::LatencyComponentType component_type = lc->first.first; | |
2397 if (component_type == ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT || | |
2398 component_type == ui::WINDOW_OLD_SNAPSHOT_FRAME_NUMBER_COMPONENT) { | |
2399 // Generate a new component entry with the correct component ID | |
2400 ui::LatencyInfo::LatencyMap::key_type key = | |
2401 std::make_pair(component_type, GetLatencyComponentId()); | |
2402 new_components[key] = lc->second; | |
2403 | |
2404 // Remove the old entry | |
2405 latency_info->latency_components.erase(lc++); | |
2406 } else { | |
2407 ++lc; | |
2408 } | |
2409 } | |
2410 | |
2411 // Add newly generated components into the latency info | |
2412 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { | |
2413 latency_info->latency_components[lc->first] = lc->second; | |
2414 } | |
2415 } | |
2416 | |
2417 BrowserAccessibilityManager* | 2163 BrowserAccessibilityManager* |
2418 RenderWidgetHostImpl::GetRootBrowserAccessibilityManager() { | 2164 RenderWidgetHostImpl::GetRootBrowserAccessibilityManager() { |
2419 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; | 2165 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; |
2420 } | 2166 } |
2421 | 2167 |
2422 BrowserAccessibilityManager* | 2168 BrowserAccessibilityManager* |
2423 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2169 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { |
2424 return delegate_ ? | 2170 return delegate_ ? |
2425 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; | 2171 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; |
2426 } | 2172 } |
2427 | 2173 |
2428 #if defined(OS_WIN) | 2174 #if defined(OS_WIN) |
2429 gfx::NativeViewAccessible | 2175 gfx::NativeViewAccessible |
2430 RenderWidgetHostImpl::GetParentNativeViewAccessible() { | 2176 RenderWidgetHostImpl::GetParentNativeViewAccessible() { |
2431 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; | 2177 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; |
2432 } | 2178 } |
2433 #endif | 2179 #endif |
2434 | 2180 |
2435 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2181 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2436 if (view_) | 2182 if (view_) |
2437 return view_->PreferredReadbackFormat(); | 2183 return view_->PreferredReadbackFormat(); |
2438 return kN32_SkColorType; | 2184 return kN32_SkColorType; |
2439 } | 2185 } |
2440 | 2186 |
2441 } // namespace content | 2187 } // namespace content |
OLD | NEW |