Index: base/memory/discardable_memory.h |
diff --git a/base/memory/discardable_memory.h b/base/memory/discardable_memory.h |
index c6a8d82da72363d3dc2cecbb01547eeb64c226eb..0cae99f5494d1ad1cd7a8d3600982ee772dc0771 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 |
@@ -44,6 +47,8 @@ enum LockDiscardableMemoryStatus { |
// - Mac: http://trac.webkit.org/browser/trunk/Source/WebCore/platform/mac/PurgeableBufferMac.cpp |
// the comment starting with "vm_object_purgable_control" at |
// http://www.opensource.apple.com/source/xnu/xnu-792.13.8/osfmk/vm/vm_object.c |
+// |
+// Thread-safety: DiscardableMemory instances are not thread-safe. |
class BASE_EXPORT DiscardableMemory { |
public: |
virtual ~DiscardableMemory() {} |
@@ -53,6 +58,10 @@ class BASE_EXPORT DiscardableMemory { |
static scoped_ptr<DiscardableMemory> CreateLockedMemory(size_t size); |
+ // Returns the memory's actual size that is greater or equal than the |
+ // size requested at construction. |
+ virtual size_t Size() const = 0; |
+ |
// 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 |