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

Unified Diff: base/memory/discardable_memory_shmem_allocator.h

Issue 807303002: base: Add free list implementation to browser-wide discardable memory system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@discardable-shared-memory-ashmem
Patch Set: fix nits Created 6 years 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_shmem_allocator.h
diff --git a/base/memory/discardable_memory_shmem_allocator.h b/base/memory/discardable_memory_shmem_allocator.h
index 68624b3960b3c979dd9989850361b93b12157f77..ed40672151849313aff651390c94e0992099a1fe 100644
--- a/base/memory/discardable_memory_shmem_allocator.h
+++ b/base/memory/discardable_memory_shmem_allocator.h
@@ -9,7 +9,18 @@
#include "base/memory/scoped_ptr.h"
namespace base {
-class DiscardableSharedMemory;
+
+// TODO(reveman): Remove this by having allocator interface return
+// real DiscardableMemory instances. crbug.com/442945
+class BASE_EXPORT DiscardableMemoryShmemChunk {
+ public:
+ virtual ~DiscardableMemoryShmemChunk() {}
+
+ virtual bool Lock() = 0;
+ virtual void Unlock() = 0;
+ virtual void* Memory() const = 0;
+ virtual bool IsMemoryResident() const = 0;
+};
class BASE_EXPORT DiscardableMemoryShmemAllocator {
public:
@@ -20,8 +31,8 @@ class BASE_EXPORT DiscardableMemoryShmemAllocator {
// Ownership of |instance| remains with the caller.
static void SetInstance(DiscardableMemoryShmemAllocator* allocator);
- virtual scoped_ptr<DiscardableSharedMemory>
- AllocateLockedDiscardableSharedMemory(size_t size) = 0;
+ virtual scoped_ptr<DiscardableMemoryShmemChunk>
+ AllocateLockedDiscardableMemory(size_t size) = 0;
protected:
virtual ~DiscardableMemoryShmemAllocator() {}

Powered by Google App Engine
This is Rietveld 408576698