Index: base/memory/discardable_memory.h |
diff --git a/base/memory/discardable_memory.h b/base/memory/discardable_memory.h |
index c6a8d82da72363d3dc2cecbb01547eeb64c226eb..e060dd0accc89c4cb6ad0627410dc9f7f0119459 100644 |
--- a/base/memory/discardable_memory.h |
+++ b/base/memory/discardable_memory.h |
@@ -30,6 +30,9 @@ enum LockDiscardableMemoryStatus { |
// reclaim it if needed. Locks do not nest. |
// |
// Notes: |
+// - If you need more than one instance of DiscardableMemory please use |
+// DiscardableMemoryAllocator to avoid using too many file descriptors on |
+// platforms where discardable memory is backed by a file. |
// - The paging behavior of memory while it is locked is not specified. While |
// mobile platforms will not swap it out, it may qualify for swapping |
// on desktop platforms. It is not expected that this will matter, as the |
@@ -53,6 +56,8 @@ class BASE_EXPORT DiscardableMemory { |
static scoped_ptr<DiscardableMemory> CreateLockedMemory(size_t size); |
+ size_t size() const { return size_; } |
+ |
// Locks the memory so that it will not be purged by the system. Returns |
// DISCARDABLE_MEMORY_SUCCESS on success. If the return value is |
// DISCARDABLE_MEMORY_FAILED then this object should be discarded and |
@@ -78,6 +83,11 @@ class BASE_EXPORT DiscardableMemory { |
// Purge all discardable memory in the system. This call has global effects |
// across all running processes, so it should only be used for testing! |
static void PurgeForTesting(); |
+ |
+ protected: |
+ DiscardableMemory(size_t size); |
+ |
+ const size_t size_; |
}; |
} // namespace base |