Chromium Code Reviews| Index: ui/compositor/layer.h |
| diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h |
| index 7c7e4e32562c1899c69a438587c10cc6aaeafea6..9e6e5a5bc627cc35ef9640c5e33bbebe62bdef82 100644 |
| --- a/ui/compositor/layer.h |
| +++ b/ui/compositor/layer.h |
| @@ -28,6 +28,7 @@ |
| #include "ui/compositor/compositor.h" |
| #include "ui/compositor/layer_animation_delegate.h" |
| #include "ui/compositor/layer_delegate.h" |
| +#include "ui/compositor/layer_observer.h" |
| #include "ui/compositor/layer_type.h" |
| #include "ui/gfx/geometry/rect.h" |
| #include "ui/gfx/image/image_skia.h" |
| @@ -52,7 +53,6 @@ namespace ui { |
| class Compositor; |
| class LayerAnimator; |
| -class LayerObserver; |
| class LayerOwner; |
| class LayerThreadedAnimationDelegate; |
| @@ -68,12 +68,14 @@ class LayerThreadedAnimationDelegate; |
| // NULL, but the children are not deleted. |
| class COMPOSITOR_EXPORT Layer |
| : public LayerAnimationDelegate, |
| + public LayerObserver, |
| NON_EXPORTED_BASE(public cc::ContentLayerClient), |
| NON_EXPORTED_BASE(public cc::TextureLayerClient), |
| NON_EXPORTED_BASE(public cc::LayerClient) { |
| public: |
| Layer(); |
| explicit Layer(LayerType type); |
| + explicit Layer(const Layer&); |
|
sky
2016/10/13 19:21:33
The style guide generally frowns on this, especial
Dominik Laskowski
2016/10/13 22:19:39
It's also called from LayerOwner::RecreateLayer. W
sky
2016/10/14 15:18:41
Yes please.
Dominik Laskowski
2016/10/14 19:15:02
Done.
|
| ~Layer() override; |
| // Retrieves the Layer's compositor. The Layer will walk up its parent chain |
| @@ -294,6 +296,13 @@ class COMPOSITOR_EXPORT Layer |
| float scale, |
| gfx::Size frame_size_in_dip); |
| + // Returns a new layer that mirrors this layer and is optionally synchronized |
| + // with the bounds thereof. Note that children are not mirrored, and that the |
| + // content is only mirrored if backed by a surface. |
| + std::unique_ptr<Layer> Mirror(); |
| + |
| + void set_sync_bounds(bool sync_bounds) { sync_bounds_ = sync_bounds; } |
| + |
| bool has_external_content() { |
| return texture_layer_.get() || surface_layer_.get(); |
| } |
| @@ -303,7 +312,7 @@ class COMPOSITOR_EXPORT Layer |
| // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. |
| void SetColor(SkColor color); |
| - SkColor GetTargetColor(); |
| + SkColor GetTargetColor() const; |
| SkColor background_color() const; |
| // Updates the nine patch layer's image, aperture and border. May only be |
| @@ -414,6 +423,9 @@ class COMPOSITOR_EXPORT Layer |
| LayerThreadedAnimationDelegate* GetThreadedAnimationDelegate() override; |
| LayerAnimatorCollection* GetLayerAnimatorCollection() override; |
| + // LayerObserver: |
| + void LayerDestroyed(Layer* layer) override; |
| + |
| // Creates a corresponding composited layer for |type_|. |
| void CreateCcLayer(); |
| @@ -442,6 +454,9 @@ class COMPOSITOR_EXPORT Layer |
| // This layer's children, in bottom-to-top stacking order. |
| std::vector<Layer*> children_; |
| + std::vector<Layer*> mirrors_; // Not owned. |
|
sky
2016/10/13 19:21:33
std::vector->std::set as you don't need the order.
Dominik Laskowski
2016/10/13 22:19:39
I started with std::unordered_set, but figured std
sky
2016/10/14 15:18:41
I like set to convey it's unordered, but ok.
|
| + bool sync_bounds_ = false; // Synchronize bounds to mirrors. |
| + |
| gfx::Rect bounds_; |
| gfx::Vector2dF subpixel_position_offset_; |
| @@ -523,7 +538,7 @@ class COMPOSITOR_EXPORT Layer |
| // or SetTextureMailbox was called. |
| gfx::Size frame_size_in_dip_; |
| - DISALLOW_COPY_AND_ASSIGN(Layer); |
| + DISALLOW_ASSIGN(Layer); |
| }; |
| } // namespace ui |