Home | History | Annotate | Download | only in base

Lines Matching defs:Priority

22 // A simple priority queue. The order of values is by priority and then FIFO.
24 // from the queue, and all operations are O(p) time for p priority levels.
25 // The queue is agnostic to priority ordering (whether 0 precedes 1).
26 // If the highest priority is 0, FirstMin() returns the first in order.
42 typedef uint32 Priority;
80 Priority priority() const { return priority_; }
106 static const Priority kNullPriority = static_cast<Priority>(-1);
110 Pointer(Priority priority, const ListIterator& iterator)
111 : priority_(priority), iterator_(iterator) {
117 Priority priority_;
131 explicit PriorityQueue(Priority num_priorities)
138 // Adds |value| with |priority| to the queue. Returns a pointer to the
140 Pointer Insert(const T& value, Priority priority) {
142 DCHECK_LT(priority, lists_.size());
144 List& list = lists_[priority];
149 return Pointer(priority, list.insert(list.end(),
152 return Pointer(priority, list.insert(list.end(), value));
156 // Adds |value| with |priority| to the queue. Returns a pointer to the
158 Pointer InsertAtFront(const T& value, Priority priority) {
160 DCHECK_LT(priority, lists_.size());
162 List& list = lists_[priority];
167 return Pointer(priority, list.insert(list.begin(),
170 return Pointer(priority, list.insert(list.begin(), value));
190 // Returns a pointer to the first value of minimum priority or a null-pointer
202 // Returns a pointer to the last value of minimum priority or a null-pointer
214 // Returns a pointer to the first value of maximum priority or a null-pointer
227 // Returns a pointer to the last value of maximum priority or a null-pointer
241 // priority and then FIFO, returns a pointer to the value following
245 // priority, then reverse FIFO] as well as
246 // GetNextTowards{First,Last}Max() [increasing priority, then
254 Priority priority = pointer.priority_;
255 DCHECK(it != lists_[priority].end());
257 while (it == lists_[priority].end()) {
258 if (priority == 0u)
260 --priority;
261 it = const_cast<List*>(&lists_[priority])->begin();
263 return Pointer(priority, it);