 Chromium Code Reviews
 Chromium Code Reviews Issue 1709443002:
  Clear IOSurfaces immediately after creating them.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1709443002:
  Clear IOSurfaces immediately after creating them.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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..a2348670f278188c7151cdb7d7aa3412b51ef41d 100644 | 
| --- a/ui/gfx/mac/io_surface.cc | 
| +++ b/ui/gfx/mac/io_surface.cc | 
| @@ -148,7 +148,17 @@ 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://code.google.com/p/chromium/issues/detail?id=584760#c17 | 
| 
Avi (use Gerrit)
2016/02/17 23:07:25
You can abbreviate it as
https://crbug.com/584760
 
erikchen
2016/02/17 23:55:30
Done.
 | 
| + IOReturn r = IOSurfaceLock(surface, 0, nullptr); | 
| + DCHECK_EQ(kIOReturnSuccess, r); | 
| + r = IOSurfaceUnlock(surface, 0, nullptr); | 
| + DCHECK_EQ(kIOReturnSuccess, r); | 
| + | 
| + return surface; | 
| } | 
| } // namespace gfx |