Index: content/browser/renderer_host/input/touch_event_queue.h |
diff --git a/content/browser/renderer_host/input/touch_event_queue.h b/content/browser/renderer_host/input/touch_event_queue.h |
index a61b90d8eca8c1707d31b3e9bfbadabb175047a0..ef91177c0eef2d2c906e71dfd59e715467dca333 100644 |
--- a/content/browser/renderer_host/input/touch_event_queue.h |
+++ b/content/browser/renderer_host/input/touch_event_queue.h |
@@ -66,6 +66,12 @@ class CONTENT_EXPORT TouchEventQueue { |
void ProcessTouchAck(InputEventAckState ack_result, |
const ui::LatencyInfo& latency_info); |
+ // Notifies the queue that an uncancelable touchmove event has been received |
+ // by the renderer. The queue will decrease the uncancelable pending |
+ // touchmove ack count and decide if it should dispatch the next pending |
+ // async touch move event. |
+ void ProcessUncancelableTouchMoveAck(); |
+ |
// When GestureScrollBegin is received, we send a touch cancel to renderer, |
// route all the following touch events directly to client, and ignore the |
// ack for the touch cancel. When Gesture{ScrollEnd,FlingStart} is received, |
@@ -102,6 +108,10 @@ class CONTENT_EXPORT TouchEventQueue { |
bool has_handlers() const { return has_handlers_; } |
+ size_t uncancelable_touch_moves_pending_ack_count() const { |
+ return ack_pending_async_touchmove_.size(); |
+ } |
+ |
private: |
class TouchTimeoutHandler; |
class TouchMoveSlopSuppressor; |
@@ -202,6 +212,16 @@ class CONTENT_EXPORT TouchEventQueue { |
// For details see the design doc at http://goo.gl/lVyJAa. |
bool send_touch_events_async_; |
scoped_ptr<TouchEventWithLatencyInfo> pending_async_touchmove_; |
+ |
+ // For uncancelable touch moves, not only we send a fake ack, but also a real |
+ // ack from render, which we use to decide when to send the next async |
+ // touchmove. This can help avoid the touch event queue keep growing when |
+ // render handles touchmove slow. We use a queue ack_pending_async_touchmove_ |
+ // to store the recent dispatched uncancelable touchmoves which are still |
+ // waiting for their acks back from render. We do not put them back to the |
+ // front the touch_event_queue any more. |
+ std::deque<TouchEventWithLatencyInfo> ack_pending_async_touchmove_; |
+ |
double last_sent_touch_timestamp_sec_; |
// Event is saved to compare pointer positions for new touchmove events. |