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

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

Issue 261993003: base: Use DiscardableMemoryManager on MacOSX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix initial return value of AllocateAndAcquireLock and CHECKs for allocation failure Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « base/memory/discardable_memory_mac.cc ('k') | base/memory/discardable_memory_manager.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 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // amount of allocated memory (in case this forces a purge). When memory usage 60 // amount of allocated memory (in case this forces a purge). When memory usage
61 // reaches the limit, the manager purges the LRU memory. 61 // reaches the limit, the manager purges the LRU memory.
62 // 62 //
63 // When notified of memory pressure, the manager either purges the LRU memory -- 63 // When notified of memory pressure, the manager either purges the LRU memory --
64 // if the pressure is moderate -- or all discardable memory if the pressure is 64 // if the pressure is moderate -- or all discardable memory if the pressure is
65 // critical. 65 // critical.
66 class BASE_EXPORT_PRIVATE DiscardableMemoryManager { 66 class BASE_EXPORT_PRIVATE DiscardableMemoryManager {
67 public: 67 public:
68 typedef DiscardableMemoryManagerAllocation Allocation; 68 typedef DiscardableMemoryManagerAllocation Allocation;
69 69
70 DiscardableMemoryManager(); 70 DiscardableMemoryManager(size_t memory_limit,
71 size_t bytes_to_keep_under_moderate_pressure);
71 ~DiscardableMemoryManager(); 72 ~DiscardableMemoryManager();
72 73
73 // Call this to register memory pressure listener. Must be called on a thread 74 // Call this to register memory pressure listener. Must be called on a thread
74 // with a MessageLoop current. 75 // with a MessageLoop current.
75 void RegisterMemoryPressureListener(); 76 void RegisterMemoryPressureListener();
76 77
77 // Call this to unregister memory pressure listener. 78 // Call this to unregister memory pressure listener.
78 void UnregisterMemoryPressureListener(); 79 void UnregisterMemoryPressureListener();
79 80
80 // The maximum number of bytes of memory that may be allocated before we force 81 // The maximum number of bytes of memory that may be allocated before we force
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // pressure. 164 // pressure.
164 scoped_ptr<MemoryPressureListener> memory_pressure_listener_; 165 scoped_ptr<MemoryPressureListener> memory_pressure_listener_;
165 166
166 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryManager); 167 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryManager);
167 }; 168 };
168 169
169 } // namespace internal 170 } // namespace internal
170 } // namespace base 171 } // namespace base
171 172
172 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_MANAGER_H_ 173 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_MANAGER_H_
OLDNEW
« no previous file with comments | « base/memory/discardable_memory_mac.cc ('k') | base/memory/discardable_memory_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698