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

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, 8 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 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 total_input_handling_time_this_frame_.InMicroseconds() > 1217 total_input_handling_time_this_frame_.InMicroseconds() >
1218 kInputHandlingTimeThrottlingThresholdMicroseconds; 1218 kInputHandlingTimeThrottlingThresholdMicroseconds;
1219 } 1219 }
1220 1220
1221 TRACE_EVENT_SYNTHETIC_DELAY_END("blink.HandleInputEvent"); 1221 TRACE_EVENT_SYNTHETIC_DELAY_END("blink.HandleInputEvent");
1222 1222
1223 // Note that we can't use handling_event_type_ here since it will be overriden 1223 // Note that we can't use handling_event_type_ here since it will be overriden
1224 // by reentrant calls for events after the paused one. 1224 // by reentrant calls for events after the paused one.
1225 bool no_ack = ignore_ack_for_mouse_move_from_debugger_ && 1225 bool no_ack = ignore_ack_for_mouse_move_from_debugger_ &&
1226 input_event->type == WebInputEvent::MouseMove; 1226 input_event->type == WebInputEvent::MouseMove;
1227 if (!WebInputEventTraits::IgnoresAckDisposition(*input_event) && !no_ack) { 1227
1228 InputHostMsg_HandleInputEvent_ACK_Params ack; 1228 bool is_async_touch_move = false;
1229 ack.type = input_event->type; 1229 if (input_event->type == WebInputEvent::TouchMove) {
1230 ack.state = ack_result; 1230 const WebTouchEvent& touch =
1231 ack.latency = swap_latency_info; 1231 static_cast<const WebTouchEvent&>(*input_event);
1232 scoped_ptr<IPC::Message> response( 1232 if (!touch.cancelable)
1233 new InputHostMsg_HandleInputEvent_ACK(routing_id_, ack)); 1233 is_async_touch_move = true;
1234 }
1235
1236 if ((!WebInputEventTraits::IgnoresAckDisposition(*input_event) ||
1237 is_async_touch_move) && !no_ack) {
1238 // Send AsyncTouchEvent_ACK for async touch moves, and InputEvent_ACK for
1239 // all other types of events.
1240 scoped_ptr<IPC::Message> response;
1241
1242 if (is_async_touch_move) {
1243 InputHostMsg_HandleUncancelableTouchMoveEvent_ACK_Params ack;
1244 response = scoped_ptr<IPC::Message>(
1245 new InputHostMsg_HandleUncancelableTouchMoveEvent_ACK(routing_id_,
1246 ack));
1247 } else {
1248 InputHostMsg_HandleInputEvent_ACK_Params ack;
1249 ack.type = input_event->type;
1250 ack.state = ack_result;
1251 ack.latency = swap_latency_info;
1252 response = scoped_ptr<IPC::Message>(
1253 new InputHostMsg_HandleInputEvent_ACK(routing_id_, ack));
1254 }
1255
1234 if (rate_limiting_wanted && frame_pending && !is_hidden_) { 1256 if (rate_limiting_wanted && frame_pending && !is_hidden_) {
1235 // We want to rate limit the input events in this case, so we'll wait for 1257 // We want to rate limit the input events in this case, so we'll wait for
1236 // painting to finish before ACKing this message. 1258 // painting to finish before ACKing this message.
1237 TRACE_EVENT_INSTANT0("renderer", 1259 TRACE_EVENT_INSTANT0("renderer",
1238 "RenderWidget::OnHandleInputEvent ack throttled", 1260 "RenderWidget::OnHandleInputEvent ack throttled",
1239 TRACE_EVENT_SCOPE_THREAD); 1261 TRACE_EVENT_SCOPE_THREAD);
1240 if (pending_input_event_ack_) { 1262 if (pending_input_event_ack_) {
1241 TRACE_EVENT_ASYNC_END0("input", "RenderWidget::ThrottledInputEventAck", 1263 TRACE_EVENT_ASYNC_END0("input", "RenderWidget::ThrottledInputEventAck",
1242 pending_input_event_ack_.get()); 1264 pending_input_event_ack_.get());
1243 // As two different kinds of events could cause us to postpone an ack 1265 // As two different kinds of events could cause us to postpone an ack
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2423 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2445 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2424 video_hole_frames_.AddObserver(frame); 2446 video_hole_frames_.AddObserver(frame);
2425 } 2447 }
2426 2448
2427 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2449 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2428 video_hole_frames_.RemoveObserver(frame); 2450 video_hole_frames_.RemoveObserver(frame);
2429 } 2451 }
2430 #endif // defined(VIDEO_HOLE) 2452 #endif // defined(VIDEO_HOLE)
2431 2453
2432 } // namespace content 2454 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698