Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: base/task_scheduler/priority_queue.h

Issue 1708773002: TaskScheduler [7] SchedulerThreadPool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@s_5_worker_thread
Patch Set: merge SchedulerWorkerThreadDelegate Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698