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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 class LayerTreeImpl; | 62 class LayerTreeImpl; |
63 class LayerTreeSettings; | 63 class LayerTreeSettings; |
64 class RenderingStatsInstrumentation; | 64 class RenderingStatsInstrumentation; |
65 class ResourceUpdateQueue; | 65 class ResourceUpdateQueue; |
66 class ScrollbarLayerInterface; | 66 class ScrollbarLayerInterface; |
67 class SimpleEnclosedRegion; | 67 class SimpleEnclosedRegion; |
68 struct AnimationEvent; | 68 struct AnimationEvent; |
69 | 69 |
70 namespace proto { | 70 namespace proto { |
71 class LayerNode; | 71 class LayerNode; |
72 class LayerProperties; | |
73 class LayerUpdate; | |
72 } // namespace proto | 74 } // namespace proto |
73 | 75 |
74 // Base class for composited layers. Special layer types are derived from | 76 // Base class for composited layers. Special layer types are derived from |
75 // this class. | 77 // this class. |
76 class CC_EXPORT Layer : public base::RefCounted<Layer>, | 78 class CC_EXPORT Layer : public base::RefCounted<Layer>, |
77 public LayerAnimationValueObserver, | 79 public LayerAnimationValueObserver, |
78 public LayerAnimationValueProvider { | 80 public LayerAnimationValueProvider { |
79 public: | 81 public: |
80 typedef LayerList LayerListType; | 82 typedef LayerList LayerListType; |
81 typedef base::hash_map<int, scoped_refptr<Layer>> LayerIdMap; | 83 typedef base::hash_map<int, scoped_refptr<Layer>> LayerIdMap; |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 // construction of the correct layer on the client. | 382 // construction of the correct layer on the client. |
381 void ToLayerNodeProto(proto::LayerNode* proto) const; | 383 void ToLayerNodeProto(proto::LayerNode* proto) const; |
382 | 384 |
383 // Recursively iterate over the given LayerNode proto and read the structure | 385 // Recursively iterate over the given LayerNode proto and read the structure |
384 // into this node and its children. The |layer_map| should be used to look | 386 // into this node and its children. The |layer_map| should be used to look |
385 // for previously existing Layers, since they should be re-used between each | 387 // for previously existing Layers, since they should be re-used between each |
386 // hierarchy update. | 388 // hierarchy update. |
387 void FromLayerNodeProto(const proto::LayerNode& proto, | 389 void FromLayerNodeProto(const proto::LayerNode& proto, |
388 const LayerIdMap& layer_map); | 390 const LayerIdMap& layer_map); |
389 | 391 |
392 // Recursively iterate over this layer and all children to find layers with | |
393 // changed properties. Layers that have changed properties and layers that | |
394 // contain children that have changed properties are added to the | |
395 // proto::LayerUpdate. Only layers with changed properties will contain | |
396 // properties in the resulting proto::LayerProperties proto. This method also | |
397 // resets |needs_push_properties_| and |num_dependents_need_push_properties_|. | |
398 void ToLayerPropertiesProto(proto::LayerUpdate* layer_update); | |
399 | |
400 // Read all property values from the given LayerProperties object and update | |
401 // the current layer. The values for |needs_push_properties_| and | |
402 // |num_dependents_need_push_properties_| are always updated, but the rest | |
403 // of |proto| is only read if |needs_push_properties_| is set. | |
404 void FromLayerPropertiesProto(const proto::LayerProperties& proto); | |
405 | |
390 LayerTreeHost* layer_tree_host() { return layer_tree_host_; } | 406 LayerTreeHost* layer_tree_host() { return layer_tree_host_; } |
391 const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; } | 407 const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; } |
392 | 408 |
393 bool AddAnimation(scoped_ptr<Animation> animation); | 409 bool AddAnimation(scoped_ptr<Animation> animation); |
394 void PauseAnimation(int animation_id, double time_offset); | 410 void PauseAnimation(int animation_id, double time_offset); |
395 void RemoveAnimation(int animation_id); | 411 void RemoveAnimation(int animation_id); |
396 void RemoveAnimation(int animation_id, Animation::TargetProperty property); | 412 void RemoveAnimation(int animation_id, Animation::TargetProperty property); |
397 LayerAnimationController* layer_animation_controller() const { | 413 LayerAnimationController* layer_animation_controller() const { |
398 return layer_animation_controller_.get(); | 414 return layer_animation_controller_.get(); |
399 } | 415 } |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
582 void AddDrawableDescendants(int num); | 598 void AddDrawableDescendants(int num); |
583 | 599 |
584 void AddDependentNeedsPushProperties(); | 600 void AddDependentNeedsPushProperties(); |
585 void RemoveDependentNeedsPushProperties(); | 601 void RemoveDependentNeedsPushProperties(); |
586 bool parent_should_know_need_push_properties() const { | 602 bool parent_should_know_need_push_properties() const { |
587 return needs_push_properties() || descendant_needs_push_properties(); | 603 return needs_push_properties() || descendant_needs_push_properties(); |
588 } | 604 } |
589 | 605 |
590 bool IsPropertyChangeAllowed() const; | 606 bool IsPropertyChangeAllowed() const; |
591 | 607 |
608 // Serialize all the necessary properties to be able to reconstruct this Layer | |
609 // into proto::LayerProperties. This function must not set values for | |
610 // |needs_push_properties_| or |num_dependents_need_push_properties_| as they | |
611 // are dealt with at a higher level. This is only called if | |
612 // |needs_push_properties_| is set. For descendants of Layer, implementations | |
613 // must first call their parent class. | |
614 virtual void LayerSpecificPropertiesToProto(proto::LayerProperties* proto); | |
615 | |
616 // Deerialize all the necessary properties from proto::LayerProperties into | |
David Trainor- moved to gerrit
2015/11/11 15:34:22
Deerialize -> Deserialize
nyquist
2015/11/11 18:31:57
Done.
| |
617 // this Layer. This function must not set values for |needs_push_properties_| | |
618 // or |num_dependents_need_push_properties_| as they are dealt with at a | |
619 // higher level. This is only called if |needs_push_properties_| is set. For | |
620 // descendants of Layer, implementations must first call their parent class. | |
621 virtual void FromLayerSpecificPropertiesProto( | |
622 const proto::LayerProperties& proto); | |
623 | |
592 // This flag is set when the layer needs to push properties to the impl | 624 // This flag is set when the layer needs to push properties to the impl |
593 // side. | 625 // side. |
594 bool needs_push_properties_; | 626 bool needs_push_properties_; |
595 | 627 |
596 // The number of direct children or dependent layers that need to be recursed | 628 // The number of direct children or dependent layers that need to be recursed |
597 // to in order for them or a descendent of them to push properties to the impl | 629 // to in order for them or a descendent of them to push properties to the impl |
598 // side. | 630 // side. |
599 int num_dependents_need_push_properties_; | 631 int num_dependents_need_push_properties_; |
600 | 632 |
601 // Tracks whether this layer may have changed stacking order with its | 633 // Tracks whether this layer may have changed stacking order with its |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
742 | 774 |
743 std::vector<FrameTimingRequest> frame_timing_requests_; | 775 std::vector<FrameTimingRequest> frame_timing_requests_; |
744 bool frame_timing_requests_dirty_; | 776 bool frame_timing_requests_dirty_; |
745 | 777 |
746 DISALLOW_COPY_AND_ASSIGN(Layer); | 778 DISALLOW_COPY_AND_ASSIGN(Layer); |
747 }; | 779 }; |
748 | 780 |
749 } // namespace cc | 781 } // namespace cc |
750 | 782 |
751 #endif // CC_LAYERS_LAYER_H_ | 783 #endif // CC_LAYERS_LAYER_H_ |
OLD | NEW |