| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // immediately. | 86 // immediately. |
| 87 void QueueEvent(const GestureEventWithLatencyInfo&); | 87 void QueueEvent(const GestureEventWithLatencyInfo&); |
| 88 | 88 |
| 89 // Indicates that the caller has received an acknowledgement from the renderer | 89 // Indicates that the caller has received an acknowledgement from the renderer |
| 90 // with state |ack_result| and event |type|. May send events if the queue is | 90 // with state |ack_result| and event |type|. May send events if the queue is |
| 91 // not empty. | 91 // not empty. |
| 92 void ProcessGestureAck(InputEventAckState ack_result, | 92 void ProcessGestureAck(InputEventAckState ack_result, |
| 93 blink::WebInputEvent::Type type, | 93 blink::WebInputEvent::Type type, |
| 94 const ui::LatencyInfo& latency); | 94 const ui::LatencyInfo& latency); |
| 95 | 95 |
| 96 // Sets the state of the |fling_in_progress_| field to indicate that a fling | 96 // Notify the queue that a gesture fling animation in the renderer has ended. |
| 97 // is definitely not in progress. | 97 void DidStopFlinging(); |
| 98 void FlingHasBeenHalted(); | |
| 99 | 98 |
| 100 // Returns the |TouchpadTapSuppressionController| instance. | 99 // Returns the |TouchpadTapSuppressionController| instance. |
| 101 TouchpadTapSuppressionController* GetTouchpadTapSuppressionController(); | 100 TouchpadTapSuppressionController* GetTouchpadTapSuppressionController(); |
| 102 | 101 |
| 103 void ForwardGestureEvent(const GestureEventWithLatencyInfo& gesture_event); | 102 void ForwardGestureEvent(const GestureEventWithLatencyInfo& gesture_event); |
| 104 | 103 |
| 105 bool empty() const { | 104 bool empty() const { |
| 106 return coalesced_gesture_events_.empty() && | 105 return coalesced_gesture_events_.empty() && |
| 107 debouncing_deferral_queue_.empty(); | 106 debouncing_deferral_queue_.empty(); |
| 108 } | 107 } |
| 109 | 108 |
| 109 int active_fling_count() const { return active_fling_count_; } |
| 110 |
| 110 void set_debounce_interval_time_ms_for_testing(int interval_ms) { | 111 void set_debounce_interval_time_ms_for_testing(int interval_ms) { |
| 111 debounce_interval_ = base::TimeDelta::FromMilliseconds(interval_ms); | 112 debounce_interval_ = base::TimeDelta::FromMilliseconds(interval_ms); |
| 112 } | 113 } |
| 113 | 114 |
| 114 private: | 115 private: |
| 115 friend class GestureEventQueueTest; | 116 friend class GestureEventQueueTest; |
| 116 friend class MockRenderWidgetHost; | 117 friend class MockRenderWidgetHost; |
| 117 | 118 |
| 118 // TODO(mohsen): There are a bunch of ShouldForward.../ShouldDiscard... | 119 // TODO(mohsen): There are a bunch of ShouldForward.../ShouldDiscard... |
| 119 // methods that are getting confusing. This should be somehow fixed. Maybe | 120 // methods that are getting confusing. This should be somehow fixed. Maybe |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 void QueueScrollOrPinchAndForwardIfNecessary( | 152 void QueueScrollOrPinchAndForwardIfNecessary( |
| 152 const GestureEventWithLatencyInfo& gesture_event); | 153 const GestureEventWithLatencyInfo& gesture_event); |
| 153 | 154 |
| 154 // The number of sent events for which we're awaiting an ack. These events | 155 // The number of sent events for which we're awaiting an ack. These events |
| 155 // remain at the head of the queue until ack'ed. | 156 // remain at the head of the queue until ack'ed. |
| 156 size_t EventsInFlightCount() const; | 157 size_t EventsInFlightCount() const; |
| 157 | 158 |
| 158 // The receiver of all forwarded gesture events. | 159 // The receiver of all forwarded gesture events. |
| 159 GestureEventQueueClient* client_; | 160 GestureEventQueueClient* client_; |
| 160 | 161 |
| 161 // True if a GestureFlingStart is in progress on the renderer or | 162 // Whether there are any active flings in the renderer. As the fling |
| 162 // queued without a subsequent queued GestureFlingCancel event. | 163 // end notification is asynchronous, we use a count rather than a boolean |
| 163 bool fling_in_progress_; | 164 // to avoid races in bookkeeping when starting a new fling. |
| 165 int active_fling_count_; |
| 164 | 166 |
| 165 // True if a GestureScrollUpdate sequence is in progress. | 167 // True if a GestureScrollUpdate sequence is in progress. |
| 166 bool scrolling_in_progress_; | 168 bool scrolling_in_progress_; |
| 167 | 169 |
| 168 // True if two related gesture events were sent before without waiting | 170 // True if two related gesture events were sent before without waiting |
| 169 // for an ACK, so the next gesture ACK should be ignored. | 171 // for an ACK, so the next gesture ACK should be ignored. |
| 170 bool ignore_next_ack_; | 172 bool ignore_next_ack_; |
| 171 | 173 |
| 172 // An object tracking the state of touchpad on the delivery of mouse events to | 174 // An object tracking the state of touchpad on the delivery of mouse events to |
| 173 // the renderer to filter mouse immediately after a touchpad fling canceling | 175 // the renderer to filter mouse immediately after a touchpad fling canceling |
| (...skipping 26 matching lines...) Expand all Loading... |
| 200 // Time window in which to debounce scroll/fling ends. Note that an interval | 202 // Time window in which to debounce scroll/fling ends. Note that an interval |
| 201 // of zero effectively disables debouncing. | 203 // of zero effectively disables debouncing. |
| 202 base::TimeDelta debounce_interval_; | 204 base::TimeDelta debounce_interval_; |
| 203 | 205 |
| 204 DISALLOW_COPY_AND_ASSIGN(GestureEventQueue); | 206 DISALLOW_COPY_AND_ASSIGN(GestureEventQueue); |
| 205 }; | 207 }; |
| 206 | 208 |
| 207 } // namespace content | 209 } // namespace content |
| 208 | 210 |
| 209 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ | 211 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ |
| OLD | NEW |