Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Side by Side Diff: base/containers/mru_cache.h

Issue 1538743002: Switch to standard integer types in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DEPS roll too Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/containers/linked_list_unittest.cc ('k') | base/containers/mru_cache_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 BASE_CONTAINERS_MRU_CACHE_H_ 16 #ifndef BASE_CONTAINERS_MRU_CACHE_H_
17 #define BASE_CONTAINERS_MRU_CACHE_H_ 17 #define BASE_CONTAINERS_MRU_CACHE_H_
18 18
19 #include <stddef.h>
20
19 #include <algorithm> 21 #include <algorithm>
20 #include <list> 22 #include <list>
21 #include <map> 23 #include <map>
22 #include <utility> 24 #include <utility>
23 25
24 #include "base/basictypes.h"
25 #include "base/containers/hash_tables.h" 26 #include "base/containers/hash_tables.h"
26 #include "base/logging.h" 27 #include "base/logging.h"
28 #include "base/macros.h"
27 29
28 namespace base { 30 namespace base {
29 31
30 // MRUCacheBase ---------------------------------------------------------------- 32 // MRUCacheBase ----------------------------------------------------------------
31 33
32 // This template is used to standardize map type containers that can be used 34 // This template is used to standardize map type containers that can be used
33 // by MRUCacheBase. This level of indirection is necessary because of the way 35 // by MRUCacheBase. This level of indirection is necessary because of the way
34 // that template template params and default template params interact. 36 // that template template params and default template params interact.
35 template <class KeyType, class ValueType> 37 template <class KeyType, class ValueType>
36 struct MRUCacheStandardMap { 38 struct MRUCacheStandardMap {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 virtual ~HashingMRUCache() { 309 virtual ~HashingMRUCache() {
308 } 310 }
309 311
310 private: 312 private:
311 DISALLOW_COPY_AND_ASSIGN(HashingMRUCache); 313 DISALLOW_COPY_AND_ASSIGN(HashingMRUCache);
312 }; 314 };
313 315
314 } // namespace base 316 } // namespace base
315 317
316 #endif // BASE_CONTAINERS_MRU_CACHE_H_ 318 #endif // BASE_CONTAINERS_MRU_CACHE_H_
OLDNEW
« no previous file with comments | « base/containers/linked_list_unittest.cc ('k') | base/containers/mru_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698