Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: ui/gl/gl_image_io_surface.mm

Issue 1299713003: GLImage::OnMemoryDump Stubs + Some Impls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@images1.3
Patch Set: Fix android build. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gl_image_io_surface.h ('k') | ui/gl/gl_image_memory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
}
« no previous file with comments | « ui/gl/gl_image_io_surface.h ('k') | ui/gl/gl_image_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698