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..c7ee7a2cc6c2a4f4403e51890f28115733bf3639 100644 |
--- a/content/browser/renderer_host/input/touch_event_queue.h |
+++ b/content/browser/renderer_host/input/touch_event_queue.h |
@@ -61,10 +61,13 @@ class CONTENT_EXPORT TouchEventQueue { |
void QueueEvent(const TouchEventWithLatencyInfo& event); |
// Notifies the queue that a touch-event has been processed by the renderer. |
- // At this point, the queue may send one or more gesture events and/or |
- // additional queued touch-events to the renderer. |
+ // At this point, if the ack is for async touchmove, remove the uncancelable |
+ // touchmove from the front of the queue and decide if it should dispatch the |
+ // next pending async touch move event, otherwise the queue may send one or |
+ // more gesture events and/or additional queued touch-events to the renderer. |
void ProcessTouchAck(InputEventAckState ack_result, |
- const ui::LatencyInfo& latency_info); |
+ const ui::LatencyInfo& latency_info, |
+ const uint32 unique_touch_event_id); |
// When GestureScrollBegin is received, we send a touch cancel to renderer, |
// route all the following touch events directly to client, and ignore the |
@@ -102,6 +105,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; |
@@ -156,6 +163,7 @@ class CONTENT_EXPORT TouchEventQueue { |
void ForwardToRenderer(const TouchEventWithLatencyInfo& event); |
void UpdateTouchConsumerStates(const blink::WebTouchEvent& event, |
InputEventAckState ack_result); |
+ void FlushPendingAsyncTouchmove(); |
// Handles touch event forwarding and ack'ed event dispatch. |
TouchEventQueueClient* client_; |
@@ -171,8 +179,9 @@ class CONTENT_EXPORT TouchEventQueue { |
// True within the scope of |AckTouchEventToClient()|. |
bool dispatching_touch_ack_; |
- // Used to prevent touch timeout scheduling if we receive a synchronous |
- // ack after forwarding a touch event to the client. |
+ // Used to prevent touch timeout scheduling and increase the count for async |
+ // touchmove if we receive a synchronous ack after forwarding a touch event |
+ // to the client. |
bool dispatching_touch_; |
// Whether the renderer has at least one touch handler. |
@@ -202,6 +211,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<uint32> ack_pending_async_touchmove_; |
jdduke (slow)
2015/05/12 16:07:11
Maybe |ack_pending_async_touchmove_ids_|?
lanwei
2015/05/13 21:01:53
Done.
|
+ |
double last_sent_touch_timestamp_sec_; |
// Event is saved to compare pointer positions for new touchmove events. |