Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: cc/trees/property_tree.h

Issue 1975623002: cc : Add LayerToPropertyTreeIndices map to PropertyTrees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/property_tree.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_TREES_PROPERTY_TREE_H_ 5 #ifndef CC_TREES_PROPERTY_TREE_H_
6 #define CC_TREES_PROPERTY_TREE_H_ 6 #define CC_TREES_PROPERTY_TREE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 371
372 void set_needs_update(bool needs_update) { needs_update_ = needs_update; } 372 void set_needs_update(bool needs_update) { needs_update_ = needs_update; }
373 bool needs_update() const { return needs_update_; } 373 bool needs_update() const { return needs_update_; }
374 374
375 std::vector<T>& nodes() { return nodes_; } 375 std::vector<T>& nodes() { return nodes_; }
376 const std::vector<T>& nodes() const { return nodes_; } 376 const std::vector<T>& nodes() const { return nodes_; }
377 377
378 int next_available_id() const { return static_cast<int>(size()); } 378 int next_available_id() const { return static_cast<int>(size()); }
379 379
380 void ToProtobuf(proto::PropertyTree* proto) const; 380 void ToProtobuf(proto::PropertyTree* proto) const;
381 void FromProtobuf(const proto::PropertyTree& proto); 381 void FromProtobuf(const proto::PropertyTree& proto,
382 std::unordered_map<int, int>* node_id_to_index_map);
382 383
383 void SetPropertyTrees(PropertyTrees* property_trees) { 384 void SetPropertyTrees(PropertyTrees* property_trees) {
384 property_trees_ = property_trees; 385 property_trees_ = property_trees;
385 } 386 }
386 PropertyTrees* property_trees() const { return property_trees_; } 387 PropertyTrees* property_trees() const { return property_trees_; }
387 388
388 void AsValueInto(base::trace_event::TracedValue* value) const; 389 void AsValueInto(base::trace_event::TracedValue* value) const;
389 390
390 private: 391 private:
391 // Copy and assign are permitted. This is how we do tree sync. 392 // Copy and assign are permitted. This is how we do tree sync.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 return nodes_affected_by_inner_viewport_bounds_delta_; 499 return nodes_affected_by_inner_viewport_bounds_delta_;
499 } 500 }
500 const std::vector<int>& nodes_affected_by_outer_viewport_bounds_delta() 501 const std::vector<int>& nodes_affected_by_outer_viewport_bounds_delta()
501 const { 502 const {
502 return nodes_affected_by_outer_viewport_bounds_delta_; 503 return nodes_affected_by_outer_viewport_bounds_delta_;
503 } 504 }
504 505
505 gfx::Transform ToScreenSpaceTransformWithoutSublayerScale(int id) const; 506 gfx::Transform ToScreenSpaceTransformWithoutSublayerScale(int id) const;
506 507
507 void ToProtobuf(proto::PropertyTree* proto) const; 508 void ToProtobuf(proto::PropertyTree* proto) const;
508 void FromProtobuf(const proto::PropertyTree& proto); 509 void FromProtobuf(const proto::PropertyTree& proto,
510 std::unordered_map<int, int>* node_id_to_index_map);
509 511
510 private: 512 private:
511 // Returns true iff the node at |desc_id| is a descendant of the node at 513 // Returns true iff the node at |desc_id| is a descendant of the node at
512 // |anc_id|. 514 // |anc_id|.
513 bool IsDescendant(int desc_id, int anc_id) const; 515 bool IsDescendant(int desc_id, int anc_id) const;
514 516
515 // Computes the combined transform between |source_id| and |dest_id| and 517 // Computes the combined transform between |source_id| and |dest_id| and
516 // returns false if the inverse of a singular transform was used. These two 518 // returns false if the inverse of a singular transform was used. These two
517 // nodes must be on the same ancestor chain. 519 // nodes must be on the same ancestor chain.
518 bool CombineTransformsBetween(int source_id, 520 bool CombineTransformsBetween(int source_id,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 }; 556 };
555 557
556 class CC_EXPORT ClipTree final : public PropertyTree<ClipNode> { 558 class CC_EXPORT ClipTree final : public PropertyTree<ClipNode> {
557 public: 559 public:
558 bool operator==(const ClipTree& other) const; 560 bool operator==(const ClipTree& other) const;
559 561
560 void SetViewportClip(gfx::RectF viewport_rect); 562 void SetViewportClip(gfx::RectF viewport_rect);
561 gfx::RectF ViewportClip(); 563 gfx::RectF ViewportClip();
562 564
563 void ToProtobuf(proto::PropertyTree* proto) const; 565 void ToProtobuf(proto::PropertyTree* proto) const;
564 void FromProtobuf(const proto::PropertyTree& proto); 566 void FromProtobuf(const proto::PropertyTree& proto,
567 std::unordered_map<int, int>* node_id_to_index_map);
565 }; 568 };
566 569
567 class CC_EXPORT EffectTree final : public PropertyTree<EffectNode> { 570 class CC_EXPORT EffectTree final : public PropertyTree<EffectNode> {
568 public: 571 public:
569 bool operator==(const EffectTree& other) const; 572 bool operator==(const EffectTree& other) const;
570 573
571 float EffectiveOpacity(const EffectNode* node) const; 574 float EffectiveOpacity(const EffectNode* node) const;
572 575
573 void UpdateEffects(int id); 576 void UpdateEffects(int id);
574 577
575 void UpdateEffectChanged(EffectNode* node, EffectNode* parent_node); 578 void UpdateEffectChanged(EffectNode* node, EffectNode* parent_node);
576 579
577 void ClearCopyRequests(); 580 void ClearCopyRequests();
578 581
579 bool ContributesToDrawnSurface(int id); 582 bool ContributesToDrawnSurface(int id);
580 583
581 void ResetChangeTracking(); 584 void ResetChangeTracking();
582 585
583 void ToProtobuf(proto::PropertyTree* proto) const; 586 void ToProtobuf(proto::PropertyTree* proto) const;
584 void FromProtobuf(const proto::PropertyTree& proto); 587 void FromProtobuf(const proto::PropertyTree& proto,
588 std::unordered_map<int, int>* node_id_to_index_map);
585 589
586 private: 590 private:
587 void UpdateOpacities(EffectNode* node, EffectNode* parent_node); 591 void UpdateOpacities(EffectNode* node, EffectNode* parent_node);
588 void UpdateIsDrawn(EffectNode* node, EffectNode* parent_node); 592 void UpdateIsDrawn(EffectNode* node, EffectNode* parent_node);
589 void UpdateBackfaceVisibility(EffectNode* node, EffectNode* parent_node); 593 void UpdateBackfaceVisibility(EffectNode* node, EffectNode* parent_node);
590 }; 594 };
591 595
592 class CC_EXPORT ScrollTree final : public PropertyTree<ScrollNode> { 596 class CC_EXPORT ScrollTree final : public PropertyTree<ScrollNode> {
593 public: 597 public:
594 ScrollTree(); 598 ScrollTree();
595 ScrollTree(const ScrollTree& other); 599 ScrollTree(const ScrollTree& other);
596 ~ScrollTree(); 600 ~ScrollTree();
597 601
598 ScrollTree& operator=(const ScrollTree& from); 602 ScrollTree& operator=(const ScrollTree& from);
599 bool operator==(const ScrollTree& other) const; 603 bool operator==(const ScrollTree& other) const;
600 604
601 void ToProtobuf(proto::PropertyTree* proto) const; 605 void ToProtobuf(proto::PropertyTree* proto) const;
602 void FromProtobuf(const proto::PropertyTree& proto); 606 void FromProtobuf(const proto::PropertyTree& proto,
607 std::unordered_map<int, int>* node_id_to_index_map);
603 608
604 void clear(); 609 void clear();
605 610
606 typedef std::unordered_map<int, scoped_refptr<SyncedScrollOffset>> 611 typedef std::unordered_map<int, scoped_refptr<SyncedScrollOffset>>
607 ScrollOffsetMap; 612 ScrollOffsetMap;
608 613
609 gfx::ScrollOffset MaxScrollOffset(int scroll_node_id) const; 614 gfx::ScrollOffset MaxScrollOffset(int scroll_node_id) const;
610 gfx::Size scroll_clip_layer_bounds(int scroll_node_id) const; 615 gfx::Size scroll_clip_layer_bounds(int scroll_node_id) const;
611 ScrollNode* CurrentlyScrollingNode(); 616 ScrollNode* CurrentlyScrollingNode();
612 const ScrollNode* CurrentlyScrollingNode() const; 617 const ScrollNode* CurrentlyScrollingNode() const;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 PropertyTrees(); 663 PropertyTrees();
659 PropertyTrees(const PropertyTrees& other); 664 PropertyTrees(const PropertyTrees& other);
660 ~PropertyTrees(); 665 ~PropertyTrees();
661 666
662 bool operator==(const PropertyTrees& other) const; 667 bool operator==(const PropertyTrees& other) const;
663 PropertyTrees& operator=(const PropertyTrees& from); 668 PropertyTrees& operator=(const PropertyTrees& from);
664 669
665 void ToProtobuf(proto::PropertyTrees* proto) const; 670 void ToProtobuf(proto::PropertyTrees* proto) const;
666 void FromProtobuf(const proto::PropertyTrees& proto); 671 void FromProtobuf(const proto::PropertyTrees& proto);
667 672
673 std::unordered_map<int, int> transform_id_to_index_map;
674 std::unordered_map<int, int> effect_id_to_index_map;
675 std::unordered_map<int, int> clip_id_to_index_map;
676 std::unordered_map<int, int> scroll_id_to_index_map;
668 TransformTree transform_tree; 677 TransformTree transform_tree;
669 EffectTree effect_tree; 678 EffectTree effect_tree;
670 ClipTree clip_tree; 679 ClipTree clip_tree;
671 ScrollTree scroll_tree; 680 ScrollTree scroll_tree;
672 bool needs_rebuild; 681 bool needs_rebuild;
673 bool non_root_surfaces_enabled; 682 bool non_root_surfaces_enabled;
674 // Change tracking done on property trees needs to be preserved across commits 683 // Change tracking done on property trees needs to be preserved across commits
675 // (when they are not rebuild). We cache a global bool which stores whether 684 // (when they are not rebuild). We cache a global bool which stores whether
676 // we did any change tracking so that we can skip copying the change status 685 // we did any change tracking so that we can skip copying the change status
677 // between property trees when this bool is false. 686 // between property trees when this bool is false.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 719
711 private: 720 private:
712 gfx::Vector2dF inner_viewport_container_bounds_delta_; 721 gfx::Vector2dF inner_viewport_container_bounds_delta_;
713 gfx::Vector2dF outer_viewport_container_bounds_delta_; 722 gfx::Vector2dF outer_viewport_container_bounds_delta_;
714 gfx::Vector2dF inner_viewport_scroll_bounds_delta_; 723 gfx::Vector2dF inner_viewport_scroll_bounds_delta_;
715 }; 724 };
716 725
717 } // namespace cc 726 } // namespace cc
718 727
719 #endif // CC_TREES_PROPERTY_TREE_H_ 728 #endif // CC_TREES_PROPERTY_TREE_H_
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/property_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698