| Index: base/trace_event/malloc_dump_provider.cc
|
| diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc
|
| index 7f2706092ee6f7aafc8283ca22e67bad13022c3c..8a902422345fa05e236a7da81136b0f0e26ed094 100644
|
| --- a/base/trace_event/malloc_dump_provider.cc
|
| +++ b/base/trace_event/malloc_dump_provider.cc
|
| @@ -286,9 +286,11 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
|
| return true;
|
|
|
| // The dumps of the heap profiler should be created only when heap profiling
|
| - // was enabled (--enable-heap-profiling) AND a DETAILED dump is requested.
|
| - // However, when enabled, the overhead of the heap profiler should be always
|
| - // reported to avoid oscillations of the malloc total in LIGHT dumps.
|
| + // was enabled with any mode AND a DETAILED dump is requested or heap
|
| + // profiling was enabled with BACKGROUND mode AND BACKGROUND dump is
|
| + // requested. However, when enabled, the overhead of the heap profiler should
|
| + // be always reported to avoid oscillations of the malloc total in LIGHT
|
| + // dumps.
|
|
|
| tid_dumping_heap_ = PlatformThread::CurrentId();
|
| // At this point the Insert/RemoveAllocation hooks will ignore this thread.
|
| @@ -300,7 +302,10 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
|
| {
|
| AutoLock lock(allocation_register_lock_);
|
| if (allocation_register_) {
|
| - if (args.level_of_detail == MemoryDumpLevelOfDetail::DETAILED) {
|
| + if (args.level_of_detail == MemoryDumpLevelOfDetail::DETAILED ||
|
| + (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND &&
|
| + AllocationContextTracker::capture_mode() ==
|
| + AllocationContextTracker::CaptureMode::BACKGROUND)) {
|
| for (const auto& alloc_size : *allocation_register_) {
|
| AllocationMetrics& metrics = metrics_by_context[alloc_size.context];
|
| metrics.size += alloc_size.size;
|
|
|