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

Unified Diff: content/browser/renderer_host/input/touch_event_queue.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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/touch_event_queue.cc
diff --git a/content/browser/renderer_host/input/touch_event_queue.cc b/content/browser/renderer_host/input/touch_event_queue.cc
index b766b3d1b51530ec4b49d9685cde78ebb302b525..b8af78f43443977c1867ae959f3a0a0418842891 100644
--- a/content/browser/renderer_host/input/touch_event_queue.cc
+++ b/content/browser/renderer_host/input/touch_event_queue.cc
@@ -372,7 +372,8 @@ TouchEventQueue::TouchEventQueue(TouchEventQueueClient* client,
drop_remaining_touches_in_sequence_(false),
touchmove_slop_suppressor_(new TouchMoveSlopSuppressor),
send_touch_events_async_(false),
- last_sent_touch_timestamp_sec_(0) {
+ last_sent_touch_timestamp_sec_(0),
+ receiving_async_touch_move_ack_(false) {
DCHECK(client);
if (config.touch_ack_timeout_supported) {
timeout_handler_.reset(
@@ -434,7 +435,11 @@ void TouchEventQueue::ProcessTouchAck(InputEventAckState ack_result,
if (touch_queue_.empty())
return;
- PopTouchEventToClient(ack_result, latency_info);
+ // If we receive the ACK from render for async touch moves, we do not call
+ // this function again, because it has already been called by the fake ACK.
+ if(!receiving_async_touch_move_ack_)
+ PopTouchEventToClient(ack_result, latency_info);
+
TryForwardNextEventToRenderer();
}
@@ -480,7 +485,9 @@ void TouchEventQueue::ForwardNextEventToRenderer() {
touch.event.timeStampSeconds >=
last_sent_touch_timestamp_sec_ + kAsyncTouchMoveIntervalSec;
- if (!send_touchmove_now) {
+ // We send the next async touchmove after an interval of
+ // kAsyncTouchMoveIntervalSec and receive the ACK back from render.
+ if (!send_touchmove_now || !receiving_async_touch_move_ack_) {
if (!pending_async_touchmove_) {
pending_async_touchmove_.reset(new TouchEventWithLatencyInfo(touch));
} else {
@@ -496,6 +503,8 @@ void TouchEventQueue::ForwardNextEventToRenderer() {
TryForwardNextEventToRenderer();
return;
}
+
+ receiving_async_touch_move_ack_ = false;
}
last_sent_touch_timestamp_sec_ = touch.event.timeStampSeconds;

Powered by Google App Engine
This is Rietveld 408576698