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

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: Address Egor's comments + fix Clang warning (note that the change doesn't fix a bug) 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
« no previous file with comments | « base/base.gypi ('k') | base/memory/discardable_memory_allocator_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
willchan no longer on Chromium 2013/10/28 19:54:05 Can you explain why this is an important API to ad
willchan no longer on Chromium 2013/11/18 14:53:13 Can you answer this question?
Philippe 2013/11/18 16:34:51 Yes, sorry. I added this mainly to simplify testin
+ // 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
« no previous file with comments | « base/base.gypi ('k') | base/memory/discardable_memory_allocator_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698