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

Unified Diff: content/child/child_discardable_shared_memory_manager.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: rebase 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: content/child/child_discardable_shared_memory_manager.h
diff --git a/content/child/child_discardable_shared_memory_manager.h b/content/child/child_discardable_shared_memory_manager.h
index e35c57b4a269bad65805a281596e45eb024feb5e..aefd2644444e34b2413c61a13c1ecff024f8f241 100644
--- a/content/child/child_discardable_shared_memory_manager.h
+++ b/content/child/child_discardable_shared_memory_manager.h
@@ -7,7 +7,9 @@
#include "base/memory/discardable_memory_shmem_allocator.h"
#include "base/memory/ref_counted.h"
+#include "base/synchronization/lock.h"
#include "content/child/thread_safe_sender.h"
+#include "content/common/discardable_shared_memory_heap.h"
namespace content {
@@ -20,10 +22,20 @@ class ChildDiscardableSharedMemoryManager
~ChildDiscardableSharedMemoryManager() override;
// Overridden from base::DiscardableMemoryShmemAllocator:
- scoped_ptr<base::DiscardableSharedMemory>
- AllocateLockedDiscardableSharedMemory(size_t size) override;
+ scoped_ptr<base::DiscardableMemoryShmemChunk> AllocateLockedDiscardableMemory(
+ size_t size) override;
+
+ bool LockSpan(DiscardableSharedMemoryHeap::Span* span);
+ void UnlockSpan(DiscardableSharedMemoryHeap::Span* span);
+ bool IsSpanResident(DiscardableSharedMemoryHeap::Span* span) const;
+ void ReleaseSpan(scoped_ptr<DiscardableSharedMemoryHeap::Span> span);
private:
+ scoped_ptr<base::DiscardableSharedMemory>
+ AllocateLockedDiscardableSharedMemory(size_t size);
+
+ mutable base::Lock lock_;
+ DiscardableSharedMemoryHeap heap_;
scoped_refptr<ThreadSafeSender> sender_;
DISALLOW_COPY_AND_ASSIGN(ChildDiscardableSharedMemoryManager);
« no previous file with comments | « base/memory/discardable_memory_shmem_allocator.cc ('k') | content/child/child_discardable_shared_memory_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698