| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 const PriorityQueue* predecessor_priority_queue); | 108 const PriorityQueue* predecessor_priority_queue); |
| 109 | 109 |
| 110 ~PriorityQueue(); | 110 ~PriorityQueue(); |
| 111 | 111 |
| 112 // Begins a Transaction. This method cannot be called on a thread which has an | 112 // Begins a Transaction. This method cannot be called on a thread which has an |
| 113 // active Transaction unless the last Transaction created on the thread was | 113 // active Transaction unless the last Transaction created on the thread was |
| 114 // for the allowed predecessor specified in the constructor of this | 114 // for the allowed predecessor specified in the constructor of this |
| 115 // PriorityQueue. | 115 // PriorityQueue. |
| 116 std::unique_ptr<Transaction> BeginTransaction(); | 116 std::unique_ptr<Transaction> BeginTransaction(); |
| 117 | 117 |
| 118 const SchedulerLock* container_lock() const { return &container_lock_; } |
| 119 |
| 118 private: | 120 private: |
| 119 struct SequenceAndSortKeyComparator { | 121 struct SequenceAndSortKeyComparator { |
| 120 bool operator()(const std::unique_ptr<SequenceAndSortKey>& left, | 122 bool operator()(const std::unique_ptr<SequenceAndSortKey>& left, |
| 121 const std::unique_ptr<SequenceAndSortKey>& right) const { | 123 const std::unique_ptr<SequenceAndSortKey>& right) const { |
| 122 return left->sort_key < right->sort_key; | 124 return left->sort_key < right->sort_key; |
| 123 } | 125 } |
| 124 }; | 126 }; |
| 125 using ContainerType = | 127 using ContainerType = |
| 126 std::priority_queue<std::unique_ptr<SequenceAndSortKey>, | 128 std::priority_queue<std::unique_ptr<SequenceAndSortKey>, |
| 127 std::vector<std::unique_ptr<SequenceAndSortKey>>, | 129 std::vector<std::unique_ptr<SequenceAndSortKey>>, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 138 // empty. | 140 // empty. |
| 139 const SequenceAndSortKey empty_sequence_and_sort_key_; | 141 const SequenceAndSortKey empty_sequence_and_sort_key_; |
| 140 | 142 |
| 141 DISALLOW_COPY_AND_ASSIGN(PriorityQueue); | 143 DISALLOW_COPY_AND_ASSIGN(PriorityQueue); |
| 142 }; | 144 }; |
| 143 | 145 |
| 144 } // namespace internal | 146 } // namespace internal |
| 145 } // namespace base | 147 } // namespace base |
| 146 | 148 |
| 147 #endif // BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_ | 149 #endif // BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_ |
| OLD | NEW |