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 23b9cfb87d237dc1a4016dc029a0086aaf05fca1..032ec30a6e067ab97c6f5b6ffcc928bccccb7594 100644 |
--- a/content/common/discardable_shared_memory_heap.h |
+++ b/content/common/discardable_shared_memory_heap.h |
@@ -10,7 +10,9 @@ |
#include "base/containers/linked_list.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/scoped_vector.h" |
+#include "base/trace_event/process_memory_dump.h" |
#include "content/common/content_export.h" |
+#include "content/common/host_discardable_shared_memory_manager.h" |
reveman
2015/04/27 15:08:58
nit: this might be a circular dependency in the fu
ssid
2015/04/27 15:21:56
Done.
|
namespace base { |
class DiscardableSharedMemory; |
@@ -53,6 +55,7 @@ class CONTENT_EXPORT DiscardableSharedMemoryHeap { |
// |shared_memory| has been deleted. |
scoped_ptr<Span> Grow(scoped_ptr<base::DiscardableSharedMemory> shared_memory, |
size_t size, |
+ DiscardableSharedMemoryId id, |
reveman
2015/04/27 15:08:58
int32_t to avoid circular dep
ssid
2015/04/27 15:21:56
Done.
|
const base::Closure& deleted_callback); |
// Merge |span| into the free lists. This will coalesce |span| with |
@@ -83,22 +86,30 @@ class CONTENT_EXPORT DiscardableSharedMemoryHeap { |
// Returns bytes of memory currently in the free lists. |
size_t GetSizeOfFreeLists() const; |
+ // Dumps memory statistics for chrome://tracing. |
+ bool DumpInto(base::trace_event::ProcessMemoryDump* pmd); |
+ |
private: |
class ScopedMemorySegment { |
public: |
ScopedMemorySegment(DiscardableSharedMemoryHeap* heap, |
scoped_ptr<base::DiscardableSharedMemory> shared_memory, |
size_t size, |
+ DiscardableSharedMemoryId id, |
reveman
2015/04/27 15:08:58
int32_t to avoid circular dep
ssid
2015/04/27 15:21:56
Done.
|
const base::Closure& deleted_callback); |
~ScopedMemorySegment(); |
bool IsUsed() const; |
bool IsResident() const; |
+ // Used for dumping memory statistics from the segment to chrome://tracing. |
+ void DumpInto(base::trace_event::ProcessMemoryDump* pmd) const; |
+ |
private: |
DiscardableSharedMemoryHeap* const heap_; |
scoped_ptr<base::DiscardableSharedMemory> shared_memory_; |
const size_t size_; |
+ const DiscardableSharedMemoryId id_; |
const base::Closure deleted_callback_; |
DISALLOW_COPY_AND_ASSIGN(ScopedMemorySegment); |
@@ -115,6 +126,12 @@ class CONTENT_EXPORT DiscardableSharedMemoryHeap { |
void ReleaseMemory(const base::DiscardableSharedMemory* shared_memory, |
size_t size); |
+ // Dumps memory statistics about a memory segment for chrome://tracing. |
+ void DumpInto(const base::DiscardableSharedMemory* shared_memory, |
+ size_t segment_size, |
reveman
2015/04/27 15:08:58
nit: s/segment_size/size/
ssid
2015/04/27 15:21:56
Done.
|
+ DiscardableSharedMemoryId id, |
reveman
2015/04/27 15:08:58
int32_t to avoid circular dep
ssid
2015/04/27 15:21:56
Done.
|
+ base::trace_event::ProcessMemoryDump* pmd); |
+ |
size_t block_size_; |
size_t num_blocks_; |
size_t num_free_blocks_; |