Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: content/renderer/render_widget.cc

Issue 997283002: Coalesce async touch move events until the ack back from render (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modify unittest Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 total_input_handling_time_this_frame_.InMicroseconds() > 1231 total_input_handling_time_this_frame_.InMicroseconds() >
1232 kInputHandlingTimeThrottlingThresholdMicroseconds; 1232 kInputHandlingTimeThrottlingThresholdMicroseconds;
1233 } 1233 }
1234 1234
1235 TRACE_EVENT_SYNTHETIC_DELAY_END("blink.HandleInputEvent"); 1235 TRACE_EVENT_SYNTHETIC_DELAY_END("blink.HandleInputEvent");
1236 1236
1237 // Note that we can't use handling_event_type_ here since it will be overriden 1237 // Note that we can't use handling_event_type_ here since it will be overriden
1238 // by reentrant calls for events after the paused one. 1238 // by reentrant calls for events after the paused one.
1239 bool no_ack = ignore_ack_for_mouse_move_from_debugger_ && 1239 bool no_ack = ignore_ack_for_mouse_move_from_debugger_ &&
1240 input_event->type == WebInputEvent::MouseMove; 1240 input_event->type == WebInputEvent::MouseMove;
1241 if (!WebInputEventTraits::IgnoresAckDisposition(*input_event) && !no_ack) { 1241 if (WebInputEventTraits::WillReceiveAckFromRenderer(*input_event) &&
1242 InputHostMsg_HandleInputEvent_ACK_Params ack; 1242 !no_ack) {
1243 ack.type = input_event->type; 1243 InputEventAck ack(input_event->type, ack_result, swap_latency_info,
1244 ack.state = ack_result; 1244 WebInputEventTraits::GetUniqueTouchEventId(*input_event));
1245 ack.latency = swap_latency_info;
1246 scoped_ptr<IPC::Message> response( 1245 scoped_ptr<IPC::Message> response(
1247 new InputHostMsg_HandleInputEvent_ACK(routing_id_, ack)); 1246 new InputHostMsg_HandleInputEvent_ACK(routing_id_, ack));
1248 if (rate_limiting_wanted && frame_pending && !is_hidden_) { 1247 if (rate_limiting_wanted && frame_pending && !is_hidden_) {
1249 // We want to rate limit the input events in this case, so we'll wait for 1248 // We want to rate limit the input events in this case, so we'll wait for
1250 // painting to finish before ACKing this message. 1249 // painting to finish before ACKing this message.
1251 TRACE_EVENT_INSTANT0("renderer", 1250 TRACE_EVENT_INSTANT0("renderer",
1252 "RenderWidget::OnHandleInputEvent ack throttled", 1251 "RenderWidget::OnHandleInputEvent ack throttled",
1253 TRACE_EVENT_SCOPE_THREAD); 1252 TRACE_EVENT_SCOPE_THREAD);
1254 if (pending_input_event_ack_) { 1253 if (pending_input_event_ack_) {
1255 TRACE_EVENT_ASYNC_END0("input", "RenderWidget::ThrottledInputEventAck", 1254 TRACE_EVENT_ASYNC_END0("input", "RenderWidget::ThrottledInputEventAck",
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 #else 1780 #else
1782 return !!webwidget_; 1781 return !!webwidget_;
1783 #endif 1782 #endif
1784 } 1783 }
1785 1784
1786 bool RenderWidget::SendAckForMouseMoveFromDebugger() { 1785 bool RenderWidget::SendAckForMouseMoveFromDebugger() {
1787 if (handling_event_type_ == WebInputEvent::MouseMove) { 1786 if (handling_event_type_ == WebInputEvent::MouseMove) {
1788 // If we pause multiple times during a single mouse move event, we should 1787 // If we pause multiple times during a single mouse move event, we should
1789 // only send ACK once. 1788 // only send ACK once.
1790 if (!ignore_ack_for_mouse_move_from_debugger_) { 1789 if (!ignore_ack_for_mouse_move_from_debugger_) {
1791 InputHostMsg_HandleInputEvent_ACK_Params ack; 1790 InputEventAck ack(handling_event_type_, INPUT_EVENT_ACK_STATE_CONSUMED);
1792 ack.type = handling_event_type_;
1793 ack.state = INPUT_EVENT_ACK_STATE_CONSUMED;
1794 Send(new InputHostMsg_HandleInputEvent_ACK(routing_id_, ack)); 1791 Send(new InputHostMsg_HandleInputEvent_ACK(routing_id_, ack));
1795 return true; 1792 return true;
1796 } 1793 }
1797 } 1794 }
1798 return false; 1795 return false;
1799 } 1796 }
1800 1797
1801 void RenderWidget::IgnoreAckForMouseMoveFromDebugger() { 1798 void RenderWidget::IgnoreAckForMouseMoveFromDebugger() {
1802 ignore_ack_for_mouse_move_from_debugger_ = true; 1799 ignore_ack_for_mouse_move_from_debugger_ = true;
1803 } 1800 }
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
2466 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2463 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2467 video_hole_frames_.AddObserver(frame); 2464 video_hole_frames_.AddObserver(frame);
2468 } 2465 }
2469 2466
2470 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2467 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2471 video_hole_frames_.RemoveObserver(frame); 2468 video_hole_frames_.RemoveObserver(frame);
2472 } 2469 }
2473 #endif // defined(VIDEO_HOLE) 2470 #endif // defined(VIDEO_HOLE)
2474 2471
2475 } // namespace content 2472 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698