| 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 #ifndef UI_EVENTS_BLINK_COMPOSITOR_THREAD_EVENT_QUEUE_H_ |
| 6 #define UI_EVENTS_BLINK_COMPOSITOR_THREAD_EVENT_QUEUE_H_ |
| 7 |
| 8 #include <deque> |
| 9 #include <memory> |
| 10 |
| 11 #include "ui/events/blink/event_with_callback.h" |
| 12 |
| 13 namespace ui { |
| 14 |
| 15 namespace test { |
| 16 class InputHandlerProxyEventQueueTest; |
| 17 } |
| 18 |
| 19 // CompositorThreadEventQueue is a coalescing queue. It will examine |
| 20 // the current events in the queue and will attempt to coalesce with |
| 21 // the last event. |
| 22 class CompositorThreadEventQueue { |
| 23 public: |
| 24 CompositorThreadEventQueue(); |
| 25 ~CompositorThreadEventQueue(); |
| 26 |
| 27 // Adds an event to the queue. The event may be coalesced with the last event. |
| 28 void Queue(std::unique_ptr<EventWithCallback> event, |
| 29 base::TimeTicks timestamp_now); |
| 30 |
| 31 std::unique_ptr<EventWithCallback> Pop(); |
| 32 |
| 33 bool empty() const { return queue_.empty(); } |
| 34 |
| 35 size_t size() const { return queue_.size(); } |
| 36 |
| 37 private: |
| 38 friend class test::InputHandlerProxyEventQueueTest; |
| 39 using EventQueue = std::deque<std::unique_ptr<EventWithCallback>>; |
| 40 EventQueue queue_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(CompositorThreadEventQueue); |
| 43 }; |
| 44 |
| 45 } // namespace ui |
| 46 |
| 47 #endif // UI_EVENTS_BLINK_COMPOSITOR_THREAD_EVENT_QUEUE_H_ |
| OLD | NEW |