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

Side by Side Diff: base/memory/discardable_memory_manager.h

Issue 612323010: Align base::hash_map with C++11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try a different tack for C++ insanity Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 BASE_MEMORY_DISCARDABLE_MEMORY_MANAGER_H_ 5 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_MANAGER_H_
6 #define BASE_MEMORY_DISCARDABLE_MEMORY_MANAGER_H_ 6 #define BASE_MEMORY_DISCARDABLE_MEMORY_MANAGER_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/containers/mru_cache.h" 10 #include "base/containers/mru_cache.h"
(...skipping 20 matching lines...) Expand all
31 // is acquired on the allocation. 31 // is acquired on the allocation.
32 virtual void Purge() = 0; 32 virtual void Purge() = 0;
33 33
34 protected: 34 protected:
35 virtual ~DiscardableMemoryManagerAllocation() {} 35 virtual ~DiscardableMemoryManagerAllocation() {}
36 }; 36 };
37 37
38 } // namespace internal 38 } // namespace internal
39 } // namespace base 39 } // namespace base
40 40
41 #if defined(COMPILER_GCC)
42 namespace BASE_HASH_NAMESPACE {
43 template <>
44 struct hash<base::internal::DiscardableMemoryManagerAllocation*> {
45 size_t operator()(
46 base::internal::DiscardableMemoryManagerAllocation* ptr) const {
47 return hash<size_t>()(reinterpret_cast<size_t>(ptr));
48 }
49 };
50 } // namespace BASE_HASH_NAMESPACE
51 #endif // COMPILER
52
53 namespace base { 41 namespace base {
54 namespace internal { 42 namespace internal {
55 43
56 // The DiscardableMemoryManager manages a collection of 44 // The DiscardableMemoryManager manages a collection of
57 // DiscardableMemoryManagerAllocation instances. It is used on platforms that 45 // DiscardableMemoryManagerAllocation instances. It is used on platforms that
58 // need some level of userspace control over discardable memory. It keeps track 46 // need some level of userspace control over discardable memory. It keeps track
59 // of all allocation instances (in case they need to be purged), and the total 47 // of all allocation instances (in case they need to be purged), and the total
60 // amount of allocated memory (in case this forces a purge). When memory usage 48 // amount of allocated memory (in case this forces a purge). When memory usage
61 // reaches the limit, the manager purges the LRU memory. 49 // reaches the limit, the manager purges the LRU memory.
62 class BASE_EXPORT_PRIVATE DiscardableMemoryManager { 50 class BASE_EXPORT_PRIVATE DiscardableMemoryManager {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // |soft_memory_limit_|. 157 // |soft_memory_limit_|.
170 TimeDelta hard_memory_limit_expiration_time_; 158 TimeDelta hard_memory_limit_expiration_time_;
171 159
172 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryManager); 160 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryManager);
173 }; 161 };
174 162
175 } // namespace internal 163 } // namespace internal
176 } // namespace base 164 } // namespace base
177 165
178 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_MANAGER_H_ 166 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698