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

Unified Diff: ui/gfx/mac/io_surface.cc

Issue 1709443002: Clear IOSurfaces immediately after creating them. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from avi. Created 4 years, 10 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 | « no previous file | ui/gl/test/gl_image_test_template.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | ui/gl/test/gl_image_test_template.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698