Chromium Code Reviews| Index: net/base/priority_queue.h |
| diff --git a/net/base/priority_queue.h b/net/base/priority_queue.h |
| index 7b7d97c0e8e31764d737c59239338cd4a3c17d99..ab4be3ef1f29b8d3990122dc2fcdf9151a2f3a7e 100644 |
| --- a/net/base/priority_queue.h |
| +++ b/net/base/priority_queue.h |
| @@ -264,6 +264,31 @@ class PriorityQueue : public base::NonThreadSafe { |
| size_ = 0u; |
| } |
| + // This can be used to iterate through the composite container, in |
| + // highest-to-lowest, first-inserted-to-last order. |
| + Pointer NextHighest(const Pointer& previous) { |
|
szym
2013/11/15 01:11:49
Is this any different from GetNextTowardsLastMin?
oystein (OOO til 10th of July)
2013/11/15 03:02:10
This patch was written before GetNextTowardsLastMi
|
| + Priority priority = previous.priority_; |
| + typename Pointer::ListIterator list_entry = previous.iterator_; |
| + |
| + if (list_entry != lists_[priority].end()) { |
| + ++list_entry; |
| + } |
| + |
| + while (priority < lists_.size()) { |
| + if (list_entry == lists_[priority].end()) { |
| + if (priority == 0) { |
| + break; |
| + } |
| + priority--; |
| + list_entry = lists_[priority].begin(); |
| + } else { |
| + return Pointer(priority, list_entry); |
| + } |
| + } |
| + |
| + return Pointer(); |
| + } |
| + |
| // Returns the number of priorities the queue supports. |
| size_t num_priorities() const { |
| DCHECK(CalledOnValidThread()); |