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 <queue> | 8 #include <queue> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const PriorityQueue* predecessor_priority_queue); | 100 const PriorityQueue* predecessor_priority_queue); |
101 | 101 |
102 ~PriorityQueue(); | 102 ~PriorityQueue(); |
103 | 103 |
104 // Begins a Transaction. This method cannot be called on a thread which has an | 104 // Begins a Transaction. This method cannot be called on a thread which has an |
105 // active Transaction unless the last Transaction created on the thread was | 105 // active Transaction unless the last Transaction created on the thread was |
106 // for the allowed predecessor specified in the constructor of this | 106 // for the allowed predecessor specified in the constructor of this |
107 // PriorityQueue. | 107 // PriorityQueue. |
108 scoped_ptr<Transaction> BeginTransaction(); | 108 scoped_ptr<Transaction> BeginTransaction(); |
109 | 109 |
| 110 const SchedulerLock* container_lock() const { return &container_lock_; } |
| 111 |
110 private: | 112 private: |
111 struct SequenceAndSortKeyComparator { | 113 struct SequenceAndSortKeyComparator { |
112 bool operator()(const scoped_ptr<SequenceAndSortKey>& left, | 114 bool operator()(const scoped_ptr<SequenceAndSortKey>& left, |
113 const scoped_ptr<SequenceAndSortKey>& right) const { | 115 const scoped_ptr<SequenceAndSortKey>& right) const { |
114 return left->sort_key < right->sort_key; | 116 return left->sort_key < right->sort_key; |
115 } | 117 } |
116 }; | 118 }; |
117 using ContainerType = | 119 using ContainerType = |
118 std::priority_queue<scoped_ptr<SequenceAndSortKey>, | 120 std::priority_queue<scoped_ptr<SequenceAndSortKey>, |
119 std::vector<scoped_ptr<SequenceAndSortKey>>, | 121 std::vector<scoped_ptr<SequenceAndSortKey>>, |
(...skipping 10 matching lines...) Expand all Loading... |
130 // empty. | 132 // empty. |
131 const SequenceAndSortKey empty_sequence_and_sort_key_; | 133 const SequenceAndSortKey empty_sequence_and_sort_key_; |
132 | 134 |
133 DISALLOW_COPY_AND_ASSIGN(PriorityQueue); | 135 DISALLOW_COPY_AND_ASSIGN(PriorityQueue); |
134 }; | 136 }; |
135 | 137 |
136 } // namespace internal | 138 } // namespace internal |
137 } // namespace base | 139 } // namespace base |
138 | 140 |
139 #endif // BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_ | 141 #endif // BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_ |
OLD | NEW |