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 a3053c4e9b0b7bc95ca1c3fa3a277e0cf0adf0ba..7b19ea04f9736f167bdb2a6c540790b7133bf17b 100644 |
| --- a/content/browser/renderer_host/input/touch_event_queue.h |
| +++ b/content/browser/renderer_host/input/touch_event_queue.h |
| @@ -38,7 +38,7 @@ class CONTENT_EXPORT TouchEventQueue { |
| // The |client| must outlive the TouchEventQueue. |
| explicit TouchEventQueue(TouchEventQueueClient* client); |
| - virtual ~TouchEventQueue(); |
| + ~TouchEventQueue(); |
| // Adds an event to the queue. The event may be coalesced with previously |
| // queued events (e.g. consecutive touch-move events can be coalesced into a |
| @@ -54,28 +54,38 @@ class CONTENT_EXPORT TouchEventQueue { |
| // 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 GestureScrollEnd/GestureFlingStart is |
| - // received, we resume the normal flow of sending touch events to renderer. |
| + // ack for the touch cancel. When Gesture{ScrollEnd,FlingStart} is received, |
| + // resume the normal flow of sending touch events to the renderer. |
| void OnGestureScrollEvent(const GestureEventWithLatencyInfo& gesture_event); |
| // Empties the queue of touch events. This may result in any number of gesture |
| // events being sent to the renderer. |
| void FlushQueue(); |
| - // Returns whether the event-queue is empty. |
| + // Toggle whether a delayed touch ack will cancel and flush the current |
|
sadrul
2013/12/06 07:35:18
s/Toggle/Sets/
jdduke (slow)
2013/12/06 17:17:20
Done.
|
| + // touch sequence. |
| + void SetAckTimeoutEnabled(bool enabled, size_t ack_timeout_delay_ms); |
| + |
| bool empty() const WARN_UNUSED_RESULT { |
| return touch_queue_.empty(); |
| } |
| - bool no_touch_to_renderer() const { |
| - return no_touch_to_renderer_; |
| + size_t size() const { |
| + return touch_queue_.size(); |
| + } |
| + |
| + bool ack_timeout_enabled() const { |
| + return ack_timeout_enabled_; |
| } |
| private: |
| + class TouchTimeoutHandler; |
| + friend class TouchTimeoutHandler; |
| friend class TouchEventQueueTest; |
| - size_t GetQueueSize() const; |
| - const TouchEventWithLatencyInfo& GetLatestEvent() const; |
| + bool HasTimeoutEvent() const; |
| + bool IsTimeoutRunningForTesting() const; |
| + const TouchEventWithLatencyInfo& GetLatestEventForTesting() const; |
| // Walks the queue, checking each event for |ShouldForwardToRenderer()|. |
| // If true, forwards the touch event and stops processing further events. |
| @@ -88,6 +98,10 @@ class CONTENT_EXPORT TouchEventQueue { |
| const ui::LatencyInfo& renderer_latency_info); |
| bool ShouldForwardToRenderer(const blink::WebTouchEvent& event) const; |
| + void ForwardToRenderer(const TouchEventWithLatencyInfo& event); |
| + void UpdateTouchAckStates(const blink::WebTouchEvent& event, |
| + InputEventAckState ack_result); |
| + |
| // Handles touch event forwarding and ack'ed event dispatch. |
| TouchEventQueueClient* client_; |
| @@ -104,11 +118,21 @@ class CONTENT_EXPORT TouchEventQueue { |
| // is being dispatched. |
| CoalescedWebTouchEvent* dispatching_touch_ack_; |
| - // Don't send touch events to renderer. This is enabled when the page |
| - // is scrolling. This behaviour is currently enabled only on aura behind |
| - // a flag. |
| + // Used to prevent touch timeout scheduling if we receive a synchronous |
| + // ack after forwarding a touch event to the client. |
| + bool dispatching_touch_; |
| + |
| + // Don't send touch events to the renderer while scrolling. |
| bool no_touch_to_renderer_; |
| + // Whether an event in the current TouchStart sequence was consumed by the |
| + // renderer. The touch timeout will never be activated when this is true. |
| + bool renderer_is_consuming_gesture_; |
|
sadrul
2013/12/06 07:35:18
renderer_is_consuming_touch_?
jdduke (slow)
2013/12/06 17:17:20
Hmm, I'd like it to be specific about this particu
|
| + |
| + // Optional handler for timed-out touch event acks, disabled by default. |
| + bool ack_timeout_enabled_; |
| + scoped_ptr<TouchTimeoutHandler> timeout_handler_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); |
| }; |