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

Unified Diff: base/trace_event/memory_dump_manager.cc

Issue 2831073003: Reland of [Memory UMA] Return the extra_processes_dump map as part of the ResponseCallback (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | mojo/common/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/memory_dump_manager.cc
diff --git a/base/trace_event/memory_dump_manager.cc b/base/trace_event/memory_dump_manager.cc
index 5f217eaf9a0aa45f6b9b8e6337eea76dc0b1bf8c..ed73b9e71a5bd10d2dc80c2286805793c9134ad4 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -742,8 +742,7 @@
// The results struct to fill.
// TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203
- base::Optional<MemoryDumpCallbackResult> result_opt;
-
+ base::Optional<MemoryDumpCallbackResult> result;
for (const auto& kv : pmd_async_state->process_dumps) {
ProcessId pid = kv.first; // kNullProcessId for the current process.
ProcessMemoryDump* process_memory_dump = kv.second.get();
@@ -771,28 +770,28 @@
if (pmd_async_state->req_args.level_of_detail ==
MemoryDumpLevelOfDetail::DETAILED)
continue;
- MemoryDumpCallbackResult result;
+ if (!result.has_value())
+ result = MemoryDumpCallbackResult();
// TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203
if (pid == kNullProcessId) {
- result.chrome_dump.malloc_total_kb =
+ result->chrome_dump.malloc_total_kb =
GetDumpsSumKb("malloc", process_memory_dump);
- result.chrome_dump.v8_total_kb =
+ result->chrome_dump.v8_total_kb =
GetDumpsSumKb("v8/*", process_memory_dump);
// partition_alloc reports sizes for both allocated_objects and
// partitions. The memory allocated_objects uses is a subset of
// the partitions memory so to avoid double counting we only
// count partitions memory.
- result.chrome_dump.partition_alloc_total_kb =
+ result->chrome_dump.partition_alloc_total_kb =
GetDumpsSumKb("partition_alloc/partitions/*", process_memory_dump);
- result.chrome_dump.blink_gc_total_kb =
+ result->chrome_dump.blink_gc_total_kb =
GetDumpsSumKb("blink_gc", process_memory_dump);
- FillOsDumpFromProcessMemoryDump(process_memory_dump, &result.os_dump);
+ FillOsDumpFromProcessMemoryDump(process_memory_dump, &result->os_dump);
} else {
- auto& os_dump = result.extra_processes_dump[pid];
+ auto& os_dump = result->extra_processes_dump[pid];
FillOsDumpFromProcessMemoryDump(process_memory_dump, &os_dump);
}
- result_opt = result;
}
bool tracing_still_enabled;
@@ -805,7 +804,7 @@
if (!pmd_async_state->callback.is_null()) {
pmd_async_state->callback.Run(dump_guid, pmd_async_state->dump_successful,
- result_opt);
+ result);
pmd_async_state->callback.Reset();
}
« no previous file with comments | « no previous file | mojo/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698