| OLD | NEW |
| 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_layer_tree_coordinator.h" | 5 #include "ui/accelerated_widget_mac/ca_layer_tree_coordinator.h" |
| 6 | 6 |
| 7 #include <AVFoundation/AVFoundation.h> | 7 #include <AVFoundation/AVFoundation.h> |
| 8 | 8 |
| 9 #include "base/mac/mac_util.h" |
| 9 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 10 #include "ui/base/cocoa/animation_utils.h" | 11 #include "ui/base/cocoa/animation_utils.h" |
| 11 | 12 |
| 12 namespace ui { | 13 namespace ui { |
| 13 | 14 |
| 14 CALayerTreeCoordinator::CALayerTreeCoordinator( | 15 CALayerTreeCoordinator::CALayerTreeCoordinator( |
| 15 bool allow_remote_layers, | 16 bool allow_remote_layers, |
| 16 bool allow_av_sample_buffer_display_layer) | 17 bool allow_av_sample_buffer_display_layer) |
| 17 : allow_remote_layers_(allow_remote_layers), | 18 : allow_remote_layers_(allow_remote_layers), |
| 18 allow_av_sample_buffer_display_layer_( | 19 allow_av_sample_buffer_display_layer_( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 return true; | 55 return true; |
| 55 } | 56 } |
| 56 | 57 |
| 57 CARendererLayerTree* CALayerTreeCoordinator::GetPendingCARendererLayerTree() { | 58 CARendererLayerTree* CALayerTreeCoordinator::GetPendingCARendererLayerTree() { |
| 58 DCHECK(allow_remote_layers_); | 59 DCHECK(allow_remote_layers_); |
| 59 if (pending_gl_renderer_layer_tree_) { | 60 if (pending_gl_renderer_layer_tree_) { |
| 60 DLOG(ERROR) << "Either CALayer overlays or a backbuffer should be " | 61 DLOG(ERROR) << "Either CALayer overlays or a backbuffer should be " |
| 61 "specified, but not both."; | 62 "specified, but not both."; |
| 62 } | 63 } |
| 63 if (!pending_ca_renderer_layer_tree_) | 64 if (!pending_ca_renderer_layer_tree_) |
| 64 pending_ca_renderer_layer_tree_.reset( | 65 pending_ca_renderer_layer_tree_.reset(new CARendererLayerTree( |
| 65 new CARendererLayerTree(allow_av_sample_buffer_display_layer_)); | 66 allow_av_sample_buffer_display_layer_, base::mac::IsAtLeastOS10_12())); |
| 66 return pending_ca_renderer_layer_tree_.get(); | 67 return pending_ca_renderer_layer_tree_.get(); |
| 67 } | 68 } |
| 68 | 69 |
| 69 void CALayerTreeCoordinator::CommitPendingTreesToCA( | 70 void CALayerTreeCoordinator::CommitPendingTreesToCA( |
| 70 const gfx::Rect& pixel_damage_rect, | 71 const gfx::Rect& pixel_damage_rect, |
| 71 bool* fullscreen_low_power_layer_valid) { | 72 bool* fullscreen_low_power_layer_valid) { |
| 72 *fullscreen_low_power_layer_valid = false; | 73 *fullscreen_low_power_layer_valid = false; |
| 73 | 74 |
| 74 // Update the CALayer hierarchy. | 75 // Update the CALayer hierarchy. |
| 75 ScopedCAActionDisabler disabler; | 76 ScopedCAActionDisabler disabler; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 120 } |
| 120 | 121 |
| 121 IOSurfaceRef CALayerTreeCoordinator::GetIOSurfaceForDisplay() { | 122 IOSurfaceRef CALayerTreeCoordinator::GetIOSurfaceForDisplay() { |
| 122 DCHECK(!allow_remote_layers_); | 123 DCHECK(!allow_remote_layers_); |
| 123 if (!current_gl_renderer_layer_tree_) | 124 if (!current_gl_renderer_layer_tree_) |
| 124 return nullptr; | 125 return nullptr; |
| 125 return current_gl_renderer_layer_tree_->RootLayerIOSurface(); | 126 return current_gl_renderer_layer_tree_->RootLayerIOSurface(); |
| 126 } | 127 } |
| 127 | 128 |
| 128 } // namespace ui | 129 } // namespace ui |
| OLD | NEW |