OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gfx/mac/io_surface.h" | 5 #include "ui/gfx/mac/io_surface.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 157 } |
158 | 158 |
159 IOSurfaceRef surface = IOSurfaceCreate(properties); | 159 IOSurfaceRef surface = IOSurfaceCreate(properties); |
160 | 160 |
161 // For unknown reasons, triggering this lock on OS X 10.9, on certain GPUs, | 161 // For unknown reasons, triggering this lock on OS X 10.9, on certain GPUs, |
162 // causes PDFs to render incorrectly. Hopefully this check can be removed once | 162 // causes PDFs to render incorrectly. Hopefully this check can be removed once |
163 // pdfium switches to a Skia backend on Mac. | 163 // pdfium switches to a Skia backend on Mac. |
164 // https://crbug.com/594343. | 164 // https://crbug.com/594343. |
165 // IOSurface clearing causes significant performance regression on about half | 165 // IOSurface clearing causes significant performance regression on about half |
166 // of all devices running Yosemite. https://crbug.com/606850#c22. | 166 // of all devices running Yosemite. https://crbug.com/606850#c22. |
167 bool should_clear = !base::mac::IsOSMavericks() && !base::mac::IsOSYosemite(); | 167 bool should_clear = !base::mac::IsOS10_9() && !base::mac::IsOS10_10(); |
168 | 168 |
169 if (should_clear) { | 169 if (should_clear) { |
170 // Zero-initialize the IOSurface. Calling IOSurfaceLock/IOSurfaceUnlock | 170 // Zero-initialize the IOSurface. Calling IOSurfaceLock/IOSurfaceUnlock |
171 // appears to be sufficient. https://crbug.com/584760#c17 | 171 // appears to be sufficient. https://crbug.com/584760#c17 |
172 IOReturn r = IOSurfaceLock(surface, 0, nullptr); | 172 IOReturn r = IOSurfaceLock(surface, 0, nullptr); |
173 DCHECK_EQ(kIOReturnSuccess, r); | 173 DCHECK_EQ(kIOReturnSuccess, r); |
174 r = IOSurfaceUnlock(surface, 0, nullptr); | 174 r = IOSurfaceUnlock(surface, 0, nullptr); |
175 DCHECK_EQ(kIOReturnSuccess, r); | 175 DCHECK_EQ(kIOReturnSuccess, r); |
176 } | 176 } |
177 | 177 |
(...skipping 11 matching lines...) Expand all Loading... |
189 // Note that nullptr is an acceptable input to IOSurfaceSetValue. | 189 // Note that nullptr is an acceptable input to IOSurfaceSetValue. |
190 IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), color_space_icc); | 190 IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), color_space_icc); |
191 } | 191 } |
192 | 192 |
193 UMA_HISTOGRAM_TIMES("GPU.IOSurface.CreateTime", | 193 UMA_HISTOGRAM_TIMES("GPU.IOSurface.CreateTime", |
194 base::TimeTicks::Now() - start_time); | 194 base::TimeTicks::Now() - start_time); |
195 return surface; | 195 return surface; |
196 } | 196 } |
197 | 197 |
198 } // namespace gfx | 198 } // namespace gfx |
OLD | NEW |