Index: base/trace_event/process_memory_dump.cc |
diff --git a/base/trace_event/process_memory_dump.cc b/base/trace_event/process_memory_dump.cc |
index ae60bb06b152639c0e80ab2226a6a96b65699351..10dd8985ce0c25e716e048d01fa7b5b82512052f 100644 |
--- a/base/trace_event/process_memory_dump.cc |
+++ b/base/trace_event/process_memory_dump.cc |
@@ -135,10 +135,23 @@ MemoryAllocatorDump* ProcessMemoryDump::CreateSharedGlobalAllocatorDump( |
const MemoryAllocatorDumpGuid& guid) { |
// A shared allocator dump can be shared within a process and the guid could |
// have been created already. |
- MemoryAllocatorDump* allocator_dump = GetSharedGlobalAllocatorDump(guid); |
- return allocator_dump ? allocator_dump |
- : CreateAllocatorDump( |
- GetSharedGlobalAllocatorDumpName(guid), guid); |
+ MemoryAllocatorDump* mad = GetSharedGlobalAllocatorDump(guid); |
+ if (mad) { |
+ // The weak flag is unset because this method should create a non-weak dump. |
+ mad->unset_flags(MemoryAllocatorDump::Flag::WEAK); |
+ return mad; |
+ } |
+ return CreateAllocatorDump(GetSharedGlobalAllocatorDumpName(guid), guid); |
+} |
+ |
+MemoryAllocatorDump* ProcessMemoryDump::CreateWeakSharedGlobalAllocatorDump( |
+ const MemoryAllocatorDumpGuid& guid) { |
+ MemoryAllocatorDump* mad = GetSharedGlobalAllocatorDump(guid); |
+ if (mad) |
+ return mad; |
+ mad = CreateAllocatorDump(GetSharedGlobalAllocatorDumpName(guid), guid); |
+ mad->set_flags(MemoryAllocatorDump::Flag::WEAK); |
+ return mad; |
} |
MemoryAllocatorDump* ProcessMemoryDump::GetSharedGlobalAllocatorDump( |