Index: ui/gl/gl_image_shared_memory.cc |
diff --git a/ui/gl/gl_image_shared_memory.cc b/ui/gl/gl_image_shared_memory.cc |
index 03f5aa8700cd58d7f120014b976077fe331172a2..291ad9b2254b5f4b00bc1f9854be1f217cda5521 100644 |
--- a/ui/gl/gl_image_shared_memory.cc |
+++ b/ui/gl/gl_image_shared_memory.cc |
@@ -6,6 +6,7 @@ |
#include "base/logging.h" |
#include "base/memory/shared_memory.h" |
+#include "base/memory/shared_memory_tracker.h" |
#include "base/numerics/safe_math.h" |
#include "base/process/process_handle.h" |
#include "base/sys_info.h" |
@@ -88,10 +89,19 @@ void GLImageSharedMemory::OnMemoryDump( |
base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
static_cast<uint64_t>(size_in_bytes)); |
- auto guid = |
- gfx::GetSharedMemoryGUIDForTracing(process_tracing_id, shared_memory_id_); |
- pmd->CreateSharedGlobalAllocatorDump(guid); |
- pmd->AddOwnershipEdge(dump->guid(), guid); |
+ if (shared_memory_) { |
+ auto name = shared_memory_->handle().GetGUIDNameForTracing(); |
+ // The same dump name might be already created on single-process mode. |
+ base::trace_event::MemoryAllocatorDump* local = |
+ pmd->GetOrCreateAllocatorDump(name); |
+ pmd->CreateSharedGlobalAllocatorDump(local->guid()); |
+ pmd->AddOwnershipEdge(dump->guid(), local->guid()); |
+ } else { |
+ auto guid = gfx::GetSharedMemoryGUIDForTracing(process_tracing_id, |
+ shared_memory_id_); |
+ pmd->CreateSharedGlobalAllocatorDump(guid); |
+ pmd->AddOwnershipEdge(dump->guid(), guid); |
+ } |
} |
} // namespace gl |