Chromium Code Reviews| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 // since that is an enum (the protobuf library does not generate enum | 351 // since that is an enum (the protobuf library does not generate enum |
| 352 // classes), it can't be forward declared. We don't want to include | 352 // classes), it can't be forward declared. We don't want to include |
| 353 // //cc/proto/layer.pb.h in this header file, as it requires that all | 353 // //cc/proto/layer.pb.h in this header file, as it requires that all |
| 354 // dependent targets would have to be given the config for how to include it. | 354 // dependent targets would have to be given the config for how to include it. |
| 355 virtual void SetTypeForProtoSerialization(proto::LayerNode* proto) const; | 355 virtual void SetTypeForProtoSerialization(proto::LayerNode* proto) const; |
| 356 | 356 |
| 357 // Recursively iterate over this layer and all children and write the | 357 // Recursively iterate over this layer and all children and write the |
| 358 // hierarchical structure to the given LayerNode proto. In addition to the | 358 // hierarchical structure to the given LayerNode proto. In addition to the |
| 359 // structure itself, the Layer id and type is also written to facilitate | 359 // structure itself, the Layer id and type is also written to facilitate |
| 360 // construction of the correct layer on the client. | 360 // construction of the correct layer on the client. |
| 361 void ToLayerNodeProto(proto::LayerNode* proto) const; | 361 virtual void ToLayerNodeProto(proto::LayerNode* proto) const; |
| 362 | 362 |
| 363 // Recursively iterate over this layer and all children and reset the | 363 // Recursively iterate over this layer and all children and reset the |
| 364 // properties sent with the hierarchical structure in the LayerNode protos. | 364 // properties sent with the hierarchical structure in the LayerNode protos. |
| 365 // This must be done before deserializing the new LayerTree from the Layernode | 365 // This must be done before deserializing the new LayerTree from the Layernode |
| 366 // protos. | 366 // protos. |
| 367 void ClearLayerTreePropertiesForDeserializationAndAddToMap( | 367 void ClearLayerTreePropertiesForDeserializationAndAddToMap( |
| 368 LayerIdMap* layer_map); | 368 LayerIdMap* layer_map); |
| 369 | 369 |
| 370 // Recursively iterate over the given LayerNode proto and read the structure | 370 // Recursively iterate over the given LayerNode proto and read the structure |
| 371 // into this node and its children. The |layer_map| should be used to look | 371 // into this node and its children. The |layer_map| should be used to look |
| 372 // for previously existing Layers, since they should be re-used between each | 372 // for previously existing Layers, since they should be re-used between each |
| 373 // hierarchy update. | 373 // hierarchy update. |
| 374 void FromLayerNodeProto(const proto::LayerNode& proto, | 374 virtual void FromLayerNodeProto(const proto::LayerNode& proto, |
| 375 const LayerIdMap& layer_map, | 375 const LayerIdMap& layer_map, |
| 376 LayerTreeHost* layer_tree_host); | 376 LayerTreeHost* layer_tree_host); |
| 377 | 377 |
| 378 // This method is similar to PushPropertiesTo, but instead of pushing to | 378 // This method is similar to PushPropertiesTo, but instead of pushing to |
| 379 // a LayerImpl, it pushes the properties to proto::LayerProperties. It is | 379 // a LayerImpl, it pushes the properties to proto::LayerProperties. It is |
| 380 // called only on layers that have changed properties. The properties | 380 // called only on layers that have changed properties. The properties |
| 381 // themselves are pushed to proto::LayerProperties. | 381 // themselves are pushed to proto::LayerProperties. |
| 382 void ToLayerPropertiesProto(proto::LayerUpdate* layer_update, | 382 void ToLayerPropertiesProto(proto::LayerUpdate* layer_update, |
| 383 bool inputs_only); | 383 bool inputs_only); |
| 384 | 384 |
| 385 // Read all property values from the given LayerProperties object and update | 385 // Read all property values from the given LayerProperties object and update |
| 386 // the current layer. The values for |needs_push_properties_| and | 386 // the current layer. The values for |needs_push_properties_| and |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 ElementListType GetElementTypeForAnimation() const; | 489 ElementListType GetElementTypeForAnimation() const; |
| 490 | 490 |
| 491 protected: | 491 protected: |
| 492 friend class LayerImpl; | 492 friend class LayerImpl; |
| 493 friend class TreeSynchronizer; | 493 friend class TreeSynchronizer; |
| 494 virtual ~Layer(); | 494 virtual ~Layer(); |
| 495 Layer(); | 495 Layer(); |
| 496 | 496 |
| 497 // Tests in remote mode need to explicitly set the layer id so it matches the | 497 // Tests in remote mode need to explicitly set the layer id so it matches the |
| 498 // layer id for the corresponding Layer on the engine. | 498 // layer id for the corresponding Layer on the engine. |
| 499 explicit Layer(int layer_id); | 499 explicit Layer(int layer_id); |
|
vmpstr
2016/10/07 23:50:05
I'd rather this be something like layer->SetLayerF
Khushal
2016/10/08 00:41:32
That's actually much better and simplifies things
| |
| 500 | 500 |
| 501 LayerTreeHost* layer_tree_host() { return layer_tree_host_; } | 501 LayerTreeHost* layer_tree_host() { return layer_tree_host_; } |
| 502 const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; } | 502 const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; } |
| 503 | 503 |
| 504 // These SetNeeds functions are in order of severity of update: | 504 // These SetNeeds functions are in order of severity of update: |
| 505 // | 505 // |
| 506 // Called when this layer has been modified in some way, but isn't sure | 506 // Called when this layer has been modified in some way, but isn't sure |
| 507 // that it needs a commit yet. It needs CalcDrawProperties and UpdateLayers | 507 // that it needs a commit yet. It needs CalcDrawProperties and UpdateLayers |
| 508 // before it knows whether or not a commit is required. | 508 // before it knows whether or not a commit is required. |
| 509 void SetNeedsUpdate(); | 509 void SetNeedsUpdate(); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 724 // These all act like draw properties, so don't need push properties. | 724 // These all act like draw properties, so don't need push properties. |
| 725 gfx::Rect visible_layer_rect_; | 725 gfx::Rect visible_layer_rect_; |
| 726 size_t num_unclipped_descendants_; | 726 size_t num_unclipped_descendants_; |
| 727 | 727 |
| 728 DISALLOW_COPY_AND_ASSIGN(Layer); | 728 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 729 }; | 729 }; |
| 730 | 730 |
| 731 } // namespace cc | 731 } // namespace cc |
| 732 | 732 |
| 733 #endif // CC_LAYERS_LAYER_H_ | 733 #endif // CC_LAYERS_LAYER_H_ |
| OLD | NEW |