OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 NET_BASE_PRIORITY_QUEUE_H_ | 5 #ifndef NET_BASE_PRIORITY_QUEUE_H_ |
6 #define NET_BASE_PRIORITY_QUEUE_H_ | 6 #define NET_BASE_PRIORITY_QUEUE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 class PriorityQueue : public base::NonThreadSafe { | 32 class PriorityQueue : public base::NonThreadSafe { |
33 private: | 33 private: |
34 // This section is up-front for Pointer only. | 34 // This section is up-front for Pointer only. |
35 #if !defined(NDEBUG) | 35 #if !defined(NDEBUG) |
36 typedef std::list<std::pair<unsigned, T> > List; | 36 typedef std::list<std::pair<unsigned, T> > List; |
37 #else | 37 #else |
38 typedef std::list<T> List; | 38 typedef std::list<T> List; |
39 #endif | 39 #endif |
40 | 40 |
41 public: | 41 public: |
42 typedef uint32 Priority; | 42 typedef uint32_t Priority; |
43 | 43 |
44 // A pointer to a value stored in the queue. The pointer becomes invalid | 44 // A pointer to a value stored in the queue. The pointer becomes invalid |
45 // when the queue is destroyed or cleared, or the value is erased. | 45 // when the queue is destroyed or cleared, or the value is erased. |
46 class Pointer { | 46 class Pointer { |
47 public: | 47 public: |
48 // Constructs a null pointer. | 48 // Constructs a null pointer. |
49 Pointer() : priority_(kNullPriority) { | 49 Pointer() : priority_(kNullPriority) { |
50 #if !defined(NDEBUG) | 50 #if !defined(NDEBUG) |
51 id_ = static_cast<unsigned>(-1); | 51 id_ = static_cast<unsigned>(-1); |
52 #endif | 52 #endif |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 302 |
303 ListVector lists_; | 303 ListVector lists_; |
304 size_t size_; | 304 size_t size_; |
305 | 305 |
306 DISALLOW_COPY_AND_ASSIGN(PriorityQueue); | 306 DISALLOW_COPY_AND_ASSIGN(PriorityQueue); |
307 }; | 307 }; |
308 | 308 |
309 } // namespace net | 309 } // namespace net |
310 | 310 |
311 #endif // NET_BASE_PRIORITY_QUEUE_H_ | 311 #endif // NET_BASE_PRIORITY_QUEUE_H_ |
OLD | NEW |