OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 MEDIA_BLINK_LRU_H_ | 5 #ifndef MEDIA_BLINK_LRU_H_ |
6 #define MEDIA_BLINK_LRU_H_ | 6 #define MEDIA_BLINK_LRU_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 |
8 #include <list> | 10 #include <list> |
9 | 11 |
10 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 | 14 |
13 namespace media { | 15 namespace media { |
14 | 16 |
15 // Simple LRU (least recently used) class. | 17 // Simple LRU (least recently used) class. |
16 // Keeps track of a set of data and lets you get the least recently used | 18 // Keeps track of a set of data and lets you get the least recently used |
17 // (oldest) element at any time. All operations are O(1). Elements are expected | 19 // (oldest) element at any time. All operations are O(1). Elements are expected |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Maps element values to positions in the list so that we | 86 // Maps element values to positions in the list so that we |
85 // can quickly remove elements. | 87 // can quickly remove elements. |
86 base::hash_map<T, typename std::list<T>::iterator> pos_; | 88 base::hash_map<T, typename std::list<T>::iterator> pos_; |
87 | 89 |
88 DISALLOW_COPY_AND_ASSIGN(LRU); | 90 DISALLOW_COPY_AND_ASSIGN(LRU); |
89 }; | 91 }; |
90 | 92 |
91 } // namespace media | 93 } // namespace media |
92 | 94 |
93 #endif // MEDIA_BLINK_LRU_H | 95 #endif // MEDIA_BLINK_LRU_H |
OLD | NEW |