Chromium Code Reviews| 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..b3382b7370d19bf33c875a280003458ea34ea3f8 100644 |
| --- a/content/browser/renderer_host/input/touch_event_queue.h |
| +++ b/content/browser/renderer_host/input/touch_event_queue.h |
| @@ -61,10 +61,19 @@ 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); |
| + |
| + // 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(); |
|
jdduke (slow)
2015/05/08 21:30:49
I think we can remove this function.
lanwei
2015/05/11 19:27:56
Done.
|
| // 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 +111,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 +169,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 +185,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 +217,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_; |
| + |
| double last_sent_touch_timestamp_sec_; |
| // Event is saved to compare pointer positions for new touchmove events. |