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 469a6f98d1c242a89e71792eb2c240ceb3d318c8..cb22c7562439363e334692f9c861057039e1c5e2 100644 |
--- a/ui/gl/gl_image_shared_memory.cc |
+++ b/ui/gl/gl_image_shared_memory.cc |
@@ -73,6 +73,7 @@ bool GLImageSharedMemory::Initialize(const gfx::GpuMemoryBufferHandle& handle, |
DCHECK(!shared_memory_); |
shared_memory_ = duped_shared_memory.Pass(); |
+ shared_memory_id_ = handle.id; |
return true; |
} |
@@ -81,4 +82,27 @@ void GLImageSharedMemory::Destroy(bool have_context) { |
shared_memory_.reset(); |
} |
+void GLImageSharedMemory::OnMemoryDump( |
+ base::trace_event::ProcessMemoryDump* pmd, |
+ uint64_t process_tracing_id, |
+ const std::string& dump_name) { |
+ size_t size_in_bytes = 0; |
+ |
+ if (shared_memory_) { |
+ bool result = SizeInBytes(GetSize(), format(), &size_in_bytes); |
+ DCHECK(result); |
+ } |
+ |
+ base::trace_event::MemoryAllocatorDump* dump = |
+ pmd->CreateAllocatorDump(dump_name); |
+ dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
+ static_cast<uint64_t>(size_in_bytes)); |
+ |
+ auto guid = gfx::GetGenericSharedMemoryGUIDForTracing(process_tracing_id, |
+ shared_memory_id_); |
+ pmd->CreateSharedGlobalAllocatorDump(guid); |
+ pmd->AddOwnershipEdge(dump->guid(), guid); |
+} |
+ |
} // namespace gfx |