| 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 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 | 384 |
| 384 // Read all property values from the given LayerProperties object and update | 385 // Read all property values from the given LayerProperties object and update |
| 385 // the current layer. The values for |needs_push_properties_| and | 386 // the current layer. The values for |needs_push_properties_| and |
| 386 // |num_dependents_need_push_properties_| are always updated, but the rest | 387 // |num_dependents_need_push_properties_| are always updated, but the rest |
| 387 // of |proto| is only read if |needs_push_properties_| is set. | 388 // of |proto| is only read if |needs_push_properties_| is set. |
| 388 void FromLayerPropertiesProto(const proto::LayerProperties& proto); | 389 void FromLayerPropertiesProto(const proto::LayerProperties& proto); |
| 389 | 390 |
| 390 LayerTreeHost* GetLayerTreeHostForTesting() const { return layer_tree_host_; } | 391 LayerTreeHost* GetLayerTreeHostForTesting() const { return layer_tree_host_; } |
| 391 LayerTree* GetLayerTree() const; | 392 LayerTree* GetLayerTree() const; |
| 392 | 393 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 AnimationHost* GetAnimationHost() const; | 487 AnimationHost* GetAnimationHost() const; |
| 487 | 488 |
| 488 ElementListType GetElementTypeForAnimation() const; | 489 ElementListType GetElementTypeForAnimation() const; |
| 489 | 490 |
| 490 protected: | 491 protected: |
| 491 friend class LayerImpl; | 492 friend class LayerImpl; |
| 492 friend class TreeSynchronizer; | 493 friend class TreeSynchronizer; |
| 493 virtual ~Layer(); | 494 virtual ~Layer(); |
| 494 Layer(); | 495 Layer(); |
| 495 | 496 |
| 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. |
| 499 explicit Layer(int layer_id); |
| 500 |
| 496 LayerTreeHost* layer_tree_host() { return layer_tree_host_; } | 501 LayerTreeHost* layer_tree_host() { return layer_tree_host_; } |
| 497 const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; } | 502 const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; } |
| 498 | 503 |
| 499 // These SetNeeds functions are in order of severity of update: | 504 // These SetNeeds functions are in order of severity of update: |
| 500 // | 505 // |
| 501 // 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 |
| 502 // that it needs a commit yet. It needs CalcDrawProperties and UpdateLayers | 507 // that it needs a commit yet. It needs CalcDrawProperties and UpdateLayers |
| 503 // before it knows whether or not a commit is required. | 508 // before it knows whether or not a commit is required. |
| 504 void SetNeedsUpdate(); | 509 void SetNeedsUpdate(); |
| 505 // Called when a property has been modified in a way that the layer | 510 // Called when a property has been modified in a way that the layer |
| (...skipping 19 matching lines...) Expand all Loading... |
| 525 | 530 |
| 526 // Called when the layer's number of drawable descendants changes. | 531 // Called when the layer's number of drawable descendants changes. |
| 527 void AddDrawableDescendants(int num); | 532 void AddDrawableDescendants(int num); |
| 528 | 533 |
| 529 bool IsPropertyChangeAllowed() const; | 534 bool IsPropertyChangeAllowed() const; |
| 530 | 535 |
| 531 // Serialize all the necessary properties to be able to reconstruct this Layer | 536 // Serialize all the necessary properties to be able to reconstruct this Layer |
| 532 // into proto::LayerProperties. This method is not marked as const | 537 // into proto::LayerProperties. This method is not marked as const |
| 533 // as some implementations need reset member fields, similarly to | 538 // as some implementations need reset member fields, similarly to |
| 534 // PushPropertiesTo(). | 539 // PushPropertiesTo(). |
| 535 virtual void LayerSpecificPropertiesToProto(proto::LayerProperties* proto); | 540 virtual void LayerSpecificPropertiesToProto(proto::LayerProperties* proto, |
| 541 bool inputs_only); |
| 536 | 542 |
| 537 // Deserialize all the necessary properties from proto::LayerProperties into | 543 // Deserialize all the necessary properties from proto::LayerProperties into |
| 538 // this Layer. | 544 // this Layer. |
| 539 virtual void FromLayerSpecificPropertiesProto( | 545 virtual void FromLayerSpecificPropertiesProto( |
| 540 const proto::LayerProperties& proto); | 546 const proto::LayerProperties& proto); |
| 541 | 547 |
| 542 gfx::Rect& update_rect() { return inputs_.update_rect; } | 548 gfx::Rect& update_rect() { return inputs_.update_rect; } |
| 543 | 549 |
| 544 // When true, the layer is about to perform an update. Any commit requests | 550 // When true, the layer is about to perform an update. Any commit requests |
| 545 // will be handled implicitly after the update completes. | 551 // will be handled implicitly after the update completes. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 | 599 |
| 594 // When we detach or attach layer to new LayerTreeHost, all property trees' | 600 // When we detach or attach layer to new LayerTreeHost, all property trees' |
| 595 // indices becomes invalid. | 601 // indices becomes invalid. |
| 596 void InvalidatePropertyTreesIndices(); | 602 void InvalidatePropertyTreesIndices(); |
| 597 | 603 |
| 598 // Encapsulates all data, callbacks or interfaces received from the embedder. | 604 // Encapsulates all data, callbacks or interfaces received from the embedder. |
| 599 // TODO(khushalsagar): This is only valid when PropertyTrees are built | 605 // TODO(khushalsagar): This is only valid when PropertyTrees are built |
| 600 // internally in cc. Update this for the SPv2 path where blink generates | 606 // internally in cc. Update this for the SPv2 path where blink generates |
| 601 // PropertyTrees. | 607 // PropertyTrees. |
| 602 struct Inputs { | 608 struct Inputs { |
| 603 Inputs(); | 609 explicit Inputs(int layer_id); |
| 604 ~Inputs(); | 610 ~Inputs(); |
| 605 | 611 |
| 606 int layer_id; | 612 int layer_id; |
| 607 | 613 |
| 608 LayerList children; | 614 LayerList children; |
| 609 | 615 |
| 610 // The update rect is the region of the compositor resource that was | 616 // The update rect is the region of the compositor resource that was |
| 611 // actually updated by the compositor. For layers that may do updating | 617 // actually updated by the compositor. For layers that may do updating |
| 612 // outside the compositor's control (i.e. plugin layers), this information | 618 // outside the compositor's control (i.e. plugin layers), this information |
| 613 // is not available and the update rect will remain empty. | 619 // is not available and the update rect will remain empty. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 // These all act like draw properties, so don't need push properties. | 727 // These all act like draw properties, so don't need push properties. |
| 722 gfx::Rect visible_layer_rect_; | 728 gfx::Rect visible_layer_rect_; |
| 723 size_t num_unclipped_descendants_; | 729 size_t num_unclipped_descendants_; |
| 724 | 730 |
| 725 DISALLOW_COPY_AND_ASSIGN(Layer); | 731 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 726 }; | 732 }; |
| 727 | 733 |
| 728 } // namespace cc | 734 } // namespace cc |
| 729 | 735 |
| 730 #endif // CC_LAYERS_LAYER_H_ | 736 #endif // CC_LAYERS_LAYER_H_ |
| OLD | NEW |