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 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 g_routing_id_widget_map.Get().insert(std::make_pair( | 220 g_routing_id_widget_map.Get().insert(std::make_pair( |
221 RenderWidgetHostID(process->GetID(), routing_id_), this)); | 221 RenderWidgetHostID(process->GetID(), routing_id_), this)); |
222 CHECK(result.second) << "Inserting a duplicate item!"; | 222 CHECK(result.second) << "Inserting a duplicate item!"; |
223 process_->AddRoute(routing_id_, this); | 223 process_->AddRoute(routing_id_, this); |
224 | 224 |
225 // If we're initially visible, tell the process host that we're alive. | 225 // If we're initially visible, tell the process host that we're alive. |
226 // Otherwise we'll notify the process host when we are first shown. | 226 // Otherwise we'll notify the process host when we are first shown. |
227 if (!hidden) | 227 if (!hidden) |
228 process_->WidgetRestored(); | 228 process_->WidgetRestored(); |
229 | 229 |
230 latency_tracker_.Initialize(routing_id_, GetProcess()->GetID()); | 230 latency_tracker_.reset(new RenderWidgetHostLatencyTracker()); |
| 231 |
| 232 latency_tracker_->Initialize(routing_id_, GetProcess()->GetID()); |
231 | 233 |
232 input_router_.reset(new InputRouterImpl( | 234 input_router_.reset(new InputRouterImpl( |
233 process_, this, this, routing_id_, GetInputRouterConfigForPlatform())); | 235 process_, this, this, routing_id_, GetInputRouterConfigForPlatform())); |
234 | 236 |
235 touch_emulator_.reset(); | 237 touch_emulator_.reset(); |
236 | 238 |
237 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 239 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
238 switches::kDisableHangMonitor)) { | 240 switches::kDisableHangMonitor)) { |
239 hang_monitor_timeout_.reset(new TimeoutMonitor( | 241 hang_monitor_timeout_.reset(new TimeoutMonitor( |
240 base::Bind(&RenderWidgetHostImpl::RendererIsUnresponsive, | 242 base::Bind(&RenderWidgetHostImpl::RendererIsUnresponsive, |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 return; | 960 return; |
959 } | 961 } |
960 | 962 |
961 if (ShouldDropInputEvents()) | 963 if (ShouldDropInputEvents()) |
962 return; | 964 return; |
963 | 965 |
964 if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) | 966 if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) |
965 return; | 967 return; |
966 | 968 |
967 MouseEventWithLatencyInfo mouse_with_latency(mouse_event, ui_latency); | 969 MouseEventWithLatencyInfo mouse_with_latency(mouse_event, ui_latency); |
968 latency_tracker_.OnInputEvent(mouse_event, &mouse_with_latency.latency); | 970 latency_tracker_->OnInputEvent(mouse_event, &mouse_with_latency.latency); |
969 input_router_->SendMouseEvent(mouse_with_latency); | 971 input_router_->SendMouseEvent(mouse_with_latency); |
970 } | 972 } |
971 | 973 |
972 void RenderWidgetHostImpl::ForwardWheelEvent( | 974 void RenderWidgetHostImpl::ForwardWheelEvent( |
973 const WebMouseWheelEvent& wheel_event) { | 975 const WebMouseWheelEvent& wheel_event) { |
974 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); | 976 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); |
975 } | 977 } |
976 | 978 |
977 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( | 979 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( |
978 const blink::WebMouseWheelEvent& wheel_event, | 980 const blink::WebMouseWheelEvent& wheel_event, |
979 const ui::LatencyInfo& ui_latency) { | 981 const ui::LatencyInfo& ui_latency) { |
980 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardWheelEvent", | 982 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardWheelEvent", |
981 "dx", wheel_event.deltaX, "dy", wheel_event.deltaY); | 983 "dx", wheel_event.deltaX, "dy", wheel_event.deltaY); |
982 | 984 |
983 if (ShouldDropInputEvents()) | 985 if (ShouldDropInputEvents()) |
984 return; | 986 return; |
985 | 987 |
986 if (touch_emulator_ && touch_emulator_->HandleMouseWheelEvent(wheel_event)) | 988 if (touch_emulator_ && touch_emulator_->HandleMouseWheelEvent(wheel_event)) |
987 return; | 989 return; |
988 | 990 |
989 MouseWheelEventWithLatencyInfo wheel_with_latency(wheel_event, ui_latency); | 991 MouseWheelEventWithLatencyInfo wheel_with_latency(wheel_event, ui_latency); |
990 latency_tracker_.OnInputEvent(wheel_event, &wheel_with_latency.latency); | 992 latency_tracker_->OnInputEvent(wheel_event, &wheel_with_latency.latency); |
991 input_router_->SendWheelEvent(wheel_with_latency); | 993 input_router_->SendWheelEvent(wheel_with_latency); |
992 } | 994 } |
993 | 995 |
994 void RenderWidgetHostImpl::ForwardEmulatedGestureEvent( | 996 void RenderWidgetHostImpl::ForwardEmulatedGestureEvent( |
995 const blink::WebGestureEvent& gesture_event) { | 997 const blink::WebGestureEvent& gesture_event) { |
996 ForwardGestureEvent(gesture_event); | 998 ForwardGestureEvent(gesture_event); |
997 } | 999 } |
998 | 1000 |
999 void RenderWidgetHostImpl::ForwardGestureEvent( | 1001 void RenderWidgetHostImpl::ForwardGestureEvent( |
1000 const blink::WebGestureEvent& gesture_event) { | 1002 const blink::WebGestureEvent& gesture_event) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 if (scroll_update_needs_wrapping) { | 1038 if (scroll_update_needs_wrapping) { |
1037 ForwardGestureEventWithLatencyInfo( | 1039 ForwardGestureEventWithLatencyInfo( |
1038 CreateScrollBeginForWrapping(gesture_event), ui::LatencyInfo()); | 1040 CreateScrollBeginForWrapping(gesture_event), ui::LatencyInfo()); |
1039 } | 1041 } |
1040 | 1042 |
1041 // Delegate must be non-null, due to |ShouldDropInputEvents()| test. | 1043 // Delegate must be non-null, due to |ShouldDropInputEvents()| test. |
1042 if (delegate_->PreHandleGestureEvent(gesture_event)) | 1044 if (delegate_->PreHandleGestureEvent(gesture_event)) |
1043 return; | 1045 return; |
1044 | 1046 |
1045 GestureEventWithLatencyInfo gesture_with_latency(gesture_event, ui_latency); | 1047 GestureEventWithLatencyInfo gesture_with_latency(gesture_event, ui_latency); |
1046 latency_tracker_.OnInputEvent(gesture_event, &gesture_with_latency.latency); | 1048 latency_tracker_->OnInputEvent(gesture_event, &gesture_with_latency.latency); |
1047 input_router_->SendGestureEvent(gesture_with_latency); | 1049 input_router_->SendGestureEvent(gesture_with_latency); |
1048 | 1050 |
1049 if (scroll_update_needs_wrapping) { | 1051 if (scroll_update_needs_wrapping) { |
1050 ForwardGestureEventWithLatencyInfo( | 1052 ForwardGestureEventWithLatencyInfo( |
1051 CreateScrollEndForWrapping(gesture_event), ui::LatencyInfo()); | 1053 CreateScrollEndForWrapping(gesture_event), ui::LatencyInfo()); |
1052 } | 1054 } |
1053 } | 1055 } |
1054 | 1056 |
1055 void RenderWidgetHostImpl::ForwardEmulatedTouchEvent( | 1057 void RenderWidgetHostImpl::ForwardEmulatedTouchEvent( |
1056 const blink::WebTouchEvent& touch_event) { | 1058 const blink::WebTouchEvent& touch_event) { |
1057 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardEmulatedTouchEvent"); | 1059 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardEmulatedTouchEvent"); |
1058 | 1060 |
1059 TouchEventWithLatencyInfo touch_with_latency(touch_event); | 1061 TouchEventWithLatencyInfo touch_with_latency(touch_event); |
1060 latency_tracker_.OnInputEvent(touch_event, &touch_with_latency.latency); | 1062 latency_tracker_->OnInputEvent(touch_event, &touch_with_latency.latency); |
1061 input_router_->SendTouchEvent(touch_with_latency); | 1063 input_router_->SendTouchEvent(touch_with_latency); |
1062 } | 1064 } |
1063 | 1065 |
1064 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( | 1066 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( |
1065 const blink::WebTouchEvent& touch_event, | 1067 const blink::WebTouchEvent& touch_event, |
1066 const ui::LatencyInfo& ui_latency) { | 1068 const ui::LatencyInfo& ui_latency) { |
1067 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent"); | 1069 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent"); |
1068 | 1070 |
1069 // Always forward TouchEvents for touch stream consistency. They will be | 1071 // Always forward TouchEvents for touch stream consistency. They will be |
1070 // ignored if appropriate in FilterInputEvent(). | 1072 // ignored if appropriate in FilterInputEvent(). |
1071 | 1073 |
1072 TouchEventWithLatencyInfo touch_with_latency(touch_event, ui_latency); | 1074 TouchEventWithLatencyInfo touch_with_latency(touch_event, ui_latency); |
1073 if (touch_emulator_ && | 1075 if (touch_emulator_ && |
1074 touch_emulator_->HandleTouchEvent(touch_with_latency.event)) { | 1076 touch_emulator_->HandleTouchEvent(touch_with_latency.event)) { |
1075 if (view_) { | 1077 if (view_) { |
1076 view_->ProcessAckedTouchEvent( | 1078 view_->ProcessAckedTouchEvent( |
1077 touch_with_latency, INPUT_EVENT_ACK_STATE_CONSUMED); | 1079 touch_with_latency, INPUT_EVENT_ACK_STATE_CONSUMED); |
1078 } | 1080 } |
1079 return; | 1081 return; |
1080 } | 1082 } |
1081 | 1083 |
1082 latency_tracker_.OnInputEvent(touch_event, &touch_with_latency.latency); | 1084 latency_tracker_->OnInputEvent(touch_event, &touch_with_latency.latency); |
1083 input_router_->SendTouchEvent(touch_with_latency); | 1085 input_router_->SendTouchEvent(touch_with_latency); |
1084 } | 1086 } |
1085 | 1087 |
1086 void RenderWidgetHostImpl::ForwardKeyboardEvent( | 1088 void RenderWidgetHostImpl::ForwardKeyboardEvent( |
1087 const NativeWebKeyboardEvent& key_event) { | 1089 const NativeWebKeyboardEvent& key_event) { |
1088 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardKeyboardEvent"); | 1090 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardKeyboardEvent"); |
1089 if (owner_delegate_ && | 1091 if (owner_delegate_ && |
1090 !owner_delegate_->MayRenderWidgetForwardKeyboardEvent(key_event)) { | 1092 !owner_delegate_->MayRenderWidgetForwardKeyboardEvent(key_event)) { |
1091 return; | 1093 return; |
1092 } | 1094 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 | 1143 |
1142 if (key_event.type == WebKeyboardEvent::RawKeyDown) | 1144 if (key_event.type == WebKeyboardEvent::RawKeyDown) |
1143 suppress_next_char_events_ = false; | 1145 suppress_next_char_events_ = false; |
1144 } | 1146 } |
1145 | 1147 |
1146 if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event)) | 1148 if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event)) |
1147 return; | 1149 return; |
1148 | 1150 |
1149 NativeWebKeyboardEventWithLatencyInfo key_event_with_latency(key_event); | 1151 NativeWebKeyboardEventWithLatencyInfo key_event_with_latency(key_event); |
1150 key_event_with_latency.event.isBrowserShortcut = is_shortcut; | 1152 key_event_with_latency.event.isBrowserShortcut = is_shortcut; |
1151 latency_tracker_.OnInputEvent(key_event, &key_event_with_latency.latency); | 1153 latency_tracker_->OnInputEvent(key_event, &key_event_with_latency.latency); |
1152 input_router_->SendKeyboardEvent(key_event_with_latency); | 1154 input_router_->SendKeyboardEvent(key_event_with_latency); |
1153 } | 1155 } |
1154 | 1156 |
1155 void RenderWidgetHostImpl::QueueSyntheticGesture( | 1157 void RenderWidgetHostImpl::QueueSyntheticGesture( |
1156 std::unique_ptr<SyntheticGesture> synthetic_gesture, | 1158 std::unique_ptr<SyntheticGesture> synthetic_gesture, |
1157 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { | 1159 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { |
1158 if (!synthetic_gesture_controller_ && view_) { | 1160 if (!synthetic_gesture_controller_ && view_) { |
1159 synthetic_gesture_controller_.reset( | 1161 synthetic_gesture_controller_.reset( |
1160 new SyntheticGestureController(view_->CreateSyntheticGestureTarget())); | 1162 new SyntheticGestureController(view_->CreateSyntheticGestureTarget())); |
1161 } | 1163 } |
(...skipping 12 matching lines...) Expand all Loading... |
1174 void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) { | 1176 void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) { |
1175 Send(new ViewMsg_ShowContextMenu( | 1177 Send(new ViewMsg_ShowContextMenu( |
1176 GetRoutingID(), ui::MENU_SOURCE_MOUSE, point)); | 1178 GetRoutingID(), ui::MENU_SOURCE_MOUSE, point)); |
1177 } | 1179 } |
1178 | 1180 |
1179 void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) { | 1181 void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) { |
1180 Send(new InputMsg_CursorVisibilityChange(GetRoutingID(), is_visible)); | 1182 Send(new InputMsg_CursorVisibilityChange(GetRoutingID(), is_visible)); |
1181 } | 1183 } |
1182 | 1184 |
1183 int64_t RenderWidgetHostImpl::GetLatencyComponentId() const { | 1185 int64_t RenderWidgetHostImpl::GetLatencyComponentId() const { |
1184 return latency_tracker_.latency_component_id(); | 1186 return latency_tracker_->latency_component_id(); |
1185 } | 1187 } |
1186 | 1188 |
1187 // static | 1189 // static |
1188 void RenderWidgetHostImpl::DisableResizeAckCheckForTesting() { | 1190 void RenderWidgetHostImpl::DisableResizeAckCheckForTesting() { |
1189 g_check_for_pending_resize_ack = false; | 1191 g_check_for_pending_resize_ack = false; |
1190 } | 1192 } |
1191 | 1193 |
1192 void RenderWidgetHostImpl::AddKeyPressEventCallback( | 1194 void RenderWidgetHostImpl::AddKeyPressEventCallback( |
1193 const KeyPressEventCallback& callback) { | 1195 const KeyPressEventCallback& callback) { |
1194 key_press_event_callbacks_.push_back(callback); | 1196 key_press_event_callbacks_.push_back(callback); |
(...skipping 26 matching lines...) Expand all Loading... |
1221 } | 1223 } |
1222 | 1224 |
1223 void RenderWidgetHostImpl::GetWebScreenInfo(blink::WebScreenInfo* result) { | 1225 void RenderWidgetHostImpl::GetWebScreenInfo(blink::WebScreenInfo* result) { |
1224 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::GetWebScreenInfo"); | 1226 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::GetWebScreenInfo"); |
1225 if (view_) | 1227 if (view_) |
1226 view_->GetScreenInfo(result); | 1228 view_->GetScreenInfo(result); |
1227 else | 1229 else |
1228 RenderWidgetHostViewBase::GetDefaultScreenInfo(result); | 1230 RenderWidgetHostViewBase::GetDefaultScreenInfo(result); |
1229 // TODO(sievers): find a way to make this done another way so the method | 1231 // TODO(sievers): find a way to make this done another way so the method |
1230 // can be const. | 1232 // can be const. |
1231 latency_tracker_.set_device_scale_factor(result->deviceScaleFactor); | 1233 latency_tracker_->set_device_scale_factor(result->deviceScaleFactor); |
1232 if (IsUseZoomForDSFEnabled()) | 1234 if (IsUseZoomForDSFEnabled()) |
1233 input_router_->SetDeviceScaleFactor(result->deviceScaleFactor); | 1235 input_router_->SetDeviceScaleFactor(result->deviceScaleFactor); |
1234 } | 1236 } |
1235 | 1237 |
1236 bool RenderWidgetHostImpl::GetScreenColorProfile( | 1238 bool RenderWidgetHostImpl::GetScreenColorProfile( |
1237 std::vector<char>* color_profile) { | 1239 std::vector<char>* color_profile) { |
1238 DCHECK(color_profile->empty()); | 1240 DCHECK(color_profile->empty()); |
1239 if (view_) | 1241 if (view_) |
1240 return view_->GetScreenColorProfile(color_profile); | 1242 return view_->GetScreenColorProfile(color_profile); |
1241 return false; | 1243 return false; |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 uint32_t output_surface_id = base::get<0>(param); | 1556 uint32_t output_surface_id = base::get<0>(param); |
1555 base::get<1>(param).AssignTo(frame.get()); | 1557 base::get<1>(param).AssignTo(frame.get()); |
1556 std::vector<IPC::Message> messages_to_deliver_with_frame; | 1558 std::vector<IPC::Message> messages_to_deliver_with_frame; |
1557 messages_to_deliver_with_frame.swap(base::get<2>(param)); | 1559 messages_to_deliver_with_frame.swap(base::get<2>(param)); |
1558 | 1560 |
1559 if (!ui::LatencyInfo::Verify(frame->metadata.latency_info, | 1561 if (!ui::LatencyInfo::Verify(frame->metadata.latency_info, |
1560 "RenderWidgetHostImpl::OnSwapCompositorFrame")) { | 1562 "RenderWidgetHostImpl::OnSwapCompositorFrame")) { |
1561 std::vector<ui::LatencyInfo>().swap(frame->metadata.latency_info); | 1563 std::vector<ui::LatencyInfo>().swap(frame->metadata.latency_info); |
1562 } | 1564 } |
1563 | 1565 |
1564 latency_tracker_.OnSwapCompositorFrame(&frame->metadata.latency_info); | 1566 latency_tracker_->OnSwapCompositorFrame(&frame->metadata.latency_info); |
1565 | 1567 |
1566 bool is_mobile_optimized = IsMobileOptimizedFrame(frame->metadata); | 1568 bool is_mobile_optimized = IsMobileOptimizedFrame(frame->metadata); |
1567 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); | 1569 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); |
1568 if (touch_emulator_) | 1570 if (touch_emulator_) |
1569 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); | 1571 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); |
1570 | 1572 |
1571 if (view_) { | 1573 if (view_) { |
1572 view_->OnSwapCompositorFrame(output_surface_id, std::move(frame)); | 1574 view_->OnSwapCompositorFrame(output_surface_id, std::move(frame)); |
1573 view_->DidReceiveRendererFrame(); | 1575 view_->DidReceiveRendererFrame(); |
1574 } else { | 1576 } else { |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 } | 1876 } |
1875 | 1877 |
1876 void RenderWidgetHostImpl::DidStopFlinging() { | 1878 void RenderWidgetHostImpl::DidStopFlinging() { |
1877 if (view_) | 1879 if (view_) |
1878 view_->DidStopFlinging(); | 1880 view_->DidStopFlinging(); |
1879 } | 1881 } |
1880 | 1882 |
1881 void RenderWidgetHostImpl::OnKeyboardEventAck( | 1883 void RenderWidgetHostImpl::OnKeyboardEventAck( |
1882 const NativeWebKeyboardEventWithLatencyInfo& event, | 1884 const NativeWebKeyboardEventWithLatencyInfo& event, |
1883 InputEventAckState ack_result) { | 1885 InputEventAckState ack_result) { |
1884 latency_tracker_.OnInputEventAck(event.event, &event.latency); | 1886 latency_tracker_->OnInputEventAck(event.event, &event.latency); |
1885 | 1887 |
1886 // We only send unprocessed key event upwards if we are not hidden, | 1888 // We only send unprocessed key event upwards if we are not hidden, |
1887 // because the user has moved away from us and no longer expect any effect | 1889 // because the user has moved away from us and no longer expect any effect |
1888 // of this key event. | 1890 // of this key event. |
1889 const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result); | 1891 const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result); |
1890 if (delegate_ && !processed && !is_hidden() && !event.event.skip_in_browser) { | 1892 if (delegate_ && !processed && !is_hidden() && !event.event.skip_in_browser) { |
1891 delegate_->HandleKeyboardEvent(event.event); | 1893 delegate_->HandleKeyboardEvent(event.event); |
1892 | 1894 |
1893 // WARNING: This RenderWidgetHostImpl can be deallocated at this point | 1895 // WARNING: This RenderWidgetHostImpl can be deallocated at this point |
1894 // (i.e. in the case of Ctrl+W, where the call to | 1896 // (i.e. in the case of Ctrl+W, where the call to |
1895 // HandleKeyboardEvent destroys this RenderWidgetHostImpl). | 1897 // HandleKeyboardEvent destroys this RenderWidgetHostImpl). |
1896 } | 1898 } |
1897 } | 1899 } |
1898 | 1900 |
1899 void RenderWidgetHostImpl::OnMouseEventAck( | 1901 void RenderWidgetHostImpl::OnMouseEventAck( |
1900 const MouseEventWithLatencyInfo& mouse_event, | 1902 const MouseEventWithLatencyInfo& mouse_event, |
1901 InputEventAckState ack_result) { | 1903 InputEventAckState ack_result) { |
1902 latency_tracker_.OnInputEventAck(mouse_event.event, &mouse_event.latency); | 1904 latency_tracker_->OnInputEventAck(mouse_event.event, &mouse_event.latency); |
1903 } | 1905 } |
1904 | 1906 |
1905 void RenderWidgetHostImpl::OnWheelEventAck( | 1907 void RenderWidgetHostImpl::OnWheelEventAck( |
1906 const MouseWheelEventWithLatencyInfo& wheel_event, | 1908 const MouseWheelEventWithLatencyInfo& wheel_event, |
1907 InputEventAckState ack_result) { | 1909 InputEventAckState ack_result) { |
1908 latency_tracker_.OnInputEventAck(wheel_event.event, &wheel_event.latency); | 1910 latency_tracker_->OnInputEventAck(wheel_event.event, &wheel_event.latency); |
1909 | 1911 |
1910 if (!is_hidden() && view_) { | 1912 if (!is_hidden() && view_) { |
1911 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED && | 1913 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED && |
1912 delegate_ && delegate_->HandleWheelEvent(wheel_event.event)) { | 1914 delegate_ && delegate_->HandleWheelEvent(wheel_event.event)) { |
1913 ack_result = INPUT_EVENT_ACK_STATE_CONSUMED; | 1915 ack_result = INPUT_EVENT_ACK_STATE_CONSUMED; |
1914 } | 1916 } |
1915 view_->WheelEventAck(wheel_event.event, ack_result); | 1917 view_->WheelEventAck(wheel_event.event, ack_result); |
1916 } | 1918 } |
1917 } | 1919 } |
1918 | 1920 |
1919 void RenderWidgetHostImpl::OnGestureEventAck( | 1921 void RenderWidgetHostImpl::OnGestureEventAck( |
1920 const GestureEventWithLatencyInfo& event, | 1922 const GestureEventWithLatencyInfo& event, |
1921 InputEventAckState ack_result) { | 1923 InputEventAckState ack_result) { |
1922 latency_tracker_.OnInputEventAck(event.event, &event.latency); | 1924 latency_tracker_->OnInputEventAck(event.event, &event.latency); |
1923 | 1925 |
1924 if (view_) | 1926 if (view_) |
1925 view_->GestureEventAck(event.event, ack_result); | 1927 view_->GestureEventAck(event.event, ack_result); |
1926 } | 1928 } |
1927 | 1929 |
1928 void RenderWidgetHostImpl::OnTouchEventAck( | 1930 void RenderWidgetHostImpl::OnTouchEventAck( |
1929 const TouchEventWithLatencyInfo& event, | 1931 const TouchEventWithLatencyInfo& event, |
1930 InputEventAckState ack_result) { | 1932 InputEventAckState ack_result) { |
1931 latency_tracker_.OnInputEventAck(event.event, &event.latency); | 1933 latency_tracker_->OnInputEventAck(event.event, &event.latency); |
1932 | 1934 |
1933 if (touch_emulator_ && | 1935 if (touch_emulator_ && |
1934 touch_emulator_->HandleTouchEventAck(event.event, ack_result)) { | 1936 touch_emulator_->HandleTouchEventAck(event.event, ack_result)) { |
1935 return; | 1937 return; |
1936 } | 1938 } |
1937 | 1939 |
1938 if (view_) | 1940 if (view_) |
1939 view_->ProcessAckedTouchEvent(event, ack_result); | 1941 view_->ProcessAckedTouchEvent(event, ack_result); |
1940 } | 1942 } |
1941 | 1943 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2060 FROM_HERE, | 2062 FROM_HERE, |
2061 base::Bind(&RenderWidgetHostImpl::WindowSnapshotReachedScreen, | 2063 base::Bind(&RenderWidgetHostImpl::WindowSnapshotReachedScreen, |
2062 weak_factory_.GetWeakPtr(), | 2064 weak_factory_.GetWeakPtr(), |
2063 sequence_number), | 2065 sequence_number), |
2064 base::TimeDelta::FromSecondsD(1. / 6)); | 2066 base::TimeDelta::FromSecondsD(1. / 6)); |
2065 #else | 2067 #else |
2066 WindowSnapshotReachedScreen(sequence_number); | 2068 WindowSnapshotReachedScreen(sequence_number); |
2067 #endif | 2069 #endif |
2068 } | 2070 } |
2069 | 2071 |
2070 latency_tracker_.OnFrameSwapped(latency_info); | 2072 latency_tracker_->OnFrameSwapped(latency_info); |
2071 } | 2073 } |
2072 | 2074 |
2073 void RenderWidgetHostImpl::DidReceiveRendererFrame() { | 2075 void RenderWidgetHostImpl::DidReceiveRendererFrame() { |
2074 view_->DidReceiveRendererFrame(); | 2076 view_->DidReceiveRendererFrame(); |
2075 } | 2077 } |
2076 | 2078 |
2077 void RenderWidgetHostImpl::WindowSnapshotReachedScreen(int snapshot_id) { | 2079 void RenderWidgetHostImpl::WindowSnapshotReachedScreen(int snapshot_id) { |
2078 DCHECK(base::MessageLoopForUI::IsCurrent()); | 2080 DCHECK(base::MessageLoopForUI::IsCurrent()); |
2079 | 2081 |
2080 gfx::Rect view_bounds = GetView()->GetViewBounds(); | 2082 gfx::Rect view_bounds = GetView()->GetViewBounds(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2151 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; | 2153 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; |
2152 } | 2154 } |
2153 | 2155 |
2154 BrowserAccessibilityManager* | 2156 BrowserAccessibilityManager* |
2155 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2157 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { |
2156 return delegate_ ? | 2158 return delegate_ ? |
2157 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; | 2159 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; |
2158 } | 2160 } |
2159 | 2161 |
2160 } // namespace content | 2162 } // namespace content |
OLD | NEW |