| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/debug/trace_event_synthetic_delay.h" | 10 #include "base/debug/trace_event_synthetic_delay.h" |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 base::TimeTicks end_time = base::TimeTicks::HighResNow(); | 1047 base::TimeTicks end_time = base::TimeTicks::HighResNow(); |
| 1048 total_input_handling_time_this_frame_ += (end_time - start_time); | 1048 total_input_handling_time_this_frame_ += (end_time - start_time); |
| 1049 rate_limiting_wanted = | 1049 rate_limiting_wanted = |
| 1050 total_input_handling_time_this_frame_.InMicroseconds() > | 1050 total_input_handling_time_this_frame_.InMicroseconds() > |
| 1051 kInputHandlingTimeThrottlingThresholdMicroseconds; | 1051 kInputHandlingTimeThrottlingThresholdMicroseconds; |
| 1052 } | 1052 } |
| 1053 | 1053 |
| 1054 TRACE_EVENT_SYNTHETIC_DELAY_END("blink.HandleInputEvent"); | 1054 TRACE_EVENT_SYNTHETIC_DELAY_END("blink.HandleInputEvent"); |
| 1055 | 1055 |
| 1056 if (!WebInputEventTraits::IgnoresAckDisposition(*input_event)) { | 1056 if (!WebInputEventTraits::IgnoresAckDisposition(*input_event)) { |
| 1057 InputHostMsg_HandleInputEvent_ACK_Params ack; |
| 1058 ack.type = input_event->type; |
| 1059 ack.state = ack_result; |
| 1060 ack.latency = swap_latency_info; |
| 1057 scoped_ptr<IPC::Message> response( | 1061 scoped_ptr<IPC::Message> response( |
| 1058 new InputHostMsg_HandleInputEvent_ACK(routing_id_, | 1062 new InputHostMsg_HandleInputEvent_ACK(routing_id_, ack)); |
| 1059 input_event->type, | |
| 1060 ack_result, | |
| 1061 swap_latency_info)); | |
| 1062 if (rate_limiting_wanted && event_type_can_be_rate_limited && | 1063 if (rate_limiting_wanted && event_type_can_be_rate_limited && |
| 1063 frame_pending && !is_hidden_) { | 1064 frame_pending && !is_hidden_) { |
| 1064 // We want to rate limit the input events in this case, so we'll wait for | 1065 // We want to rate limit the input events in this case, so we'll wait for |
| 1065 // painting to finish before ACKing this message. | 1066 // painting to finish before ACKing this message. |
| 1066 TRACE_EVENT_INSTANT0("renderer", | 1067 TRACE_EVENT_INSTANT0("renderer", |
| 1067 "RenderWidget::OnHandleInputEvent ack throttled", | 1068 "RenderWidget::OnHandleInputEvent ack throttled", |
| 1068 TRACE_EVENT_SCOPE_THREAD); | 1069 TRACE_EVENT_SCOPE_THREAD); |
| 1069 if (pending_input_event_ack_) { | 1070 if (pending_input_event_ack_) { |
| 1070 // As two different kinds of events could cause us to postpone an ack | 1071 // As two different kinds of events could cause us to postpone an ack |
| 1071 // we send it now, if we have one pending. The Browser should never | 1072 // we send it now, if we have one pending. The Browser should never |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2073 | 2074 |
| 2074 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2075 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
| 2075 swapped_out_frames_.AddObserver(frame); | 2076 swapped_out_frames_.AddObserver(frame); |
| 2076 } | 2077 } |
| 2077 | 2078 |
| 2078 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2079 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
| 2079 swapped_out_frames_.RemoveObserver(frame); | 2080 swapped_out_frames_.RemoveObserver(frame); |
| 2080 } | 2081 } |
| 2081 | 2082 |
| 2082 } // namespace content | 2083 } // namespace content |
| OLD | NEW |