Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_QUEUE_H_ | 5 #ifndef CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_QUEUE_H_ |
| 6 #define CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_QUEUE_H_ | 6 #define CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_QUEUE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 | 49 |
| 50 std::unique_ptr<T> Pop() { | 50 std::unique_ptr<T> Pop() { |
| 51 std::unique_ptr<T> result; | 51 std::unique_ptr<T> result; |
| 52 if (!queue_.empty()) { | 52 if (!queue_.empty()) { |
| 53 result.reset(queue_.front().release()); | 53 result.reset(queue_.front().release()); |
| 54 queue_.pop_front(); | 54 queue_.pop_front(); |
| 55 } | 55 } |
| 56 return result; | 56 return result; |
| 57 } | 57 } |
| 58 | 58 |
| 59 const std::unique_ptr<T>& Top() { | |
|
tdresser
2016/07/20 21:43:08
Why Top instead of front?
| |
| 60 DCHECK(!empty()); | |
| 61 return queue_.front(); | |
| 62 } | |
| 63 | |
| 59 bool empty() const { return queue_.empty(); } | 64 bool empty() const { return queue_.empty(); } |
| 60 | 65 |
| 61 size_t size() const { return queue_.size(); } | 66 size_t size() const { return queue_.size(); } |
| 62 | 67 |
| 63 private: | 68 private: |
| 64 typedef std::deque<std::unique_ptr<T>> EventQueue; | 69 typedef std::deque<std::unique_ptr<T>> EventQueue; |
| 65 EventQueue queue_; | 70 EventQueue queue_; |
| 66 | 71 |
| 67 DISALLOW_COPY_AND_ASSIGN(WebInputEventQueue); | 72 DISALLOW_COPY_AND_ASSIGN(WebInputEventQueue); |
| 68 }; | 73 }; |
| 69 | 74 |
| 70 } // namespace content | 75 } // namespace content |
| 71 | 76 |
| 72 #endif // CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_QUEUE_H_ | 77 #endif // CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_QUEUE_H_ |
| OLD | NEW |