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

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

Issue 257383004: Revert 267170 "Use DiscardableMemoryManager on Android." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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
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"
11 #include "base/memory/memory_pressure_listener.h" 11 #include "base/memory/memory_pressure_listener.h"
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 13
14 namespace base { 14 namespace base {
15 namespace internal { 15 namespace internal {
16 16
17 // This interface is used by the DiscardableMemoryManager class to provide some 17 // This interface is used by the DiscardableMemoryManager class to provide some
18 // level of userspace control over discardable memory allocations. 18 // level of userspace control over discardable memory allocations.
19 class DiscardableMemoryManagerAllocation { 19 class DiscardableMemoryManagerAllocation {
20 public: 20 public:
21 // Allocate and acquire a lock that prevents the allocation from being purged 21 // Allocate and acquire a lock that prevents the allocation from being purged
22 // by the system. Returns true if memory was previously allocated and is still 22 // by the system. Returns true if memory was previously allocated and is still
23 // resident. 23 // resident.
24 virtual bool AllocateAndAcquireLock() = 0; 24 virtual bool AllocateAndAcquireLock(size_t bytes) = 0;
25 25
26 // Release a previously acquired lock on the allocation so that it can be 26 // Release a previously acquired lock on the allocation so that it can be
27 // purged by the system. 27 // purged by the system.
28 virtual void ReleaseLock() = 0; 28 virtual void ReleaseLock() = 0;
29 29
30 // Explicitly purge this allocation. It is illegal to call this while a lock 30 // Explicitly purge this allocation. It is illegal to call this while a lock
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:
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // pressure. 163 // pressure.
164 scoped_ptr<MemoryPressureListener> memory_pressure_listener_; 164 scoped_ptr<MemoryPressureListener> memory_pressure_listener_;
165 165
166 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryManager); 166 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryManager);
167 }; 167 };
168 168
169 } // namespace internal 169 } // namespace internal
170 } // namespace base 170 } // namespace base
171 171
172 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_MANAGER_H_ 172 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_MANAGER_H_
OLDNEW
« no previous file with comments | « trunk/src/base/memory/discardable_memory_mac.cc ('k') | trunk/src/base/memory/discardable_memory_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698