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

Unified Diff: content/common/discardable_shared_memory_heap.h

Issue 1100073004: Adding discardable memory dump provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing tests. Created 5 years, 8 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
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..04fd41bb9f5949c9867a4b9362f3f846ca564292 100644
--- a/content/common/discardable_shared_memory_heap.h
+++ b/content/common/discardable_shared_memory_heap.h
@@ -10,6 +10,7 @@
#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"
namespace base {
@@ -53,6 +54,7 @@ class CONTENT_EXPORT DiscardableSharedMemoryHeap {
// |shared_memory| has been deleted.
scoped_ptr<Span> Grow(scoped_ptr<base::DiscardableSharedMemory> shared_memory,
size_t size,
+ int32_t id,
const base::Closure& deleted_callback);
// Merge |span| into the free lists. This will coalesce |span| with
@@ -83,22 +85,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);
reveman 2015/04/27 19:04:00 nit: the return value is not used so you can remov
+
private:
class ScopedMemorySegment {
public:
ScopedMemorySegment(DiscardableSharedMemoryHeap* heap,
scoped_ptr<base::DiscardableSharedMemory> shared_memory,
size_t size,
+ int32_t id,
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 int32_t id_;
const base::Closure deleted_callback_;
DISALLOW_COPY_AND_ASSIGN(ScopedMemorySegment);
@@ -115,6 +125,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 size,
+ int32_t id,
+ base::trace_event::ProcessMemoryDump* pmd);
+
size_t block_size_;
size_t num_blocks_;
size_t num_free_blocks_;
« no previous file with comments | « content/child/child_discardable_shared_memory_manager.cc ('k') | content/common/discardable_shared_memory_heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698