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

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: Addressed comments. 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..cb7282a2019117a28a21d64a22b862be51e2ebf7 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 {
@@ -17,6 +18,7 @@ class DiscardableSharedMemory;
}
namespace content {
+typedef int32_t DiscardableSharedMemoryId;
// Implements a heap of discardable shared memory. An array of free lists
// is used to keep track of free blocks.
@@ -83,22 +85,29 @@ class CONTENT_EXPORT DiscardableSharedMemoryHeap {
// Returns bytes of memory currently in the free lists.
size_t GetSizeOfFreeLists() const;
+ // Dumps memory statistics for chrome://tracing.
+ bool DumpMemoryStatisticsInto(base::trace_event::ProcessMemoryDump* pmd);
+
private:
class ScopedMemorySegment {
public:
ScopedMemorySegment(DiscardableSharedMemoryHeap* heap,
scoped_ptr<base::DiscardableSharedMemory> shared_memory,
size_t size,
+ DiscardableSharedMemoryId id,
const base::Closure& deleted_callback);
~ScopedMemorySegment();
bool IsUsed() const;
bool IsResident() const;
+ void DumpMemoryStatisticsInto(
reveman 2015/04/27 13:28:11 nit: maybe use the same name as MemoryDumpProvider
ssid 2015/04/27 14:27:01 Done.
+ 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);
@@ -114,6 +123,10 @@ class CONTENT_EXPORT DiscardableSharedMemoryHeap {
bool IsMemoryResident(const base::DiscardableSharedMemory* shared_memory);
void ReleaseMemory(const base::DiscardableSharedMemory* shared_memory,
size_t size);
+ void DumpSegmentStatistics(const base::DiscardableSharedMemory* shared_memory,
reveman 2015/04/27 13:28:11 nit: same here, maybe keep this consistent: DumpIn
ssid 2015/04/27 14:27:01 Done.
+ size_t segment_size,
+ DiscardableSharedMemoryId id,
+ base::trace_event::ProcessMemoryDump* pmd);
size_t block_size_;
size_t num_blocks_;

Powered by Google App Engine
This is Rietveld 408576698