| 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 #include "content/browser/renderer_host/input/touch_event_queue.h" | 5 #include "content/browser/renderer_host/input/touch_event_queue.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 if (config.touch_ack_timeout_supported) { | 445 if (config.touch_ack_timeout_supported) { |
| 446 timeout_handler_.reset( | 446 timeout_handler_.reset( |
| 447 new TouchTimeoutHandler(this, | 447 new TouchTimeoutHandler(this, |
| 448 config.desktop_touch_ack_timeout_delay, | 448 config.desktop_touch_ack_timeout_delay, |
| 449 config.mobile_touch_ack_timeout_delay)); | 449 config.mobile_touch_ack_timeout_delay)); |
| 450 } | 450 } |
| 451 } | 451 } |
| 452 | 452 |
| 453 TouchEventQueue::~TouchEventQueue() { | 453 TouchEventQueue::~TouchEventQueue() { |
| 454 if (!touch_queue_.empty()) | 454 if (!touch_queue_.empty()) |
| 455 STLDeleteElements(&touch_queue_); | 455 base::STLDeleteElements(&touch_queue_); |
| 456 } | 456 } |
| 457 | 457 |
| 458 void TouchEventQueue::QueueEvent(const TouchEventWithLatencyInfo& event) { | 458 void TouchEventQueue::QueueEvent(const TouchEventWithLatencyInfo& event) { |
| 459 TRACE_EVENT0("input", "TouchEventQueue::QueueEvent"); | 459 TRACE_EVENT0("input", "TouchEventQueue::QueueEvent"); |
| 460 | 460 |
| 461 // If the queueing of |event| was triggered by an ack dispatch, defer | 461 // If the queueing of |event| was triggered by an ack dispatch, defer |
| 462 // processing the event until the dispatch has finished. | 462 // processing the event until the dispatch has finished. |
| 463 if (touch_queue_.empty() && !dispatching_touch_ack_) { | 463 if (touch_queue_.empty() && !dispatching_touch_ack_) { |
| 464 // Optimization of the case without touch handlers. Removing this path | 464 // Optimization of the case without touch handlers. Removing this path |
| 465 // yields identical results, but this avoids unnecessary allocations. | 465 // yields identical results, but this avoids unnecessary allocations. |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) | 926 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) |
| 927 send_touch_events_async_ = false; | 927 send_touch_events_async_ = false; |
| 928 has_handler_for_current_sequence_ |= | 928 has_handler_for_current_sequence_ |= |
| 929 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | 929 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; |
| 930 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) { | 930 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) { |
| 931 has_handler_for_current_sequence_ = false; | 931 has_handler_for_current_sequence_ = false; |
| 932 } | 932 } |
| 933 } | 933 } |
| 934 | 934 |
| 935 } // namespace content | 935 } // namespace content |
| OLD | NEW |