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

Unified Diff: base/memory/discardable_memory.h

Issue 25293002: Add DiscardableMemoryAllocator to work around FD limit issue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add merging comments Created 7 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 side-by-side diff with in-line comments
Download patch
Index: base/memory/discardable_memory.h
diff --git a/base/memory/discardable_memory.h b/base/memory/discardable_memory.h
index c6a8d82da72363d3dc2cecbb01547eeb64c226eb..e87476194aa892e0cb5039698cd4a3c17abd0733 100644
--- a/base/memory/discardable_memory.h
+++ b/base/memory/discardable_memory.h
@@ -44,6 +44,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 +55,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

Powered by Google App Engine
This is Rietveld 408576698