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 #include "content/browser/renderer_host/input/gesture_event_queue.h" | 5 #include "content/browser/renderer_host/input/gesture_event_queue.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "content/browser/renderer_host/input/input_router.h" | 9 #include "content/browser/renderer_host/input/input_router.h" |
10 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle
r.h" | 10 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle
r.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 bool GestureEventQueue::ShouldHandleEventNow() const { | 238 bool GestureEventQueue::ShouldHandleEventNow() const { |
239 return coalesced_gesture_events_.size() == 1; | 239 return coalesced_gesture_events_.size() == 1; |
240 } | 240 } |
241 | 241 |
242 void GestureEventQueue::ForwardGestureEvent( | 242 void GestureEventQueue::ForwardGestureEvent( |
243 const GestureEventWithLatencyInfo& gesture_event) { | 243 const GestureEventWithLatencyInfo& gesture_event) { |
244 if (ShouldForwardForCoalescing(gesture_event)) | 244 if (ShouldForwardForCoalescing(gesture_event)) |
245 client_->SendGestureEventImmediately(gesture_event); | 245 client_->SendGestureEventImmediately(gesture_event); |
246 } | 246 } |
247 | 247 |
| 248 void GestureEventQueue::Recycle() { |
| 249 fling_in_progress_ = false; |
| 250 scrolling_in_progress_ = false; |
| 251 ignore_next_ack_ = false; |
| 252 coalesced_gesture_events_.clear(); |
| 253 debouncing_deferral_queue_.clear(); |
| 254 touchpad_tap_suppression_controller_.Reset(); |
| 255 touchscreen_tap_suppression_controller_.Reset(); |
| 256 } |
| 257 |
248 void GestureEventQueue::SendScrollEndingEventsNow() { | 258 void GestureEventQueue::SendScrollEndingEventsNow() { |
249 scrolling_in_progress_ = false; | 259 scrolling_in_progress_ = false; |
250 if (debouncing_deferral_queue_.empty()) | 260 if (debouncing_deferral_queue_.empty()) |
251 return; | 261 return; |
252 GestureQueue debouncing_deferral_queue; | 262 GestureQueue debouncing_deferral_queue; |
253 debouncing_deferral_queue.swap(debouncing_deferral_queue_); | 263 debouncing_deferral_queue.swap(debouncing_deferral_queue_); |
254 for (GestureQueue::const_iterator it = debouncing_deferral_queue.begin(); | 264 for (GestureQueue::const_iterator it = debouncing_deferral_queue.begin(); |
255 it != debouncing_deferral_queue.end(); it++) { | 265 it != debouncing_deferral_queue.end(); it++) { |
256 if (ShouldForwardForGFCFiltering(*it) && | 266 if (ShouldForwardForGFCFiltering(*it) && |
257 ShouldForwardForTapSuppression(*it) && | 267 ShouldForwardForTapSuppression(*it) && |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 return 0; | 379 return 0; |
370 | 380 |
371 if (!ignore_next_ack_) | 381 if (!ignore_next_ack_) |
372 return 1; | 382 return 1; |
373 | 383 |
374 DCHECK_GT(coalesced_gesture_events_.size(), 1U); | 384 DCHECK_GT(coalesced_gesture_events_.size(), 1U); |
375 return 2; | 385 return 2; |
376 } | 386 } |
377 | 387 |
378 } // namespace content | 388 } // namespace content |
OLD | NEW |