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..da85075fe652cf1e6ead4e537572c33f865812c3 100644 |
--- a/ui/gl/gl_image_shared_memory.cc |
+++ b/ui/gl/gl_image_shared_memory.cc |
@@ -33,8 +33,7 @@ bool SizeInBytes(const gfx::Size& size, |
GLImageSharedMemory::GLImageSharedMemory(const gfx::Size& size, |
unsigned internalformat) |
- : GLImageMemory(size, internalformat) { |
-} |
+ : GLImageMemory(size, internalformat) {} |
GLImageSharedMemory::~GLImageSharedMemory() { |
DCHECK(!shared_memory_); |
@@ -73,6 +72,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 +81,23 @@ 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) { |
reveman
2015/08/18 08:32:52
This function should report 0 size or early out af
ericrk
2015/08/18 09:00:47
Switched both to report 0.
|
+ size_t size_bytes; |
+ SizeInBytes(GetSize(), format(), &size_bytes); |
+ |
+ 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_bytes)); |
+ |
+ auto guid = gfx::GetGenericSharedMemoryGUIDForTracing(process_tracing_id, |
+ shared_memory_id_); |
+ pmd->CreateSharedGlobalAllocatorDump(guid); |
+ pmd->AddOwnershipEdge(dump->guid(), guid); |
+} |
+ |
} // namespace gfx |