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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 return should_flatten_transform_from_property_tree_; | 397 return should_flatten_transform_from_property_tree_; |
| 398 } | 398 } |
| 399 | 399 |
| 400 const gfx::Rect& visible_layer_rect_for_testing() const { | 400 const gfx::Rect& visible_layer_rect_for_testing() const { |
| 401 return visible_layer_rect_; | 401 return visible_layer_rect_; |
| 402 } | 402 } |
| 403 void set_visible_layer_rect(const gfx::Rect& rect) { | 403 void set_visible_layer_rect(const gfx::Rect& rect) { |
| 404 visible_layer_rect_ = rect; | 404 visible_layer_rect_ = rect; |
| 405 } | 405 } |
| 406 | 406 |
| 407 // This is for tracking damage. | |
| 407 void SetSubtreePropertyChanged(); | 408 void SetSubtreePropertyChanged(); |
| 408 bool subtree_property_changed() const { return subtree_property_changed_; } | 409 bool subtree_property_changed() const { return subtree_property_changed_; } |
| 409 | 410 |
| 410 void SetMayContainVideo(bool yes); | 411 void SetMayContainVideo(bool yes); |
| 411 | 412 |
| 412 int num_copy_requests_in_target_subtree(); | 413 int num_copy_requests_in_target_subtree(); |
| 413 | 414 |
| 414 void SetElementId(ElementId id); | 415 void SetElementId(ElementId id); |
| 415 ElementId element_id() const { return inputs_.element_id; } | 416 ElementId element_id() const { return inputs_.element_id; } |
| 416 | 417 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 437 return inputs_.preferred_raster_bounds; | 438 return inputs_.preferred_raster_bounds; |
| 438 } | 439 } |
| 439 void ClearPreferredRasterBounds(); | 440 void ClearPreferredRasterBounds(); |
| 440 | 441 |
| 441 MutatorHost* GetMutatorHost() const; | 442 MutatorHost* GetMutatorHost() const; |
| 442 | 443 |
| 443 ElementListType GetElementTypeForAnimation() const; | 444 ElementListType GetElementTypeForAnimation() const; |
| 444 | 445 |
| 445 void SetScrollbarsHiddenFromImplSide(bool hidden); | 446 void SetScrollbarsHiddenFromImplSide(bool hidden); |
| 446 | 447 |
| 448 void set_is_scroll_clip_layer() { is_scroll_clip_layer_ = true; } | |
| 449 | |
| 447 const gfx::Rect& update_rect() const { return inputs_.update_rect; } | 450 const gfx::Rect& update_rect() const { return inputs_.update_rect; } |
| 448 | 451 |
| 449 LayerTreeHost* layer_tree_host() const { return layer_tree_host_; } | 452 LayerTreeHost* layer_tree_host() const { return layer_tree_host_; } |
| 450 | 453 |
| 451 protected: | 454 protected: |
| 452 friend class LayerImpl; | 455 friend class LayerImpl; |
| 453 friend class TreeSynchronizer; | 456 friend class TreeSynchronizer; |
| 454 virtual ~Layer(); | 457 virtual ~Layer(); |
| 455 Layer(); | 458 Layer(); |
| 456 | 459 |
| 457 // These SetNeeds functions are in order of severity of update: | 460 // These SetNeeds functions are in order of severity of update: |
| 458 // | 461 // |
| 459 // Called when a property has been modified in a way that the layer knows | 462 // Called when a property has been modified in a way that the layer knows |
| 460 // immediately that a commit is required. This implies SetNeedsPushProperties | 463 // immediately that a commit is required. This implies SetNeedsPushProperties |
| 461 // to push that property. | 464 // to push that property. |
| 462 void SetNeedsCommit(); | 465 void SetNeedsCommit(); |
| 463 // This is identical to SetNeedsCommit, but the former requests a rebuild of | 466 |
| 464 // the property trees. | |
| 465 void SetNeedsCommitNoRebuild(); | |
| 466 // Called when there's been a change in layer structure. Implies | 467 // Called when there's been a change in layer structure. Implies |
| 467 // SetNeedsCommit and property tree rebuld, but not SetNeedsPushProperties | 468 // SetNeedsCommit and property tree rebuld, but not SetNeedsPushProperties |
| 468 // (the full tree is synced over). | 469 // (the full tree is synced over). |
| 469 void SetNeedsFullTreeSync(); | 470 void SetNeedsFullTreeSync(); |
| 470 | 471 |
| 471 // Called when the next commit should wait until the pending tree is activated | 472 // Called when the next commit should wait until the pending tree is activated |
| 472 // before finishing the commit and unblocking the main thread. Used to ensure | 473 // before finishing the commit and unblocking the main thread. Used to ensure |
| 473 // unused resources on the impl thread are returned before commit completes. | 474 // unused resources on the impl thread are returned before commit completes. |
| 474 void SetNextCommitWaitsForActivation(); | 475 void SetNextCommitWaitsForActivation(); |
| 475 | 476 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 525 void RemoveFromScrollTree(); | 526 void RemoveFromScrollTree(); |
| 526 | 527 |
| 527 // If this layer has a clip parent, it removes |this| from its list of clip | 528 // If this layer has a clip parent, it removes |this| from its list of clip |
| 528 // children. | 529 // children. |
| 529 void RemoveFromClipTree(); | 530 void RemoveFromClipTree(); |
| 530 | 531 |
| 531 // When we detach or attach layer to new LayerTreeHost, all property trees' | 532 // When we detach or attach layer to new LayerTreeHost, all property trees' |
| 532 // indices becomes invalid. | 533 // indices becomes invalid. |
| 533 void InvalidatePropertyTreesIndices(); | 534 void InvalidatePropertyTreesIndices(); |
| 534 | 535 |
| 536 // This is set whenever a property changed on layer that affects whether this | |
| 537 // layer should own a property tree node or not. | |
| 538 void PropertyTreesNeedRebuild(); | |
|
danakj
2017/03/17 14:26:51
This function needs a verb at the front of it. "Do
weiliangc
2017/03/17 20:58:42
Done with Set.
| |
| 539 | |
| 535 // Encapsulates all data, callbacks or interfaces received from the embedder. | 540 // Encapsulates all data, callbacks or interfaces received from the embedder. |
| 536 // TODO(khushalsagar): This is only valid when PropertyTrees are built | 541 // TODO(khushalsagar): This is only valid when PropertyTrees are built |
| 537 // internally in cc. Update this for the SPv2 path where blink generates | 542 // internally in cc. Update this for the SPv2 path where blink generates |
| 538 // PropertyTrees. | 543 // PropertyTrees. |
| 539 struct Inputs { | 544 struct Inputs { |
| 540 explicit Inputs(int layer_id); | 545 explicit Inputs(int layer_id); |
| 541 ~Inputs(); | 546 ~Inputs(); |
| 542 | 547 |
| 543 int layer_id; | 548 int layer_id; |
| 544 | 549 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 640 int scroll_tree_index_; | 645 int scroll_tree_index_; |
| 641 int property_tree_sequence_number_; | 646 int property_tree_sequence_number_; |
| 642 gfx::Vector2dF offset_to_transform_parent_; | 647 gfx::Vector2dF offset_to_transform_parent_; |
| 643 bool should_flatten_transform_from_property_tree_ : 1; | 648 bool should_flatten_transform_from_property_tree_ : 1; |
| 644 bool draws_content_ : 1; | 649 bool draws_content_ : 1; |
| 645 bool use_local_transform_for_backface_visibility_ : 1; | 650 bool use_local_transform_for_backface_visibility_ : 1; |
| 646 bool should_check_backface_visibility_ : 1; | 651 bool should_check_backface_visibility_ : 1; |
| 647 bool force_render_surface_for_testing_ : 1; | 652 bool force_render_surface_for_testing_ : 1; |
| 648 bool subtree_property_changed_ : 1; | 653 bool subtree_property_changed_ : 1; |
| 649 bool may_contain_video_ : 1; | 654 bool may_contain_video_ : 1; |
| 655 bool is_scroll_clip_layer_ : 1; | |
| 650 SkColor safe_opaque_background_color_; | 656 SkColor safe_opaque_background_color_; |
| 651 // draw_blend_mode may be different than blend_mode_, | 657 // draw_blend_mode may be different than blend_mode_, |
| 652 // when a RenderSurface re-parents the layer's blend_mode. | 658 // when a RenderSurface re-parents the layer's blend_mode. |
| 653 SkBlendMode draw_blend_mode_; | 659 SkBlendMode draw_blend_mode_; |
| 654 std::unique_ptr<std::set<Layer*>> scroll_children_; | 660 std::unique_ptr<std::set<Layer*>> scroll_children_; |
| 655 | 661 |
| 656 std::unique_ptr<std::set<Layer*>> clip_children_; | 662 std::unique_ptr<std::set<Layer*>> clip_children_; |
| 657 | 663 |
| 658 PaintProperties paint_properties_; | 664 PaintProperties paint_properties_; |
| 659 | 665 |
| 660 // These all act like draw properties, so don't need push properties. | 666 // These all act like draw properties, so don't need push properties. |
| 661 gfx::Rect visible_layer_rect_; | 667 gfx::Rect visible_layer_rect_; |
| 662 size_t num_unclipped_descendants_; | 668 size_t num_unclipped_descendants_; |
| 663 | 669 |
| 664 DISALLOW_COPY_AND_ASSIGN(Layer); | 670 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 665 }; | 671 }; |
| 666 | 672 |
| 667 } // namespace cc | 673 } // namespace cc |
| 668 | 674 |
| 669 #endif // CC_LAYERS_LAYER_H_ | 675 #endif // CC_LAYERS_LAYER_H_ |
| OLD | NEW |