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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 key_event.nativeKeyCode != AKEYCODE_DPAD_UP && | 1057 key_event.nativeKeyCode != AKEYCODE_DPAD_UP && |
1058 key_event.nativeKeyCode != AKEYCODE_DPAD_DOWN) | 1058 key_event.nativeKeyCode != AKEYCODE_DPAD_DOWN) |
1059 ime_event_guard_maybe.reset(new ImeEventGuard(this)); | 1059 ime_event_guard_maybe.reset(new ImeEventGuard(this)); |
1060 } | 1060 } |
1061 #endif | 1061 #endif |
1062 | 1062 |
1063 base::AutoReset<const ui::LatencyInfo*> resetter(¤t_event_latency_info_, | 1063 base::AutoReset<const ui::LatencyInfo*> resetter(¤t_event_latency_info_, |
1064 &latency_info); | 1064 &latency_info); |
1065 | 1065 |
1066 base::TimeTicks start_time; | 1066 base::TimeTicks start_time; |
1067 if (base::TimeTicks::IsHighResNowFastAndReliable()) | 1067 if (base::TimeTicks::IsHighResolution()) |
1068 start_time = base::TimeTicks::HighResNow(); | 1068 start_time = base::TimeTicks::Now(); |
1069 | 1069 |
1070 TRACE_EVENT1("renderer", "RenderWidget::OnHandleInputEvent", | 1070 TRACE_EVENT1("renderer", "RenderWidget::OnHandleInputEvent", |
1071 "event", WebInputEventTraits::GetName(input_event->type)); | 1071 "event", WebInputEventTraits::GetName(input_event->type)); |
1072 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("blink.HandleInputEvent"); | 1072 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("blink.HandleInputEvent"); |
1073 TRACE_EVENT_FLOW_STEP0( | 1073 TRACE_EVENT_FLOW_STEP0( |
1074 "input", | 1074 "input", |
1075 "LatencyInfo.Flow", | 1075 "LatencyInfo.Flow", |
1076 TRACE_ID_DONT_MANGLE(latency_info.trace_id), | 1076 TRACE_ID_DONT_MANGLE(latency_info.trace_id), |
1077 "HanldeInputEventMain"); | 1077 "HanldeInputEventMain"); |
1078 | 1078 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 | 1162 |
1163 // Send mouse wheel events and their disposition to the compositor thread, so | 1163 // Send mouse wheel events and their disposition to the compositor thread, so |
1164 // that they can be used to produce the elastic overscroll effect on Mac. | 1164 // that they can be used to produce the elastic overscroll effect on Mac. |
1165 if (input_event->type == WebInputEvent::MouseWheel) { | 1165 if (input_event->type == WebInputEvent::MouseWheel) { |
1166 ObserveWheelEventAndResult( | 1166 ObserveWheelEventAndResult( |
1167 static_cast<const WebMouseWheelEvent&>(*input_event), processed); | 1167 static_cast<const WebMouseWheelEvent&>(*input_event), processed); |
1168 } | 1168 } |
1169 | 1169 |
1170 bool frame_pending = compositor_ && compositor_->BeginMainFrameRequested(); | 1170 bool frame_pending = compositor_ && compositor_->BeginMainFrameRequested(); |
1171 | 1171 |
1172 // If we don't have a fast and accurate HighResNow, we assume the input | 1172 // If we don't have a fast and accurate Now(), we assume the input handlers |
1173 // handlers are heavy and rate limit them. | 1173 // are heavy and rate limit them. |
1174 bool rate_limiting_wanted = | 1174 bool rate_limiting_wanted = |
1175 input_event->type == WebInputEvent::MouseMove || | 1175 input_event->type == WebInputEvent::MouseMove || |
1176 input_event->type == WebInputEvent::MouseWheel; | 1176 input_event->type == WebInputEvent::MouseWheel; |
1177 if (rate_limiting_wanted && !start_time.is_null()) { | 1177 if (rate_limiting_wanted && !start_time.is_null()) { |
1178 base::TimeTicks end_time = base::TimeTicks::HighResNow(); | 1178 base::TimeTicks end_time = base::TimeTicks::Now(); |
1179 total_input_handling_time_this_frame_ += (end_time - start_time); | 1179 total_input_handling_time_this_frame_ += (end_time - start_time); |
1180 rate_limiting_wanted = | 1180 rate_limiting_wanted = |
1181 total_input_handling_time_this_frame_.InMicroseconds() > | 1181 total_input_handling_time_this_frame_.InMicroseconds() > |
1182 kInputHandlingTimeThrottlingThresholdMicroseconds; | 1182 kInputHandlingTimeThrottlingThresholdMicroseconds; |
1183 } | 1183 } |
1184 | 1184 |
1185 TRACE_EVENT_SYNTHETIC_DELAY_END("blink.HandleInputEvent"); | 1185 TRACE_EVENT_SYNTHETIC_DELAY_END("blink.HandleInputEvent"); |
1186 | 1186 |
1187 // Note that we can't use handling_event_type_ here since it will be overriden | 1187 // Note that we can't use handling_event_type_ here since it will be overriden |
1188 // by reentrant calls for events after the paused one. | 1188 // by reentrant calls for events after the paused one. |
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2373 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2373 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
2374 video_hole_frames_.AddObserver(frame); | 2374 video_hole_frames_.AddObserver(frame); |
2375 } | 2375 } |
2376 | 2376 |
2377 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2377 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
2378 video_hole_frames_.RemoveObserver(frame); | 2378 video_hole_frames_.RemoveObserver(frame); |
2379 } | 2379 } |
2380 #endif // defined(VIDEO_HOLE) | 2380 #endif // defined(VIDEO_HOLE) |
2381 | 2381 |
2382 } // namespace content | 2382 } // namespace content |
OLD | NEW |