OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 CC_LAYERS_LAYER_H_ | 5 #ifndef CC_LAYERS_LAYER_H_ |
6 #define CC_LAYERS_LAYER_H_ | 6 #define CC_LAYERS_LAYER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 class ConvertableToTraceFormat; | 48 class ConvertableToTraceFormat; |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 namespace cc { | 52 namespace cc { |
53 | 53 |
54 class CopyOutputRequest; | 54 class CopyOutputRequest; |
55 class LayerAnimationEventObserver; | 55 class LayerAnimationEventObserver; |
56 class LayerClient; | 56 class LayerClient; |
57 class LayerImpl; | 57 class LayerImpl; |
58 class LayerSettings; | |
59 class LayerTreeHost; | 58 class LayerTreeHost; |
60 class LayerTreeHostCommon; | 59 class LayerTreeHostCommon; |
61 class LayerTreeImpl; | 60 class LayerTreeImpl; |
62 class LayerTreeSettings; | 61 class LayerTreeSettings; |
63 class RenderingStatsInstrumentation; | 62 class RenderingStatsInstrumentation; |
64 class ResourceUpdateQueue; | 63 class ResourceUpdateQueue; |
65 class ScrollbarLayerInterface; | 64 class ScrollbarLayerInterface; |
66 class SimpleEnclosedRegion; | 65 class SimpleEnclosedRegion; |
67 | 66 |
68 namespace proto { | 67 namespace proto { |
69 class LayerNode; | 68 class LayerNode; |
70 class LayerProperties; | 69 class LayerProperties; |
71 class LayerUpdate; | 70 class LayerUpdate; |
72 } // namespace proto | 71 } // namespace proto |
73 | 72 |
74 // Base class for composited layers. Special layer types are derived from | 73 // Base class for composited layers. Special layer types are derived from |
75 // this class. | 74 // this class. |
76 class CC_EXPORT Layer : public base::RefCounted<Layer> { | 75 class CC_EXPORT Layer : public base::RefCounted<Layer> { |
77 public: | 76 public: |
78 using LayerListType = LayerList; | 77 using LayerListType = LayerList; |
79 using LayerIdMap = std::unordered_map<int, scoped_refptr<Layer>>; | 78 using LayerIdMap = std::unordered_map<int, scoped_refptr<Layer>>; |
80 | 79 |
81 enum LayerIdLabels { | 80 enum LayerIdLabels { |
82 INVALID_ID = -1, | 81 INVALID_ID = -1, |
83 }; | 82 }; |
84 | 83 |
85 static scoped_refptr<Layer> Create(const LayerSettings& settings); | 84 static scoped_refptr<Layer> Create(); |
86 | 85 |
87 int id() const { return layer_id_; } | 86 int id() const { return layer_id_; } |
88 | 87 |
89 Layer* RootLayer(); | 88 Layer* RootLayer(); |
90 Layer* parent() { return parent_; } | 89 Layer* parent() { return parent_; } |
91 const Layer* parent() const { return parent_; } | 90 const Layer* parent() const { return parent_; } |
92 void AddChild(scoped_refptr<Layer> child); | 91 void AddChild(scoped_refptr<Layer> child); |
93 void InsertChild(scoped_refptr<Layer> child, size_t index); | 92 void InsertChild(scoped_refptr<Layer> child, size_t index); |
94 void ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer); | 93 void ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer); |
95 void RemoveFromParent(); | 94 void RemoveFromParent(); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 void OnOpacityAnimated(float opacity); | 526 void OnOpacityAnimated(float opacity); |
528 void OnTransformAnimated(const gfx::Transform& transform); | 527 void OnTransformAnimated(const gfx::Transform& transform); |
529 void OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset); | 528 void OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset); |
530 void OnTransformIsPotentiallyAnimatingChanged(bool is_animating); | 529 void OnTransformIsPotentiallyAnimatingChanged(bool is_animating); |
531 bool IsActive() const; | 530 bool IsActive() const; |
532 | 531 |
533 protected: | 532 protected: |
534 friend class LayerImpl; | 533 friend class LayerImpl; |
535 friend class TreeSynchronizer; | 534 friend class TreeSynchronizer; |
536 virtual ~Layer(); | 535 virtual ~Layer(); |
537 | 536 Layer(); |
538 explicit Layer(const LayerSettings& settings); | |
539 | 537 |
540 // These SetNeeds functions are in order of severity of update: | 538 // These SetNeeds functions are in order of severity of update: |
541 // | 539 // |
542 // Called when this layer has been modified in some way, but isn't sure | 540 // Called when this layer has been modified in some way, but isn't sure |
543 // that it needs a commit yet. It needs CalcDrawProperties and UpdateLayers | 541 // that it needs a commit yet. It needs CalcDrawProperties and UpdateLayers |
544 // before it knows whether or not a commit is required. | 542 // before it knows whether or not a commit is required. |
545 void SetNeedsUpdate(); | 543 void SetNeedsUpdate(); |
546 // Called when a property has been modified in a way that the layer | 544 // Called when a property has been modified in a way that the layer |
547 // knows immediately that a commit is required. This implies SetNeedsUpdate | 545 // knows immediately that a commit is required. This implies SetNeedsUpdate |
548 // as well as SetNeedsPushProperties to push that property. | 546 // as well as SetNeedsPushProperties to push that property. |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 | 736 |
739 std::vector<FrameTimingRequest> frame_timing_requests_; | 737 std::vector<FrameTimingRequest> frame_timing_requests_; |
740 bool frame_timing_requests_dirty_; | 738 bool frame_timing_requests_dirty_; |
741 | 739 |
742 DISALLOW_COPY_AND_ASSIGN(Layer); | 740 DISALLOW_COPY_AND_ASSIGN(Layer); |
743 }; | 741 }; |
744 | 742 |
745 } // namespace cc | 743 } // namespace cc |
746 | 744 |
747 #endif // CC_LAYERS_LAYER_H_ | 745 #endif // CC_LAYERS_LAYER_H_ |
OLD | NEW |