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 #ifndef UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_HOST_H_ | 5 #ifndef UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_HOST_H_ |
6 #define UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_HOST_H_ | 6 #define UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_HOST_H_ |
7 | 7 |
8 #include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h" | 8 #include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h" |
9 #include "ui/accelerated_widget_mac/ca_renderer_layer_tree.h" | 9 #include "ui/accelerated_widget_mac/ca_renderer_layer_tree.h" |
10 #include "ui/accelerated_widget_mac/gl_renderer_layer_tree.h" | 10 #include "ui/accelerated_widget_mac/gl_renderer_layer_tree.h" |
11 | 11 |
12 namespace ui { | 12 namespace ui { |
13 | 13 |
14 // A structure that holds the tree of CALayers to display composited content. | 14 // A structure that holds the tree of CALayers to display composited content. |
15 // The CALayer tree may consist of a GLRendererLayerTree if the OpenGL renderer | 15 // The CALayer tree may consist of a GLRendererLayerTree if the OpenGL renderer |
16 // is being used, or a CARendererLayerTree if the CoreAnimation renderer is | 16 // is being used, or a CARendererLayerTree if the CoreAnimation renderer is |
17 // being used. | 17 // being used. |
18 // | 18 // |
19 // This is instantiated in the GPU process and sent to the browser process via | 19 // This is instantiated in the GPU process and sent to the browser process via |
20 // the cross-process CoreAnimation API. This is intended to be moved entirely | 20 // the cross-process CoreAnimation API. This is intended to be moved entirely |
21 // to the browser process in https://crbug.com/604052. | 21 // to the browser process in https://crbug.com/604052. |
22 class ACCELERATED_WIDGET_MAC_EXPORT CALayerTreeCoordinator { | 22 class ACCELERATED_WIDGET_MAC_EXPORT CALayerTreeCoordinator { |
23 public: | 23 public: |
24 explicit CALayerTreeCoordinator(bool allow_remote_layers); | 24 explicit CALayerTreeCoordinator(bool allow_remote_layers, |
| 25 bool allow_av_sample_buffer_display_layer); |
25 ~CALayerTreeCoordinator(); | 26 ~CALayerTreeCoordinator(); |
26 | 27 |
27 // Set the composited frame's size. | 28 // Set the composited frame's size. |
28 void Resize(const gfx::Size& pixel_size, float scale_factor); | 29 void Resize(const gfx::Size& pixel_size, float scale_factor); |
29 | 30 |
30 // Set the OpenGL backbuffer to which the pending frame was rendered. This is | 31 // Set the OpenGL backbuffer to which the pending frame was rendered. This is |
31 // used to draw frames created by the OpenGL renderer. | 32 // used to draw frames created by the OpenGL renderer. |
32 bool SetPendingGLRendererBackbuffer( | 33 bool SetPendingGLRendererBackbuffer( |
33 base::ScopedCFTypeRef<IOSurfaceRef> backbuffer); | 34 base::ScopedCFTypeRef<IOSurfaceRef> backbuffer); |
34 | 35 |
(...skipping 14 matching lines...) Expand all Loading... |
49 | 50 |
50 // Get the CALayer to display fullscreen low power content. This does not | 51 // Get the CALayer to display fullscreen low power content. This does not |
51 // change over the lifetime of the object. | 52 // change over the lifetime of the object. |
52 CALayer* GetFullscreenLowPowerLayerForDisplay() const; | 53 CALayer* GetFullscreenLowPowerLayerForDisplay() const; |
53 | 54 |
54 // Get the current frame's OpenGL backbuffer IOSurface. This is only needed | 55 // Get the current frame's OpenGL backbuffer IOSurface. This is only needed |
55 // when not using remote layers. | 56 // when not using remote layers. |
56 IOSurfaceRef GetIOSurfaceForDisplay(); | 57 IOSurfaceRef GetIOSurfaceForDisplay(); |
57 | 58 |
58 private: | 59 private: |
59 bool allow_remote_layers_ = true; | 60 const bool allow_remote_layers_ = true; |
| 61 const bool allow_av_sample_buffer_display_layer_ = true; |
60 gfx::Size pixel_size_; | 62 gfx::Size pixel_size_; |
61 float scale_factor_ = 1; | 63 float scale_factor_ = 1; |
62 | 64 |
63 base::scoped_nsobject<CALayer> root_ca_layer_; | 65 base::scoped_nsobject<CALayer> root_ca_layer_; |
64 base::scoped_nsobject<AVSampleBufferDisplayLayer> fullscreen_low_power_layer_; | 66 base::scoped_nsobject<AVSampleBufferDisplayLayer> fullscreen_low_power_layer_; |
65 | 67 |
66 // Frame that has been scheduled, but has not had a subsequent commit call | 68 // Frame that has been scheduled, but has not had a subsequent commit call |
67 // made yet. | 69 // made yet. |
68 std::unique_ptr<GLRendererLayerTree> pending_gl_renderer_layer_tree_; | 70 std::unique_ptr<GLRendererLayerTree> pending_gl_renderer_layer_tree_; |
69 std::unique_ptr<CARendererLayerTree> pending_ca_renderer_layer_tree_; | 71 std::unique_ptr<CARendererLayerTree> pending_ca_renderer_layer_tree_; |
70 | 72 |
71 // Frame that is currently being displayed on the screen. | 73 // Frame that is currently being displayed on the screen. |
72 std::unique_ptr<GLRendererLayerTree> current_gl_renderer_layer_tree_; | 74 std::unique_ptr<GLRendererLayerTree> current_gl_renderer_layer_tree_; |
73 std::unique_ptr<CARendererLayerTree> current_ca_renderer_layer_tree_; | 75 std::unique_ptr<CARendererLayerTree> current_ca_renderer_layer_tree_; |
74 bool current_fullscreen_low_power_layer_valid_ = false; | 76 bool current_fullscreen_low_power_layer_valid_ = false; |
75 | 77 |
76 DISALLOW_COPY_AND_ASSIGN(CALayerTreeCoordinator); | 78 DISALLOW_COPY_AND_ASSIGN(CALayerTreeCoordinator); |
77 }; | 79 }; |
78 | 80 |
79 } // namespace ui | 81 } // namespace ui |
80 | 82 |
81 #endif // UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_HOST_H_ | 83 #endif // UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_HOST_H_ |
OLD | NEW |