Chromium Code Reviews| Index: ui/accelerated_widget_mac/ca_layer_tree_host.h |
| diff --git a/ui/accelerated_widget_mac/ca_layer_tree_host.h b/ui/accelerated_widget_mac/ca_layer_tree_host.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..138a87dd39da63fca026132107d59db51232ddc4 |
| --- /dev/null |
| +++ b/ui/accelerated_widget_mac/ca_layer_tree_host.h |
| @@ -0,0 +1,63 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_HOST_H_ |
| +#define UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_HOST_H_ |
| + |
| +#include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h" |
| +#include "ui/accelerated_widget_mac/ca_layer_partial_damage_tree_mac.h" |
| +#include "ui/accelerated_widget_mac/ca_layer_tree_mac.h" |
| + |
| +namespace ui { |
| + |
| +// 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
|
| +// CALayer tree may consist of a CALayerPartialDamageTree if the OpenGL renderer |
| +// is being used, or a CALayerTree if the CoreAnimation renderer is being used. |
| +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.
|
| + public: |
| + 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
|
| + ~CALayerTreeHost(); |
| + |
| + // Set the composited frame's size. |
| + void Resize(const gfx::Size& pixel_size, float scale_factor); |
| + |
| + // Set the OpenGL backbuffer to which the pending frame was rendered. This is |
| + // used to draw frames created by the OpenGL renderer. |
| + bool SetPendingBackbuffer(base::ScopedCFTypeRef<IOSurfaceRef> backbuffer); |
| + |
| + // The the CALayerTree for the pending frame. This is used to construct the |
| + // CALayer tree for the CoreAnimation renderer. |
| + CALayerTree* GetPendingCALayerTree(); |
| + |
| + // Commit the pending frame's OpenGL backbuffer or CALayer tree to be |
| + // attached to the root CALayer. |
| + void CommitPendingTreesToCA(const gfx::Rect& pixel_damage_rect); |
| + |
| + // Get the root CALayer to display the current frame. |
| + CALayer* GetRootCALayer() const { return root_ca_layer_.get(); } |
| + |
| + // Get the current frame's OpenGL backbuffer IOSurface. This is only needed |
| + // when not using remote layers. |
| + IOSurfaceRef GetFrontbufferIOSurface(); |
| + |
| + private: |
| + bool allow_remote_layers_ = true; |
| + gfx::Size pixel_size_; |
| + float scale_factor_ = 1; |
| + |
| + base::scoped_nsobject<CALayer> root_ca_layer_; |
| + |
| + // Frame that has been scheduled, but has not had a subsequent commit call |
| + // made yet. |
| + std::unique_ptr<CALayerPartialDamageTree> pending_partial_damage_tree_; |
| + std::unique_ptr<CALayerTree> pending_ca_layer_tree_; |
| + |
| + // Frame that is currently being displayed on the screen. |
| + std::unique_ptr<CALayerPartialDamageTree> current_partial_damage_tree_; |
| + std::unique_ptr<CALayerTree> current_ca_layer_tree_; |
| +}; |
| + |
| +} // namespace ui |
| + |
| +#endif // UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_HOST_H_ |