OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_PASSTHROUGH_TOUCH_EVENT_QUEUE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_PASSTHROUGH_TOUCH_EVENT_QUEUE_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_PASSTHROUGH_TOUCH_EVENT_QUEUE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_PASSTHROUGH_TOUCH_EVENT_QUEUE_H_ |
7 | 7 |
8 #include "content/browser/renderer_host/input/touch_event_queue.h" | 8 #include "content/browser/renderer_host/input/touch_event_queue.h" |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 class TouchTimeoutHandler; | 14 class TouchTimeoutHandler; |
15 class TouchMoveSlopSuppressor; | |
16 | 15 |
17 // A queue that processes a touch-event and forwards it on to the | 16 // A queue that processes a touch-event and forwards it on to the |
18 // renderer process immediately. This class assumes that queueing will | 17 // renderer process immediately. This class assumes that queueing will |
19 // happen inside the renderer process. This class will hold onto the pending | 18 // happen inside the renderer process. This class will hold onto the pending |
20 // events so that it can re-order the acks so that they appear in a | 19 // events so that it can re-order the acks so that they appear in a |
21 // logical order to the rest of the browser process. Due to the threaded | 20 // logical order to the rest of the browser process. Due to the threaded |
22 // model of the renderer it is possible that an ack for a touchend can | 21 // model of the renderer it is possible that an ack for a touchend can |
23 // be sent before the corresponding ack for the touchstart. This class | 22 // be sent before the corresponding ack for the touchstart. This class |
24 // corrects that state. | 23 // corrects that state. |
25 class CONTENT_EXPORT PassthroughTouchEventQueue : public TouchEventQueue { | 24 class CONTENT_EXPORT PassthroughTouchEventQueue : public TouchEventQueue { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // Whether any pointer in the touch sequence may have having a consumer. | 108 // Whether any pointer in the touch sequence may have having a consumer. |
110 bool maybe_has_handler_for_current_sequence_; | 109 bool maybe_has_handler_for_current_sequence_; |
111 | 110 |
112 // Whether to allow any remaining touches for the current sequence. Note that | 111 // Whether to allow any remaining touches for the current sequence. Note that |
113 // this is a stricter condition than an empty |touch_consumer_states_|, as it | 112 // this is a stricter condition than an empty |touch_consumer_states_|, as it |
114 // also prevents forwarding of touchstart events for new pointers in the | 113 // also prevents forwarding of touchstart events for new pointers in the |
115 // current sequence. This is only used when the event is synthetically | 114 // current sequence. This is only used when the event is synthetically |
116 // cancelled after a touch timeout. | 115 // cancelled after a touch timeout. |
117 bool drop_remaining_touches_in_sequence_; | 116 bool drop_remaining_touches_in_sequence_; |
118 | 117 |
119 // Suppresses TouchMove's within a slop region when a sequence has not yet | |
120 // been preventDefaulted. | |
121 std::unique_ptr<TouchMoveSlopSuppressor> touchmove_slop_suppressor_; | |
122 | |
123 // Optional handler for timed-out touch event acks. | 118 // Optional handler for timed-out touch event acks. |
124 std::unique_ptr<TouchTimeoutHandler> timeout_handler_; | 119 std::unique_ptr<TouchTimeoutHandler> timeout_handler_; |
125 | 120 |
126 // Whether touch events should be sent as uncancelable or not. | 121 // Whether touch events should be sent as uncancelable or not. |
127 bool send_touch_events_async_; | 122 bool send_touch_events_async_; |
128 | 123 |
129 // Event is saved to compare pointer positions for new touchmove events. | 124 // Event is saved to compare pointer positions for new touchmove events. |
130 std::unique_ptr<blink::WebTouchEvent> last_sent_touchevent_; | 125 std::unique_ptr<blink::WebTouchEvent> last_sent_touchevent_; |
131 | 126 |
132 // Stores outstanding touches that have been sent to the renderer but have | 127 // Stores outstanding touches that have been sent to the renderer but have |
133 // not yet been ack'd by the renderer. The set is explicitly ordered based | 128 // not yet been ack'd by the renderer. The set is explicitly ordered based |
134 // on the unique touch event id. | 129 // on the unique touch event id. |
135 std::set<TouchEventWithLatencyInfoAndAckState> outstanding_touches_; | 130 std::set<TouchEventWithLatencyInfoAndAckState> outstanding_touches_; |
136 | 131 |
137 DISALLOW_COPY_AND_ASSIGN(PassthroughTouchEventQueue); | 132 DISALLOW_COPY_AND_ASSIGN(PassthroughTouchEventQueue); |
138 }; | 133 }; |
139 | 134 |
140 } // namespace content | 135 } // namespace content |
141 | 136 |
142 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_PASSTHROUGH_TOUCH_EVENT_QUEUE_H_ | 137 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_PASSTHROUGH_TOUCH_EVENT_QUEUE_H_ |
OLD | NEW |