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

Unified Diff: content/common/discardable_shared_memory_heap.h

Issue 1009203004: content: Add DeletedDiscardableSharedMemory IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 9 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 | « content/common/child_process_messages.h ('k') | content/common/discardable_shared_memory_heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/discardable_shared_memory_heap.h
diff --git a/content/common/discardable_shared_memory_heap.h b/content/common/discardable_shared_memory_heap.h
index 34f61b642777365f3903861bb5cb816ac76a1716..23b9cfb87d237dc1a4016dc029a0086aaf05fca1 100644
--- a/content/common/discardable_shared_memory_heap.h
+++ b/content/common/discardable_shared_memory_heap.h
@@ -5,6 +5,7 @@
#ifndef CONTENT_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_
#define CONTENT_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_
+#include "base/callback.h"
#include "base/containers/hash_tables.h"
#include "base/containers/linked_list.h"
#include "base/memory/scoped_ptr.h"
@@ -48,9 +49,11 @@ class CONTENT_EXPORT DiscardableSharedMemoryHeap {
// Grow heap using |shared_memory| and return a span for this new memory.
// |shared_memory| must be aligned to the block size and |size| must be a
- // multiple of the block size.
+ // multiple of the block size. |deleted_callback| is called when
+ // |shared_memory| has been deleted.
scoped_ptr<Span> Grow(scoped_ptr<base::DiscardableSharedMemory> shared_memory,
- size_t size);
+ size_t size,
+ const base::Closure& deleted_callback);
// Merge |span| into the free lists. This will coalesce |span| with
// neighboring free spans when possible.
@@ -85,7 +88,8 @@ class CONTENT_EXPORT DiscardableSharedMemoryHeap {
public:
ScopedMemorySegment(DiscardableSharedMemoryHeap* heap,
scoped_ptr<base::DiscardableSharedMemory> shared_memory,
- size_t size);
+ size_t size,
+ const base::Closure& deleted_callback);
~ScopedMemorySegment();
bool IsUsed() const;
@@ -95,6 +99,7 @@ class CONTENT_EXPORT DiscardableSharedMemoryHeap {
DiscardableSharedMemoryHeap* const heap_;
scoped_ptr<base::DiscardableSharedMemory> shared_memory_;
const size_t size_;
+ const base::Closure deleted_callback_;
DISALLOW_COPY_AND_ASSIGN(ScopedMemorySegment);
};
« no previous file with comments | « content/common/child_process_messages.h ('k') | content/common/discardable_shared_memory_heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698