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 #include "base/task_scheduler/priority_queue.h" | 5 #include "base/task_scheduler/priority_queue.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 outer_queue_->container_.top()) | 86 outer_queue_->container_.top()) |
87 .take_sequence(); | 87 .take_sequence(); |
88 outer_queue_->container_.pop(); | 88 outer_queue_->container_.pop(); |
89 return sequence; | 89 return sequence; |
90 } | 90 } |
91 | 91 |
92 bool PriorityQueue::Transaction::IsEmpty() const { | 92 bool PriorityQueue::Transaction::IsEmpty() const { |
93 return outer_queue_->container_.empty(); | 93 return outer_queue_->container_.empty(); |
94 } | 94 } |
95 | 95 |
| 96 size_t PriorityQueue::Transaction::Size() const { |
| 97 return outer_queue_->container_.size(); |
| 98 } |
| 99 |
96 PriorityQueue::PriorityQueue() = default; | 100 PriorityQueue::PriorityQueue() = default; |
97 | 101 |
98 PriorityQueue::~PriorityQueue() = default; | 102 PriorityQueue::~PriorityQueue() = default; |
99 | 103 |
100 std::unique_ptr<PriorityQueue::Transaction> PriorityQueue::BeginTransaction() { | 104 std::unique_ptr<PriorityQueue::Transaction> PriorityQueue::BeginTransaction() { |
101 return WrapUnique(new Transaction(this)); | 105 return WrapUnique(new Transaction(this)); |
102 } | 106 } |
103 | 107 |
104 } // namespace internal | 108 } // namespace internal |
105 } // namespace base | 109 } // namespace base |
OLD | NEW |