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 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1053 key_event.nativeKeyCode != AKEYCODE_DPAD_UP && | 1053 key_event.nativeKeyCode != AKEYCODE_DPAD_UP && |
1054 key_event.nativeKeyCode != AKEYCODE_DPAD_DOWN) | 1054 key_event.nativeKeyCode != AKEYCODE_DPAD_DOWN) |
1055 ime_event_guard_maybe.reset(new ImeEventGuard(this)); | 1055 ime_event_guard_maybe.reset(new ImeEventGuard(this)); |
1056 } | 1056 } |
1057 #endif | 1057 #endif |
1058 | 1058 |
1059 base::AutoReset<const ui::LatencyInfo*> resetter(¤t_event_latency_info_, | 1059 base::AutoReset<const ui::LatencyInfo*> resetter(¤t_event_latency_info_, |
1060 &latency_info); | 1060 &latency_info); |
1061 | 1061 |
1062 base::TimeTicks start_time; | 1062 base::TimeTicks start_time; |
1063 if (base::TimeTicks::IsHighResNowFastAndReliable()) | 1063 if (base::TimeTicks::IsHighResNowFastAndReliable()) |
miu
2015/01/21 23:52:51
Consider replacing all occurrences of IsHighResNow
charliea_google.com
2015/01/22 15:20:46
Done.
| |
1064 start_time = base::TimeTicks::HighResNow(); | 1064 start_time = base::TimeTicks::Now(); |
1065 | 1065 |
1066 TRACE_EVENT1("renderer", "RenderWidget::OnHandleInputEvent", | 1066 TRACE_EVENT1("renderer", "RenderWidget::OnHandleInputEvent", |
1067 "event", WebInputEventTraits::GetName(input_event->type)); | 1067 "event", WebInputEventTraits::GetName(input_event->type)); |
1068 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("blink.HandleInputEvent"); | 1068 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("blink.HandleInputEvent"); |
1069 TRACE_EVENT_FLOW_STEP0( | 1069 TRACE_EVENT_FLOW_STEP0( |
1070 "input", | 1070 "input", |
1071 "LatencyInfo.Flow", | 1071 "LatencyInfo.Flow", |
1072 TRACE_ID_DONT_MANGLE(latency_info.trace_id), | 1072 TRACE_ID_DONT_MANGLE(latency_info.trace_id), |
1073 "HanldeInputEventMain"); | 1073 "HanldeInputEventMain"); |
1074 | 1074 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1158 | 1158 |
1159 // Send mouse wheel events and their disposition to the compositor thread, so | 1159 // Send mouse wheel events and their disposition to the compositor thread, so |
1160 // that they can be used to produce the elastic overscroll effect on Mac. | 1160 // that they can be used to produce the elastic overscroll effect on Mac. |
1161 if (input_event->type == WebInputEvent::MouseWheel) { | 1161 if (input_event->type == WebInputEvent::MouseWheel) { |
1162 ObserveWheelEventAndResult( | 1162 ObserveWheelEventAndResult( |
1163 static_cast<const WebMouseWheelEvent&>(*input_event), processed); | 1163 static_cast<const WebMouseWheelEvent&>(*input_event), processed); |
1164 } | 1164 } |
1165 | 1165 |
1166 bool frame_pending = compositor_ && compositor_->BeginMainFrameRequested(); | 1166 bool frame_pending = compositor_ && compositor_->BeginMainFrameRequested(); |
1167 | 1167 |
1168 // If we don't have a fast and accurate HighResNow, we assume the input | 1168 // If we don't have a fast and accurate HighResNow, we assume the input |
miu
2015/01/21 23:52:51
You should also remove references to HighResNow in
charliea_google.com
2015/01/22 15:20:46
Done.
| |
1169 // handlers are heavy and rate limit them. | 1169 // handlers are heavy and rate limit them. |
1170 bool rate_limiting_wanted = | 1170 bool rate_limiting_wanted = |
1171 input_event->type == WebInputEvent::MouseMove || | 1171 input_event->type == WebInputEvent::MouseMove || |
1172 input_event->type == WebInputEvent::MouseWheel; | 1172 input_event->type == WebInputEvent::MouseWheel; |
1173 if (rate_limiting_wanted && !start_time.is_null()) { | 1173 if (rate_limiting_wanted && !start_time.is_null()) { |
1174 base::TimeTicks end_time = base::TimeTicks::HighResNow(); | 1174 base::TimeTicks end_time = base::TimeTicks::Now(); |
1175 total_input_handling_time_this_frame_ += (end_time - start_time); | 1175 total_input_handling_time_this_frame_ += (end_time - start_time); |
1176 rate_limiting_wanted = | 1176 rate_limiting_wanted = |
1177 total_input_handling_time_this_frame_.InMicroseconds() > | 1177 total_input_handling_time_this_frame_.InMicroseconds() > |
1178 kInputHandlingTimeThrottlingThresholdMicroseconds; | 1178 kInputHandlingTimeThrottlingThresholdMicroseconds; |
1179 } | 1179 } |
1180 | 1180 |
1181 TRACE_EVENT_SYNTHETIC_DELAY_END("blink.HandleInputEvent"); | 1181 TRACE_EVENT_SYNTHETIC_DELAY_END("blink.HandleInputEvent"); |
1182 | 1182 |
1183 // Note that we can't use handling_event_type_ here since it will be overriden | 1183 // Note that we can't use handling_event_type_ here since it will be overriden |
1184 // by reentrant calls for events after the paused one. | 1184 // by reentrant calls for events after the paused one. |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2354 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2354 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
2355 video_hole_frames_.AddObserver(frame); | 2355 video_hole_frames_.AddObserver(frame); |
2356 } | 2356 } |
2357 | 2357 |
2358 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2358 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
2359 video_hole_frames_.RemoveObserver(frame); | 2359 video_hole_frames_.RemoveObserver(frame); |
2360 } | 2360 } |
2361 #endif // defined(VIDEO_HOLE) | 2361 #endif // defined(VIDEO_HOLE) |
2362 | 2362 |
2363 } // namespace content | 2363 } // namespace content |
OLD | NEW |