Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_HOST_H_ | |
| 6 #define UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_HOST_H_ | |
| 7 | |
| 8 #include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h" | |
| 9 #include "ui/accelerated_widget_mac/ca_layer_partial_damage_tree_mac.h" | |
| 10 #include "ui/accelerated_widget_mac/ca_layer_tree_mac.h" | |
| 11 | |
| 12 namespace ui { | |
| 13 | |
| 14 // A structure that holds CALayer tree for web content from the compositor. The | |
|
erikchen
2016/04/25 20:05:36
Maybe: A structure that holds a tree of CALayers t
ccameron
2016/04/26 22:36:40
I changed it to "composited content", because a RW
| |
| 15 // CALayer tree may consist of a CALayerPartialDamageTree if the OpenGL renderer | |
| 16 // is being used, or a CALayerTree if the CoreAnimation renderer is being used. | |
| 17 class ACCELERATED_WIDGET_MAC_EXPORT CALayerTreeHost { | |
|
erikchen
2016/04/25 20:05:36
disallow copy and assign?
Also, I prefer that you
ccameron
2016/04/26 22:36:40
Done.
| |
| 18 public: | |
| 19 CALayerTreeHost(bool allow_remote_layers); | |
|
erikchen
2016/04/25 20:05:36
explicit
It looks like the public interface of th
ccameron
2016/04/26 22:36:40
Done
| |
| 20 ~CALayerTreeHost(); | |
| 21 | |
| 22 // Set the composited frame's size. | |
| 23 void Resize(const gfx::Size& pixel_size, float scale_factor); | |
| 24 | |
| 25 // Set the OpenGL backbuffer to which the pending frame was rendered. This is | |
| 26 // used to draw frames created by the OpenGL renderer. | |
| 27 bool SetPendingBackbuffer(base::ScopedCFTypeRef<IOSurfaceRef> backbuffer); | |
| 28 | |
| 29 // The the CALayerTree for the pending frame. This is used to construct the | |
| 30 // CALayer tree for the CoreAnimation renderer. | |
| 31 CALayerTree* GetPendingCALayerTree(); | |
| 32 | |
| 33 // Commit the pending frame's OpenGL backbuffer or CALayer tree to be | |
| 34 // attached to the root CALayer. | |
| 35 void CommitPendingTreesToCA(const gfx::Rect& pixel_damage_rect); | |
| 36 | |
| 37 // Get the root CALayer to display the current frame. | |
| 38 CALayer* GetRootCALayer() const { return root_ca_layer_.get(); } | |
| 39 | |
| 40 // Get the current frame's OpenGL backbuffer IOSurface. This is only needed | |
| 41 // when not using remote layers. | |
| 42 IOSurfaceRef GetFrontbufferIOSurface(); | |
| 43 | |
| 44 private: | |
| 45 bool allow_remote_layers_ = true; | |
| 46 gfx::Size pixel_size_; | |
| 47 float scale_factor_ = 1; | |
| 48 | |
| 49 base::scoped_nsobject<CALayer> root_ca_layer_; | |
| 50 | |
| 51 // Frame that has been scheduled, but has not had a subsequent commit call | |
| 52 // made yet. | |
| 53 std::unique_ptr<CALayerPartialDamageTree> pending_partial_damage_tree_; | |
| 54 std::unique_ptr<CALayerTree> pending_ca_layer_tree_; | |
| 55 | |
| 56 // Frame that is currently being displayed on the screen. | |
| 57 std::unique_ptr<CALayerPartialDamageTree> current_partial_damage_tree_; | |
| 58 std::unique_ptr<CALayerTree> current_ca_layer_tree_; | |
| 59 }; | |
| 60 | |
| 61 } // namespace ui | |
| 62 | |
| 63 #endif // UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_HOST_H_ | |
| OLD | NEW |