Index: base/trace_event/process_memory_dump.h |
diff --git a/base/trace_event/process_memory_dump.h b/base/trace_event/process_memory_dump.h |
index c18e10c374459182d6fae2cafa22aa5ae80ae9d9..f6d7090dd175c44fba4dd4d5c584ade80ecfb27e 100644 |
--- a/base/trace_event/process_memory_dump.h |
+++ b/base/trace_event/process_memory_dump.h |
@@ -34,6 +34,13 @@ class MemoryDumpManager; |
class MemoryDumpSessionState; |
class TracedValue; |
+// Args for ProcessMemoryDump. Dump providers are expected to read the args for |
+// creating dumps. |
+struct MemoryDumpArgs { |
+ // Specifies how detailed the dumps should be. |
+ MemoryDumpLevelOfDetail level_of_detail; |
+}; |
+ |
// ProcessMemoryDump is as a strongly typed container which holds the dumps |
// produced by the MemoryDumpProvider(s) for a specific process. |
class BASE_EXPORT ProcessMemoryDump { |
@@ -67,7 +74,8 @@ class BASE_EXPORT ProcessMemoryDump { |
static size_t CountResidentBytes(void* start_address, size_t mapped_size); |
#endif |
- ProcessMemoryDump(scoped_refptr<MemoryDumpSessionState> session_state); |
+ ProcessMemoryDump(scoped_refptr<MemoryDumpSessionState> session_state, |
+ const MemoryDumpArgs& dump_args); |
~ProcessMemoryDump(); |
// Creates a new MemoryAllocatorDump with the given name and returns the |
@@ -175,7 +183,16 @@ class BASE_EXPORT ProcessMemoryDump { |
const HeapDumpsMap& heap_dumps() const { return heap_dumps_; } |
+ const MemoryDumpArgs& dump_args() const { return dump_args_; } |
+ |
+ MemoryAllocatorDump* black_hole_mad_for_testing() { |
+ return black_hole_mad_.get(); |
+ } |
+ |
private: |
+ friend class ProcessMemoryDumpTest; |
+ FRIEND_TEST_ALL_PREFIXES(ProcessMemoryDumpTest, BackgroundModeTest); |
+ |
MemoryAllocatorDump* AddAllocatorDumpInternal( |
std::unique_ptr<MemoryAllocatorDump> mad); |
@@ -194,6 +211,14 @@ class BASE_EXPORT ProcessMemoryDump { |
// Keeps track of relationships between MemoryAllocatorDump(s). |
std::vector<MemoryAllocatorDumpEdge> allocator_dumps_edges_; |
+ // Level of detail of the current dump. |
+ const MemoryDumpArgs dump_args_; |
+ |
+ // This allocator dump is returned when an invalid dump is created in |
+ // background mode. The attributes of the dump are ignored and not added to |
+ // the trace. |
+ std::unique_ptr<MemoryAllocatorDump> black_hole_mad_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); |
}; |