Index: ui/gl/gl_image_io_surface.mm |
diff --git a/ui/gl/gl_image_io_surface.mm b/ui/gl/gl_image_io_surface.mm |
index 3b8edcb13d79d7708bf1e4b5cbcbbbac53d617a7..621553f3c6b63b7ce83950e6ab04fb55e90909c5 100644 |
--- a/ui/gl/gl_image_io_surface.mm |
+++ b/ui/gl/gl_image_io_surface.mm |
@@ -127,9 +127,11 @@ GLenum DataType(BufferFormat format) { |
} // namespace |
-GLImageIOSurface::GLImageIOSurface(const gfx::Size& size, |
+GLImageIOSurface::GLImageIOSurface(gfx::GenericSharedMemoryId io_surface_id, |
+ const gfx::Size& size, |
unsigned internalformat) |
- : size_(size), |
+ : io_surface_id_(io_surface_id), |
+ size_(size), |
internalformat_(internalformat), |
format_(BufferFormat::RGBA_8888) {} |
@@ -207,6 +209,25 @@ bool GLImageIOSurface::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
return false; |
} |
+void GLImageIOSurface::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, |
+ uint64_t process_tracing_id, |
+ const std::string& dump_name) { |
+ // IOSurfaceGetAllocSize will return 0 if io_surface_ is invalid. In this case |
+ // we log 0 for consistency with other GLImage memory dump functions. |
+ size_t size_bytes = IOSurfaceGetAllocSize(io_surface_); |
+ |
+ 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, |
+ io_surface_id_); |
+ pmd->CreateSharedGlobalAllocatorDump(guid); |
+ pmd->AddOwnershipEdge(dump->guid(), guid); |
+} |
+ |
base::ScopedCFTypeRef<IOSurfaceRef> GLImageIOSurface::io_surface() { |
return io_surface_; |
} |