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..a2e13c0dcd3e0887314c6c65f20a211b4e3c7040 100644 |
--- a/content/browser/renderer_host/input/touch_event_queue.cc |
+++ b/content/browser/renderer_host/input/touch_event_queue.cc |
@@ -372,6 +372,7 @@ TouchEventQueue::TouchEventQueue(TouchEventQueueClient* client, |
drop_remaining_touches_in_sequence_(false), |
touchmove_slop_suppressor_(new TouchMoveSlopSuppressor), |
send_touch_events_async_(false), |
+ sent_uncancelable_touch_move_count_(0), |
last_sent_touch_timestamp_sec_(0) { |
DCHECK(client); |
if (config.touch_ack_timeout_supported) { |
@@ -433,11 +434,32 @@ void TouchEventQueue::ProcessTouchAck(InputEventAckState ack_result, |
if (touch_queue_.empty()) |
return; |
- |
tdresser
2015/03/26 15:25:28
Put back whitespace.
lanwei
2015/03/27 04:39:41
Done.
|
PopTouchEventToClient(ack_result, latency_info); |
TryForwardNextEventToRenderer(); |
} |
+void TouchEventQueue::ProcessUncancelableTouchMoveAck() { |
+ TRACE_EVENT0("input", "TouchEventQueue::ProcessUncancelableTouchMoveAck"); |
+ |
+ DCHECK(!dispatching_touch_ack_); |
+ dispatching_touch_ = false; |
+ |
+ // Decrease the count once we receive the ack back from render for |
+ // uncancelable touchmoves. |
+ --sent_uncancelable_touch_move_count_; |
+ |
+ // Send the next pending async touch move once we receive the ack. |
+ if (pending_async_touchmove_) { |
tdresser
2015/03/26 15:25:28
Shouldn't we only dispatch the pending async touch
lanwei
2015/03/27 04:39:41
Done.
|
+ TouchEventWithLatencyInfo touch = *pending_async_touchmove_; |
+ touch.event.cancelable = !send_touch_events_async_; |
+ pending_async_touchmove_.reset(); |
+ if (!touch.event.cancelable) |
+ ++sent_uncancelable_touch_move_count_; |
+ touch_queue_.push_front(new CoalescedWebTouchEvent(touch, true)); |
+ SendTouchEventImmediately(&touch); |
+ } |
+} |
+ |
void TouchEventQueue::TryForwardNextEventToRenderer() { |
DCHECK(!dispatching_touch_ack_); |
// If there are queued touch events, then try to forward them to the renderer |
@@ -465,7 +487,6 @@ void TouchEventQueue::ForwardNextEventToRenderer() { |
DCHECK(!empty()); |
DCHECK(!dispatching_touch_); |
TouchEventWithLatencyInfo touch = touch_queue_.front()->coalesced_event(); |
- |
tdresser
2015/03/26 15:25:28
Put back whitespace.
lanwei
2015/03/27 04:39:41
Done.
|
if (send_touch_events_async_ && |
touch.event.type == WebInputEvent::TouchMove) { |
// Throttling touchmove's in a continuous touchmove stream while scrolling |
@@ -480,7 +501,7 @@ void TouchEventQueue::ForwardNextEventToRenderer() { |
touch.event.timeStampSeconds >= |
last_sent_touch_timestamp_sec_ + kAsyncTouchMoveIntervalSec; |
- if (!send_touchmove_now) { |
+ if (!send_touchmove_now || sent_uncancelable_touch_move_count_ > 0) { |
if (!pending_async_touchmove_) { |
pending_async_touchmove_.reset(new TouchEventWithLatencyInfo(touch)); |
} else { |
@@ -499,7 +520,6 @@ void TouchEventQueue::ForwardNextEventToRenderer() { |
} |
last_sent_touch_timestamp_sec_ = touch.event.timeStampSeconds; |
- |
// Flush any pending async touch move. If it can be combined with the current |
// (touchmove) event, great, otherwise send it immediately but separately. Its |
// ack will trigger forwarding of the original |touch| event. |
@@ -510,6 +530,10 @@ void TouchEventQueue::ForwardNextEventToRenderer() { |
touch = *pending_async_touchmove_; |
pending_async_touchmove_.reset(); |
} else { |
+ // Once we flush the pending async touch move, we ignore all the acks |
+ // from the uncancelable touch moves that we sent out and wait for acks |
+ // back. |
+ ++sent_uncancelable_touch_move_count_; |
tdresser
2015/03/26 15:25:28
Could we increase the count inside SendTouchEventI
lanwei
2015/03/27 04:39:41
Done.
|
scoped_ptr<TouchEventWithLatencyInfo> async_move = |
pending_async_touchmove_.Pass(); |
async_move->event.cancelable = false; |
@@ -528,6 +552,11 @@ void TouchEventQueue::ForwardNextEventToRenderer() { |
// A synchronous ack will reset |dispatching_touch_|, in which case |
// the touch timeout should not be started. |
base::AutoReset<bool> dispatching_touch(&dispatching_touch_, true); |
+ |
+ // We increase the count when we send out a uncancelable touch move. |
+ if (touch.event.type == WebInputEvent::TouchMove && !touch.event.cancelable) { |
+ ++sent_uncancelable_touch_move_count_; |
+ } |
SendTouchEventImmediately(&touch); |
if (dispatching_touch_ && timeout_handler_) |
timeout_handler_->StartIfNecessary(touch); |