| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_LEGACY_TOUCH_EVENT_QUEUE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_LEGACY_TOUCH_EVENT_QUEUE_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_LEGACY_TOUCH_EVENT_QUEUE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_LEGACY_TOUCH_EVENT_QUEUE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 size_t size() const { return touch_queue_.size(); } | 89 size_t size() const { return touch_queue_.size(); } |
| 90 | 90 |
| 91 bool has_handlers() const { return has_handlers_; } | 91 bool has_handlers() const { return has_handlers_; } |
| 92 | 92 |
| 93 size_t uncancelable_touch_moves_pending_ack_count() const { | 93 size_t uncancelable_touch_moves_pending_ack_count() const { |
| 94 return ack_pending_async_touchmove_ids_.size(); | 94 return ack_pending_async_touchmove_ids_.size(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 class TouchTimeoutHandler; | 98 class TouchTimeoutHandler; |
| 99 class TouchMoveSlopSuppressor; | |
| 100 friend class TouchTimeoutHandler; | 99 friend class TouchTimeoutHandler; |
| 101 friend class TouchEventQueueTest; | 100 friend class TouchEventQueueTest; |
| 102 | 101 |
| 103 bool HasPendingAsyncTouchMoveForTesting() const; | 102 bool HasPendingAsyncTouchMoveForTesting() const; |
| 104 bool IsTimeoutRunningForTesting() const; | 103 bool IsTimeoutRunningForTesting() const; |
| 105 const TouchEventWithLatencyInfo& GetLatestEventForTesting() const; | 104 const TouchEventWithLatencyInfo& GetLatestEventForTesting() const; |
| 106 | 105 |
| 107 // Empties the queue of touch events. This may result in any number of gesture | 106 // Empties the queue of touch events. This may result in any number of gesture |
| 108 // events being sent to the renderer. | 107 // events being sent to the renderer. |
| 109 void FlushQueue(); | 108 void FlushQueue(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // Whether to allow any remaining touches for the current sequence. Note that | 173 // Whether to allow any remaining touches for the current sequence. Note that |
| 175 // this is a stricter condition than an empty |touch_consumer_states_|, as it | 174 // this is a stricter condition than an empty |touch_consumer_states_|, as it |
| 176 // also prevents forwarding of touchstart events for new pointers in the | 175 // also prevents forwarding of touchstart events for new pointers in the |
| 177 // current sequence. This is only used when the event is synthetically | 176 // current sequence. This is only used when the event is synthetically |
| 178 // cancelled after a touch timeout. | 177 // cancelled after a touch timeout. |
| 179 bool drop_remaining_touches_in_sequence_; | 178 bool drop_remaining_touches_in_sequence_; |
| 180 | 179 |
| 181 // Optional handler for timed-out touch event acks. | 180 // Optional handler for timed-out touch event acks. |
| 182 std::unique_ptr<TouchTimeoutHandler> timeout_handler_; | 181 std::unique_ptr<TouchTimeoutHandler> timeout_handler_; |
| 183 | 182 |
| 184 // Suppression of TouchMove's within a slop region when a sequence has not yet | |
| 185 // been preventDefaulted. | |
| 186 std::unique_ptr<TouchMoveSlopSuppressor> touchmove_slop_suppressor_; | |
| 187 | |
| 188 // Whether touch events should remain buffered and dispatched asynchronously | 183 // Whether touch events should remain buffered and dispatched asynchronously |
| 189 // while a scroll sequence is active. In this mode, touchmove's are throttled | 184 // while a scroll sequence is active. In this mode, touchmove's are throttled |
| 190 // and ack'ed immediately, but remain buffered in |pending_async_touchmove_| | 185 // and ack'ed immediately, but remain buffered in |pending_async_touchmove_| |
| 191 // until a sufficient time period has elapsed since the last sent touch event. | 186 // until a sufficient time period has elapsed since the last sent touch event. |
| 192 // For details see the design doc at http://goo.gl/lVyJAa. | 187 // For details see the design doc at http://goo.gl/lVyJAa. |
| 193 bool send_touch_events_async_; | 188 bool send_touch_events_async_; |
| 194 std::unique_ptr<TouchEventWithLatencyInfo> pending_async_touchmove_; | 189 std::unique_ptr<TouchEventWithLatencyInfo> pending_async_touchmove_; |
| 195 | 190 |
| 196 // For uncancelable touch moves, not only we send a fake ack, but also a real | 191 // For uncancelable touch moves, not only we send a fake ack, but also a real |
| 197 // ack from render, which we use to decide when to send the next async | 192 // ack from render, which we use to decide when to send the next async |
| 198 // touchmove. This can help avoid the touch event queue keep growing when | 193 // touchmove. This can help avoid the touch event queue keep growing when |
| 199 // render handles touchmove slow. We use a queue | 194 // render handles touchmove slow. We use a queue |
| 200 // ack_pending_async_touchmove_ids to store the recent dispatched | 195 // ack_pending_async_touchmove_ids to store the recent dispatched |
| 201 // uncancelable touchmoves which are still waiting for their acks back from | 196 // uncancelable touchmoves which are still waiting for their acks back from |
| 202 // render. We do not put them back to the front the touch_event_queue any | 197 // render. We do not put them back to the front the touch_event_queue any |
| 203 // more. | 198 // more. |
| 204 std::deque<uint32_t> ack_pending_async_touchmove_ids_; | 199 std::deque<uint32_t> ack_pending_async_touchmove_ids_; |
| 205 | 200 |
| 206 double last_sent_touch_timestamp_sec_; | 201 double last_sent_touch_timestamp_sec_; |
| 207 | 202 |
| 208 // Event is saved to compare pointer positions for new touchmove events. | 203 // Event is saved to compare pointer positions for new touchmove events. |
| 209 std::unique_ptr<blink::WebTouchEvent> last_sent_touchevent_; | 204 std::unique_ptr<blink::WebTouchEvent> last_sent_touchevent_; |
| 210 | 205 |
| 211 DISALLOW_COPY_AND_ASSIGN(LegacyTouchEventQueue); | 206 DISALLOW_COPY_AND_ASSIGN(LegacyTouchEventQueue); |
| 212 }; | 207 }; |
| 213 | 208 |
| 214 } // namespace content | 209 } // namespace content |
| 215 | 210 |
| 216 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_LEGACY_TOUCH_EVENT_QUEUE_H_ | 211 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_LEGACY_TOUCH_EVENT_QUEUE_H_ |
| OLD | NEW |