| 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 #include "content/browser/renderer_host/input/passthrough_touch_event_queue.h" | 5 #include "content/browser/renderer_host/input/passthrough_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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } | 246 } |
| 247 | 247 |
| 248 bool PassthroughTouchEventQueue::IsAckTimeoutEnabled() const { | 248 bool PassthroughTouchEventQueue::IsAckTimeoutEnabled() const { |
| 249 return timeout_handler_ && timeout_handler_->IsEnabled(); | 249 return timeout_handler_ && timeout_handler_->IsEnabled(); |
| 250 } | 250 } |
| 251 | 251 |
| 252 bool PassthroughTouchEventQueue::Empty() const { | 252 bool PassthroughTouchEventQueue::Empty() const { |
| 253 return outstanding_touches_.empty(); | 253 return outstanding_touches_.empty(); |
| 254 } | 254 } |
| 255 | 255 |
| 256 bool PassthroughTouchEventQueue::SendTouchEventsAsync() const { |
| 257 return send_touch_events_async_; |
| 258 } |
| 259 |
| 256 void PassthroughTouchEventQueue::FlushQueue() { | 260 void PassthroughTouchEventQueue::FlushQueue() { |
| 257 drop_remaining_touches_in_sequence_ = true; | 261 drop_remaining_touches_in_sequence_ = true; |
| 258 while (!outstanding_touches_.empty()) { | 262 while (!outstanding_touches_.empty()) { |
| 259 auto iter = outstanding_touches_.begin(); | 263 auto iter = outstanding_touches_.begin(); |
| 260 TouchEventWithLatencyInfoAndAckState event = *iter; | 264 TouchEventWithLatencyInfoAndAckState event = *iter; |
| 261 outstanding_touches_.erase(iter); | 265 outstanding_touches_.erase(iter); |
| 262 if (event.ack_state() == INPUT_EVENT_ACK_STATE_UNKNOWN) | 266 if (event.ack_state() == INPUT_EVENT_ACK_STATE_UNKNOWN) |
| 263 event.set_ack_state(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); | 267 event.set_ack_state(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); |
| 264 AckTouchEventToClient(event, event.ack_state()); | 268 AckTouchEventToClient(event, event.ack_state()); |
| 265 } | 269 } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 bool PassthroughTouchEventQueue::IsTimeoutRunningForTesting() const { | 447 bool PassthroughTouchEventQueue::IsTimeoutRunningForTesting() const { |
| 444 return timeout_handler_ && timeout_handler_->IsTimeoutTimerRunning(); | 448 return timeout_handler_ && timeout_handler_->IsTimeoutTimerRunning(); |
| 445 } | 449 } |
| 446 | 450 |
| 447 const TouchEventWithLatencyInfo& | 451 const TouchEventWithLatencyInfo& |
| 448 PassthroughTouchEventQueue::GetLatestEventForTesting() const { | 452 PassthroughTouchEventQueue::GetLatestEventForTesting() const { |
| 449 return *outstanding_touches_.rbegin(); | 453 return *outstanding_touches_.rbegin(); |
| 450 } | 454 } |
| 451 | 455 |
| 452 } // namespace content | 456 } // namespace content |
| OLD | NEW |