Index: ui/gfx/mac/io_surface.cc |
diff --git a/ui/gfx/mac/io_surface.cc b/ui/gfx/mac/io_surface.cc |
index 8c748bca1846623b73902095adf8688df99598e8..e6079c7a2b1cc4045be6ca4a1de3ac760b831d1c 100644 |
--- a/ui/gfx/mac/io_surface.cc |
+++ b/ui/gfx/mac/io_surface.cc |
@@ -148,7 +148,16 @@ IOSurfaceRef CreateIOSurface(const gfx::Size& size, gfx::BufferFormat format) { |
BytesPerElement(format, 0)); |
} |
- return IOSurfaceCreate(properties); |
+ IOSurfaceRef surface = IOSurfaceCreate(properties); |
+ |
+ // Zero-initialize the IOSurface. Calling IOSurfaceLock/IOSurfaceUnlock |
+ // appears to be sufficient. https://crbug.com/584760#c17 |
+ IOReturn r = IOSurfaceLock(surface, 0, nullptr); |
+ DCHECK_EQ(kIOReturnSuccess, r); |
+ r = IOSurfaceUnlock(surface, 0, nullptr); |
+ DCHECK_EQ(kIOReturnSuccess, r); |
+ |
+ return surface; |
} |
} // namespace gfx |