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

Side by Side Diff: content/browser/renderer_host/input/input_router_impl.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, 9 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
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_event_queue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/renderer_host/input/input_router_impl.h" 5 #include "content/browser/renderer_host/input/input_router_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 output_stream_validator_.Validate(input_event); 340 output_stream_validator_.Validate(input_event);
341 341
342 if (OfferToClient(input_event, latency_info)) 342 if (OfferToClient(input_event, latency_info))
343 return; 343 return;
344 344
345 OfferToRenderer(input_event, latency_info, is_keyboard_shortcut); 345 OfferToRenderer(input_event, latency_info, is_keyboard_shortcut);
346 346
347 // Touch events should always indicate in the event whether they are 347 // Touch events should always indicate in the event whether they are
348 // cancelable (respect ACK disposition) or not. 348 // cancelable (respect ACK disposition) or not.
349 bool ignores_ack = WebInputEventTraits::IgnoresAckDisposition(input_event); 349 bool ignores_ack = WebInputEventTraits::IgnoresAckDisposition(input_event);
350 bool touch_move_aysnc = false;
350 if (WebInputEvent::isTouchEventType(input_event.type)) { 351 if (WebInputEvent::isTouchEventType(input_event.type)) {
351 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event); 352 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event);
352 DCHECK_NE(ignores_ack, !!touch.cancelable); 353 touch_move_aysnc = !touch.cancelable;
354 if(touch.type != WebInputEvent::TouchMove)
355 DCHECK_NE(ignores_ack, touch.cancelable);
353 } 356 }
354 357
355 // If we don't care about the ack disposition, send the ack immediately. 358 // If we don't care about the ack disposition, or it is an async touchmove
356 if (ignores_ack) { 359 // event, send the ack immediately.
360 if (ignores_ack || touch_move_aysnc) {
357 ProcessInputEventAck(input_event.type, 361 ProcessInputEventAck(input_event.type,
358 INPUT_EVENT_ACK_STATE_IGNORED, 362 INPUT_EVENT_ACK_STATE_IGNORED,
359 latency_info, 363 latency_info,
360 IGNORING_DISPOSITION); 364 IGNORING_DISPOSITION);
361 } 365 }
362 } 366 }
363 367
364 bool InputRouterImpl::OfferToClient(const WebInputEvent& input_event, 368 bool InputRouterImpl::OfferToClient(const WebInputEvent& input_event,
365 const ui::LatencyInfo& latency_info) { 369 const ui::LatencyInfo& latency_info) {
366 bool consumed = false; 370 bool consumed = false;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 // Log the time delta for processing an input event. 415 // Log the time delta for processing an input event.
412 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; 416 TimeDelta delta = TimeTicks::Now() - input_event_start_time_;
413 UMA_HISTOGRAM_TIMES("MPArch.IIR_InputEventDelta", delta); 417 UMA_HISTOGRAM_TIMES("MPArch.IIR_InputEventDelta", delta);
414 418
415 if (ack.overscroll) { 419 if (ack.overscroll) {
416 DCHECK(ack.type == WebInputEvent::MouseWheel || 420 DCHECK(ack.type == WebInputEvent::MouseWheel ||
417 ack.type == WebInputEvent::GestureScrollUpdate); 421 ack.type == WebInputEvent::GestureScrollUpdate);
418 OnDidOverscroll(*ack.overscroll); 422 OnDidOverscroll(*ack.overscroll);
419 } 423 }
420 424
425 // When we receive ACK from render for async touchmove events, we tell
426 // touch_event_queue right away so it will send out the next touch move in
427 // the queue.
428 if (ack.type == WebInputEvent::TouchMove &&
jdduke (slow) 2015/03/11 22:37:10 This seems like it could be racy. When a scroll se
429 touch_event_queue_.IsSendingTouchEventsAsync()) {
430 touch_event_queue_.ReceiveAsyncTouchMoveAck();
jdduke (slow) 2015/03/11 22:37:10 I'm a little concerned about the special interacti
431 }
432
421 ProcessInputEventAck(ack.type, ack.state, ack.latency, RENDERER); 433 ProcessInputEventAck(ack.type, ack.state, ack.latency, RENDERER);
422 // WARNING: |this| may be deleted at this point. 434 // WARNING: |this| may be deleted at this point.
423 435
424 // This is used only for testing, and the other end does not use the 436 // This is used only for testing, and the other end does not use the
425 // source object. On linux, specifying 437 // source object. On linux, specifying
426 // Source<RenderWidgetHost> results in a very strange 438 // Source<RenderWidgetHost> results in a very strange
427 // runtime error in the epilogue of the enclosing 439 // runtime error in the epilogue of the enclosing
428 // (ProcessInputEventAck) method, but not on other platforms; using 440 // (ProcessInputEventAck) method, but not on other platforms; using
429 // 'void' instead is just as safe (since NotificationSource 441 // 'void' instead is just as safe (since NotificationSource
430 // is not actually typesafe) and avoids this error. 442 // is not actually typesafe) and avoids this error.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 return !touch_event_queue_.empty() || 642 return !touch_event_queue_.empty() ||
631 !gesture_event_queue_.empty() || 643 !gesture_event_queue_.empty() ||
632 !key_queue_.empty() || 644 !key_queue_.empty() ||
633 mouse_move_pending_ || 645 mouse_move_pending_ ||
634 mouse_wheel_pending_ || 646 mouse_wheel_pending_ ||
635 select_message_pending_ || 647 select_message_pending_ ||
636 move_caret_pending_; 648 move_caret_pending_;
637 } 649 }
638 650
639 } // namespace content 651 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_event_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698