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

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: 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 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 #else 1781 #else
1783 return !!webwidget_; 1782 return !!webwidget_;
1784 #endif 1783 #endif
1785 } 1784 }
1786 1785
1787 bool RenderWidget::SendAckForMouseMoveFromDebugger() { 1786 bool RenderWidget::SendAckForMouseMoveFromDebugger() {
1788 if (handling_event_type_ == WebInputEvent::MouseMove) { 1787 if (handling_event_type_ == WebInputEvent::MouseMove) {
1789 // If we pause multiple times during a single mouse move event, we should 1788 // If we pause multiple times during a single mouse move event, we should
1790 // only send ACK once. 1789 // only send ACK once.
1791 if (!ignore_ack_for_mouse_move_from_debugger_) { 1790 if (!ignore_ack_for_mouse_move_from_debugger_) {
1792 InputHostMsg_HandleInputEvent_ACK_Params ack; 1791 InputEventAck ack(handling_event_type_, INPUT_EVENT_ACK_STATE_CONSUMED);
1793 ack.type = handling_event_type_;
1794 ack.state = INPUT_EVENT_ACK_STATE_CONSUMED;
1795 Send(new InputHostMsg_HandleInputEvent_ACK(routing_id_, ack)); 1792 Send(new InputHostMsg_HandleInputEvent_ACK(routing_id_, ack));
1796 return true; 1793 return true;
1797 } 1794 }
1798 } 1795 }
1799 return false; 1796 return false;
1800 } 1797 }
1801 1798
1802 void RenderWidget::IgnoreAckForMouseMoveFromDebugger() { 1799 void RenderWidget::IgnoreAckForMouseMoveFromDebugger() {
1803 ignore_ack_for_mouse_move_from_debugger_ = true; 1800 ignore_ack_for_mouse_move_from_debugger_ = true;
1804 } 1801 }
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2437 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2441 video_hole_frames_.AddObserver(frame); 2438 video_hole_frames_.AddObserver(frame);
2442 } 2439 }
2443 2440
2444 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2441 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2445 video_hole_frames_.RemoveObserver(frame); 2442 video_hole_frames_.RemoveObserver(frame);
2446 } 2443 }
2447 #endif // defined(VIDEO_HOLE) 2444 #endif // defined(VIDEO_HOLE)
2448 2445
2449 } // namespace content 2446 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698