| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // This file contains a template for a Most Recently Used cache that allows | 5 // This file contains a template for a Most Recently Used cache that allows |
| 6 // constant-time access to items using a key, but easy identification of the | 6 // constant-time access to items using a key, but easy identification of the |
| 7 // least-recently-used items for removal. Each key can only be associated with | 7 // least-recently-used items for removal. Each key can only be associated with |
| 8 // one payload item at a time. | 8 // one payload item at a time. |
| 9 // | 9 // |
| 10 // The key object will be stored twice, so it should support efficient copying. | 10 // The key object will be stored twice, so it should support efficient copying. |
| 11 // | 11 // |
| 12 // NOTE: While all operations are O(1), this code is written for | 12 // NOTE: While all operations are O(1), this code is written for |
| 13 // legibility rather than optimality. If future profiling identifies this as | 13 // legibility rather than optimality. If future profiling identifies this as |
| 14 // a bottleneck, there is room for smaller values of 1 in the O(1). :] | 14 // a bottleneck, there is room for smaller values of 1 in the O(1). :] |
| 15 | 15 |
| 16 #ifndef CHROME_COMMON_MRU_CACHE_H__ | 16 #ifndef CONTENT_COMMON_MRU_CACHE_H_ |
| 17 #define CHROME_COMMON_MRU_CACHE_H__ | 17 #define CONTENT_COMMON_MRU_CACHE_H_ |
| 18 #pragma once | 18 #pragma once |
| 19 | 19 |
| 20 #include <list> | 20 #include <list> |
| 21 #include <map> | 21 #include <map> |
| 22 #include <utility> | 22 #include <utility> |
| 23 | 23 |
| 24 #include "base/basictypes.h" | 24 #include "base/basictypes.h" |
| 25 #include "base/logging.h" | 25 #include "base/logging.h" |
| 26 | 26 |
| 27 // MRUCacheBase ---------------------------------------------------------------- | 27 // MRUCacheBase ---------------------------------------------------------------- |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 explicit OwningMRUCache(typename ParentType::size_type max_size) | 243 explicit OwningMRUCache(typename ParentType::size_type max_size) |
| 244 : ParentType(max_size) { | 244 : ParentType(max_size) { |
| 245 } | 245 } |
| 246 virtual ~OwningMRUCache() { | 246 virtual ~OwningMRUCache() { |
| 247 } | 247 } |
| 248 | 248 |
| 249 private: | 249 private: |
| 250 DISALLOW_COPY_AND_ASSIGN(OwningMRUCache); | 250 DISALLOW_COPY_AND_ASSIGN(OwningMRUCache); |
| 251 }; | 251 }; |
| 252 | 252 |
| 253 #endif // CHROME_COMMON_MRU_CACHE_H__ | 253 #endif // CONTENT_COMMON_MRU_CACHE_H_ |
| OLD | NEW |