Chromium Code Reviews| 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 | |
| 30 std::unique_ptr<EventWithCallback> Pop(); | |
| 31 | |
| 32 bool empty() const { return queue_.empty(); } | |
| 33 | |
| 34 size_t size() const { return queue_.size(); } | |
| 35 | |
| 36 private: | |
| 37 friend class test::InputHandlerProxyEventQueueTest; | |
| 38 typedef std::deque<std::unique_ptr<EventWithCallback>> EventQueue; | |
|
dtapuska
2016/11/09 21:28:05
using is prefered now instead of typedef.
chongz
2016/11/11 21:52:04
Done.
| |
| 39 EventQueue queue_; | |
| 40 | |
| 41 DISALLOW_COPY_AND_ASSIGN(CompositorThreadEventQueue); | |
| 42 }; | |
| 43 | |
| 44 } // namespace ui | |
| 45 | |
| 46 #endif // UI_EVENTS_BLINK_COMPOSITOR_THREAD_EVENT_QUEUE_H_ | |
| OLD | NEW |