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_TOUCH_EVENT_QUEUE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 // Ack all coalesced events in |acked_event| to the client with |ack_result|, | 162 // Ack all coalesced events in |acked_event| to the client with |ack_result|, |
163 // updating the acked events with |optional_latency_info| if it exists. | 163 // updating the acked events with |optional_latency_info| if it exists. |
164 void AckTouchEventToClient(InputEventAckState ack_result, | 164 void AckTouchEventToClient(InputEventAckState ack_result, |
165 scoped_ptr<CoalescedWebTouchEvent> acked_event, | 165 scoped_ptr<CoalescedWebTouchEvent> acked_event, |
166 const ui::LatencyInfo* optional_latency_info); | 166 const ui::LatencyInfo* optional_latency_info); |
167 | 167 |
168 // Safely pop the head of the queue. | 168 // Safely pop the head of the queue. |
169 scoped_ptr<CoalescedWebTouchEvent> PopTouchEvent(); | 169 scoped_ptr<CoalescedWebTouchEvent> PopTouchEvent(); |
170 | 170 |
| 171 // Updates touches state in TouchMove event if touch position |
| 172 // has not been changed and should call SendTouchEventImmediately() |
| 173 void UpdateTouchesStateIfNeededAndSendTouchEvent( |
| 174 TouchEventWithLatencyInfo& touch); |
| 175 |
171 // Dispatch |touch| to the client. | 176 // Dispatch |touch| to the client. |
172 void SendTouchEventImmediately(const TouchEventWithLatencyInfo& touch); | 177 void SendTouchEventImmediately(const TouchEventWithLatencyInfo& touch); |
173 | 178 |
174 enum PreFilterResult { | 179 enum PreFilterResult { |
175 ACK_WITH_NO_CONSUMER_EXISTS, | 180 ACK_WITH_NO_CONSUMER_EXISTS, |
176 ACK_WITH_NOT_CONSUMED, | 181 ACK_WITH_NOT_CONSUMED, |
177 FORWARD_TO_RENDERER, | 182 FORWARD_TO_RENDERER, |
178 }; | 183 }; |
179 // Filter touches prior to forwarding to the renderer, e.g., if the renderer | 184 // Filter touches prior to forwarding to the renderer, e.g., if the renderer |
180 // has no touch handler. | 185 // has no touch handler. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 bool send_touch_events_async_; | 239 bool send_touch_events_async_; |
235 bool needs_async_touchmove_for_outer_slop_region_; | 240 bool needs_async_touchmove_for_outer_slop_region_; |
236 scoped_ptr<TouchEventWithLatencyInfo> pending_async_touchmove_; | 241 scoped_ptr<TouchEventWithLatencyInfo> pending_async_touchmove_; |
237 double last_sent_touch_timestamp_sec_; | 242 double last_sent_touch_timestamp_sec_; |
238 | 243 |
239 // How touch events are handled during scrolling. For now this is a global | 244 // How touch events are handled during scrolling. For now this is a global |
240 // setting for experimentation, but we may evolve it into an app-controlled | 245 // setting for experimentation, but we may evolve it into an app-controlled |
241 // mode. | 246 // mode. |
242 const TouchScrollingMode touch_scrolling_mode_; | 247 const TouchScrollingMode touch_scrolling_mode_; |
243 | 248 |
| 249 // TouchMove event is saved to compare touches position in next TouchMove |
| 250 scoped_ptr<TouchEventWithLatencyInfo> last_sent_touchmove_; |
| 251 |
244 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); | 252 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); |
245 }; | 253 }; |
246 | 254 |
247 } // namespace content | 255 } // namespace content |
248 | 256 |
249 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 257 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ |
OLD | NEW |