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

Unified Diff: base/trace_event/process_memory_dump.h

Issue 2006943003: [tracing] Sanitize process memory dumps for background mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@whitelist_mdp
Patch Set: Fixes. Created 4 years, 7 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: 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);
};

Powered by Google App Engine
This is Rietveld 408576698