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 // Dispatch |touch| to the client. | 171 // Dispatch |touch| to the client. Before dispatching, updates touches state |
172 void SendTouchEventImmediately(const TouchEventWithLatencyInfo& touch); | 172 // in touchmove event if touch position has not been changed |
| 173 void SendTouchEventImmediately(TouchEventWithLatencyInfo* touch); |
173 | 174 |
174 enum PreFilterResult { | 175 enum PreFilterResult { |
175 ACK_WITH_NO_CONSUMER_EXISTS, | 176 ACK_WITH_NO_CONSUMER_EXISTS, |
176 ACK_WITH_NOT_CONSUMED, | 177 ACK_WITH_NOT_CONSUMED, |
177 FORWARD_TO_RENDERER, | 178 FORWARD_TO_RENDERER, |
178 }; | 179 }; |
179 // Filter touches prior to forwarding to the renderer, e.g., if the renderer | 180 // Filter touches prior to forwarding to the renderer, e.g., if the renderer |
180 // has no touch handler. | 181 // has no touch handler. |
181 PreFilterResult FilterBeforeForwarding(const blink::WebTouchEvent& event); | 182 PreFilterResult FilterBeforeForwarding(const blink::WebTouchEvent& event); |
182 void ForwardToRenderer(const TouchEventWithLatencyInfo& event); | 183 void ForwardToRenderer(const TouchEventWithLatencyInfo& event); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 bool send_touch_events_async_; | 235 bool send_touch_events_async_; |
235 bool needs_async_touchmove_for_outer_slop_region_; | 236 bool needs_async_touchmove_for_outer_slop_region_; |
236 scoped_ptr<TouchEventWithLatencyInfo> pending_async_touchmove_; | 237 scoped_ptr<TouchEventWithLatencyInfo> pending_async_touchmove_; |
237 double last_sent_touch_timestamp_sec_; | 238 double last_sent_touch_timestamp_sec_; |
238 | 239 |
239 // How touch events are handled during scrolling. For now this is a global | 240 // 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 | 241 // setting for experimentation, but we may evolve it into an app-controlled |
241 // mode. | 242 // mode. |
242 const TouchScrollingMode touch_scrolling_mode_; | 243 const TouchScrollingMode touch_scrolling_mode_; |
243 | 244 |
| 245 // Touch event is saved to compare touches position in next TouchMove event |
| 246 scoped_ptr<blink::WebTouchEvent> last_sent_touchevent_; |
| 247 |
244 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); | 248 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); |
245 }; | 249 }; |
246 | 250 |
247 } // namespace content | 251 } // namespace content |
248 | 252 |
249 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 253 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ |
OLD | NEW |