| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/events/blink/compositor_thread_event_queue.h" |
| 6 |
| 7 namespace ui { |
| 8 |
| 9 CompositorThreadEventQueue::CompositorThreadEventQueue() {} |
| 10 |
| 11 CompositorThreadEventQueue::~CompositorThreadEventQueue() {} |
| 12 |
| 13 // TODO(chongz): Support coalescing events across interleaved boundaries. |
| 14 // https://crbug.com/661601 |
| 15 void CompositorThreadEventQueue::Queue(std::unique_ptr<EventWithCallback> event, |
| 16 base::TimeTicks timestamp_now) { |
| 17 if (!queue_.empty() && queue_.back()->CanCoalesceWith(*event)) { |
| 18 queue_.back()->CoalesceWith(event.get(), timestamp_now); |
| 19 return; |
| 20 } |
| 21 |
| 22 queue_.emplace_back(std::move(event)); |
| 23 } |
| 24 |
| 25 std::unique_ptr<EventWithCallback> CompositorThreadEventQueue::Pop() { |
| 26 std::unique_ptr<EventWithCallback> result; |
| 27 if (!queue_.empty()) { |
| 28 result.reset(queue_.front().release()); |
| 29 queue_.pop_front(); |
| 30 } |
| 31 return result; |
| 32 } |
| 33 |
| 34 } // namespace ui |
| OLD | NEW |