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/logging.h" | 10 #include "base/logging.h" |
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 total_input_handling_time_this_frame_.InMicroseconds() > | 1232 total_input_handling_time_this_frame_.InMicroseconds() > |
1233 kInputHandlingTimeThrottlingThresholdMicroseconds; | 1233 kInputHandlingTimeThrottlingThresholdMicroseconds; |
1234 } | 1234 } |
1235 | 1235 |
1236 TRACE_EVENT_SYNTHETIC_DELAY_END("blink.HandleInputEvent"); | 1236 TRACE_EVENT_SYNTHETIC_DELAY_END("blink.HandleInputEvent"); |
1237 | 1237 |
1238 // Note that we can't use handling_event_type_ here since it will be overriden | 1238 // Note that we can't use handling_event_type_ here since it will be overriden |
1239 // by reentrant calls for events after the paused one. | 1239 // by reentrant calls for events after the paused one. |
1240 bool no_ack = ignore_ack_for_mouse_move_from_debugger_ && | 1240 bool no_ack = ignore_ack_for_mouse_move_from_debugger_ && |
1241 input_event->type == WebInputEvent::MouseMove; | 1241 input_event->type == WebInputEvent::MouseMove; |
1242 if (!WebInputEventTraits::IgnoresAckDisposition(*input_event) && !no_ack) { | 1242 if (WebInputEventTraits::WillReceiveAckFromRenderer(*input_event) && |
1243 InputHostMsg_HandleInputEvent_ACK_Params ack; | 1243 !no_ack) { |
1244 ack.type = input_event->type; | 1244 InputEventAck ack(input_event->type, ack_result, swap_latency_info, |
1245 ack.state = ack_result; | 1245 WebInputEventTraits::GetUniqueTouchEventId(*input_event)); |
1246 ack.latency = swap_latency_info; | |
1247 scoped_ptr<IPC::Message> response( | 1246 scoped_ptr<IPC::Message> response( |
1248 new InputHostMsg_HandleInputEvent_ACK(routing_id_, ack)); | 1247 new InputHostMsg_HandleInputEvent_ACK(routing_id_, ack)); |
1249 if (rate_limiting_wanted && frame_pending && !is_hidden_) { | 1248 if (rate_limiting_wanted && frame_pending && !is_hidden_) { |
1250 // We want to rate limit the input events in this case, so we'll wait for | 1249 // We want to rate limit the input events in this case, so we'll wait for |
1251 // painting to finish before ACKing this message. | 1250 // painting to finish before ACKing this message. |
1252 TRACE_EVENT_INSTANT0("renderer", | 1251 TRACE_EVENT_INSTANT0("renderer", |
1253 "RenderWidget::OnHandleInputEvent ack throttled", | 1252 "RenderWidget::OnHandleInputEvent ack throttled", |
1254 TRACE_EVENT_SCOPE_THREAD); | 1253 TRACE_EVENT_SCOPE_THREAD); |
1255 if (pending_input_event_ack_) { | 1254 if (pending_input_event_ack_) { |
1256 TRACE_EVENT_ASYNC_END0("input", "RenderWidget::ThrottledInputEventAck", | 1255 TRACE_EVENT_ASYNC_END0("input", "RenderWidget::ThrottledInputEventAck", |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1787 #else | 1786 #else |
1788 return !!webwidget_; | 1787 return !!webwidget_; |
1789 #endif | 1788 #endif |
1790 } | 1789 } |
1791 | 1790 |
1792 bool RenderWidget::SendAckForMouseMoveFromDebugger() { | 1791 bool RenderWidget::SendAckForMouseMoveFromDebugger() { |
1793 if (handling_event_type_ == WebInputEvent::MouseMove) { | 1792 if (handling_event_type_ == WebInputEvent::MouseMove) { |
1794 // If we pause multiple times during a single mouse move event, we should | 1793 // If we pause multiple times during a single mouse move event, we should |
1795 // only send ACK once. | 1794 // only send ACK once. |
1796 if (!ignore_ack_for_mouse_move_from_debugger_) { | 1795 if (!ignore_ack_for_mouse_move_from_debugger_) { |
1797 InputHostMsg_HandleInputEvent_ACK_Params ack; | 1796 InputEventAck ack(handling_event_type_, INPUT_EVENT_ACK_STATE_CONSUMED); |
1798 ack.type = handling_event_type_; | |
1799 ack.state = INPUT_EVENT_ACK_STATE_CONSUMED; | |
1800 Send(new InputHostMsg_HandleInputEvent_ACK(routing_id_, ack)); | 1797 Send(new InputHostMsg_HandleInputEvent_ACK(routing_id_, ack)); |
1801 return true; | 1798 return true; |
1802 } | 1799 } |
1803 } | 1800 } |
1804 return false; | 1801 return false; |
1805 } | 1802 } |
1806 | 1803 |
1807 void RenderWidget::IgnoreAckForMouseMoveFromDebugger() { | 1804 void RenderWidget::IgnoreAckForMouseMoveFromDebugger() { |
1808 ignore_ack_for_mouse_move_from_debugger_ = true; | 1805 ignore_ack_for_mouse_move_from_debugger_ = true; |
1809 } | 1806 } |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2472 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2469 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
2473 video_hole_frames_.AddObserver(frame); | 2470 video_hole_frames_.AddObserver(frame); |
2474 } | 2471 } |
2475 | 2472 |
2476 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2473 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
2477 video_hole_frames_.RemoveObserver(frame); | 2474 video_hole_frames_.RemoveObserver(frame); |
2478 } | 2475 } |
2479 #endif // defined(VIDEO_HOLE) | 2476 #endif // defined(VIDEO_HOLE) |
2480 | 2477 |
2481 } // namespace content | 2478 } // namespace content |
OLD | NEW |