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 BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_ | 5 #ifndef BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_ |
6 #define BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_ | 6 #define BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <queue> | 9 #include <queue> |
10 #include <vector> | 10 #include <vector> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // Cannot be called on an empty PriorityQueue. | 48 // Cannot be called on an empty PriorityQueue. |
49 const SequenceSortKey& PeekSortKey() const; | 49 const SequenceSortKey& PeekSortKey() const; |
50 | 50 |
51 // Removes and returns the highest priority Sequence in this PriorityQueue. | 51 // Removes and returns the highest priority Sequence in this PriorityQueue. |
52 // Cannot be called on an empty PriorityQueue. | 52 // Cannot be called on an empty PriorityQueue. |
53 scoped_refptr<Sequence> PopSequence(); | 53 scoped_refptr<Sequence> PopSequence(); |
54 | 54 |
55 // Returns true if the PriorityQueue is empty. | 55 // Returns true if the PriorityQueue is empty. |
56 bool IsEmpty() const; | 56 bool IsEmpty() const; |
57 | 57 |
| 58 // Returns the number of Sequences in the PriorityQueue. |
| 59 size_t Size() const; |
| 60 |
58 private: | 61 private: |
59 friend class PriorityQueue; | 62 friend class PriorityQueue; |
60 | 63 |
61 explicit Transaction(PriorityQueue* outer_queue); | 64 explicit Transaction(PriorityQueue* outer_queue); |
62 | 65 |
63 // Holds the lock of |outer_queue_| for the lifetime of this Transaction. | 66 // Holds the lock of |outer_queue_| for the lifetime of this Transaction. |
64 AutoSchedulerLock auto_lock_; | 67 AutoSchedulerLock auto_lock_; |
65 | 68 |
66 PriorityQueue* const outer_queue_; | 69 PriorityQueue* const outer_queue_; |
67 | 70 |
(...skipping 24 matching lines...) Expand all Loading... |
92 | 95 |
93 ContainerType container_; | 96 ContainerType container_; |
94 | 97 |
95 DISALLOW_COPY_AND_ASSIGN(PriorityQueue); | 98 DISALLOW_COPY_AND_ASSIGN(PriorityQueue); |
96 }; | 99 }; |
97 | 100 |
98 } // namespace internal | 101 } // namespace internal |
99 } // namespace base | 102 } // namespace base |
100 | 103 |
101 #endif // BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_ | 104 #endif // BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_ |
OLD | NEW |