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..f889befe7aae56d8396921cb5029cb658f6b8735 100644 |
--- a/base/trace_event/process_memory_dump.cc |
+++ b/base/trace_event/process_memory_dump.cc |
@@ -135,10 +135,24 @@ 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); |
+ // The weak flag is unset because this method should create non-weak dump. |
petrcermak
2016/01/18 11:23:46
nit: s/non-weak/a non-weak/
ssid
2016/01/18 16:28:36
Done.
|
+ if (mad) |
petrcermak
2016/01/18 11:23:46
I think that the following would be more readable:
ssid
2016/01/18 16:28:36
Done.
|
+ mad->unset_flags(MemoryAllocatorDump::Flag::WEAK); |
+ else |
+ mad = CreateAllocatorDump(GetSharedGlobalAllocatorDumpName(guid), guid); |
+ return mad; |
+} |
+ |
+MemoryAllocatorDump* ProcessMemoryDump::CreateWeakSharedGlobalAllocatorDump( |
+ const MemoryAllocatorDumpGuid& guid) { |
+ MemoryAllocatorDump* mad = GetSharedGlobalAllocatorDump(guid); |
+ if (!mad) { |
+ mad = new MemoryAllocatorDump(GetSharedGlobalAllocatorDumpName(guid), this, |
petrcermak
2016/01/18 11:23:46
At this point, I wonder whether it wouldn't make m
ssid
2016/01/18 16:28:36
Hm not sure if one line method is really needed. U
petrcermak
2016/01/18 17:18:12
Acknowledged.
|
+ guid, MemoryAllocatorDump::Flag::WEAK); |
+ AddAllocatorDumpInternal(mad); // Takes ownership of |mad|. |
+ } |
+ return mad; |
} |
MemoryAllocatorDump* ProcessMemoryDump::GetSharedGlobalAllocatorDump( |