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

Side by Side Diff: ui/accelerated_widget_mac/ca_renderer_layer_tree.mm

Issue 2269473002: Mac: Disable AVSampleBufferDisplayLayer on Mac <10.11 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/accelerated_widget_mac/ca_renderer_layer_tree.h" 5 #include "ui/accelerated_widget_mac/ca_renderer_layer_tree.h"
6 6
7 #include <AVFoundation/AVFoundation.h> 7 #include <AVFoundation/AVFoundation.h>
8 #include <CoreMedia/CoreMedia.h> 8 #include <CoreMedia/CoreMedia.h>
9 #include <CoreVideo/CoreVideo.h> 9 #include <CoreVideo/CoreVideo.h>
10 #include <GLES2/gl2extchromium.h> 10 #include <GLES2/gl2extchromium.h>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/mac/mac_util.h"
13 #include "base/mac/sdk_forward_declarations.h" 14 #include "base/mac/sdk_forward_declarations.h"
14 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
15 #include "third_party/skia/include/core/SkColor.h" 16 #include "third_party/skia/include/core/SkColor.h"
16 #include "ui/base/cocoa/animation_utils.h" 17 #include "ui/base/cocoa/animation_utils.h"
17 #include "ui/base/ui_base_switches.h" 18 #include "ui/base/ui_base_switches.h"
18 #include "ui/gfx/geometry/dip_util.h" 19 #include "ui/gfx/geometry/dip_util.h"
19 20
20 #if !defined(MAC_OS_X_VERSION_10_8) || \ 21 #if !defined(MAC_OS_X_VERSION_10_8) || \
21 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8 22 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
22 extern NSString* const AVLayerVideoGravityResize; 23 extern NSString* const AVLayerVideoGravityResize;
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 ca_edge_aa_mask |= kCALayerTopEdge; 321 ca_edge_aa_mask |= kCALayerTopEdge;
321 if (edge_aa_mask & GL_CA_LAYER_EDGE_BOTTOM_CHROMIUM) 322 if (edge_aa_mask & GL_CA_LAYER_EDGE_BOTTOM_CHROMIUM)
322 ca_edge_aa_mask |= kCALayerBottomEdge; 323 ca_edge_aa_mask |= kCALayerBottomEdge;
323 } 324 }
324 325
325 // Only allow 4:2:0 frames which fill the layer's contents to be promoted to 326 // Only allow 4:2:0 frames which fill the layer's contents to be promoted to
326 // AV layers. 327 // AV layers.
327 if (IOSurfaceGetPixelFormat(io_surface) == 328 if (IOSurfaceGetPixelFormat(io_surface) ==
328 kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange && 329 kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange &&
329 contents_rect == gfx::RectF(0, 0, 1, 1)) { 330 contents_rect == gfx::RectF(0, 0, 1, 1)) {
330 use_av_layer = true; 331 // Disable AVSampleBufferDisplayLayer on <10.11 due to reports of memory
332 // leaks on 10.9.
333 // https://crbug.com/631485
334 if (base::mac::IsOSElCapitanOrLater())
335 use_av_layer = true;
331 } 336 }
332 } 337 }
333 338
334 CARendererLayerTree::ContentLayer::ContentLayer(ContentLayer&& layer) 339 CARendererLayerTree::ContentLayer::ContentLayer(ContentLayer&& layer)
335 : io_surface(layer.io_surface), 340 : io_surface(layer.io_surface),
336 cv_pixel_buffer(layer.cv_pixel_buffer), 341 cv_pixel_buffer(layer.cv_pixel_buffer),
337 contents_rect(layer.contents_rect), 342 contents_rect(layer.contents_rect),
338 rect(layer.rect), 343 rect(layer.rect),
339 background_color(layer.background_color), 344 background_color(layer.background_color),
340 ca_edge_aa_mask(layer.ca_edge_aa_mask), 345 ca_edge_aa_mask(layer.ca_edge_aa_mask),
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } else { 662 } else {
658 // Grey represents a CALayer that has not changed. 663 // Grey represents a CALayer that has not changed.
659 color.reset(CGColorCreateGenericRGB(0.5, 0.5, 0.5, 1)); 664 color.reset(CGColorCreateGenericRGB(0.5, 0.5, 0.5, 1));
660 } 665 }
661 [ca_layer setBorderWidth:1]; 666 [ca_layer setBorderWidth:1];
662 [ca_layer setBorderColor:color]; 667 [ca_layer setBorderColor:color];
663 } 668 }
664 } 669 }
665 670
666 } // namespace ui 671 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698