OLD | NEW |
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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 | 500 |
501 const SyncedScrollOffset* GetSyncedScrollOffset(int layer_id) const; | 501 const SyncedScrollOffset* GetSyncedScrollOffset(int layer_id) const; |
502 | 502 |
503 #if DCHECK_IS_ON() | 503 #if DCHECK_IS_ON() |
504 void CopyCompleteTreeState(const ScrollTree& other); | 504 void CopyCompleteTreeState(const ScrollTree& other); |
505 #endif | 505 #endif |
506 | 506 |
507 ScrollNode* FindNodeFromElementId(ElementId id); | 507 ScrollNode* FindNodeFromElementId(ElementId id); |
508 | 508 |
509 private: | 509 private: |
510 using ScrollOffsetMap = std::unordered_map<int, gfx::ScrollOffset>; | 510 using ScrollOffsetMap = base::flat_map<int, gfx::ScrollOffset>; |
511 using SyncedScrollOffsetMap = | 511 using SyncedScrollOffsetMap = |
512 std::unordered_map<int, scoped_refptr<SyncedScrollOffset>>; | 512 base::flat_map<int, scoped_refptr<SyncedScrollOffset>>; |
513 | 513 |
514 int currently_scrolling_node_id_; | 514 int currently_scrolling_node_id_; |
515 | 515 |
516 // On the main thread we store the scroll offsets directly since the main | 516 // On the main thread we store the scroll offsets directly since the main |
517 // thread only needs to keep track of the current main thread state. The impl | 517 // thread only needs to keep track of the current main thread state. The impl |
518 // thread stores a map of SyncedProperty instances in order to track | 518 // thread stores a map of SyncedProperty instances in order to track |
519 // additional state necessary to synchronize scroll changes between the main | 519 // additional state necessary to synchronize scroll changes between the main |
520 // and impl threads. | 520 // and impl threads. |
521 ScrollOffsetMap layer_id_to_scroll_offset_map_; | 521 ScrollOffsetMap layer_id_to_scroll_offset_map_; |
522 SyncedScrollOffsetMap layer_id_to_synced_scroll_offset_map_; | 522 SyncedScrollOffsetMap layer_id_to_synced_scroll_offset_map_; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 | 639 |
640 bool operator==(const PropertyTrees& other) const; | 640 bool operator==(const PropertyTrees& other) const; |
641 PropertyTrees& operator=(const PropertyTrees& from); | 641 PropertyTrees& operator=(const PropertyTrees& from); |
642 | 642 |
643 // These maps allow mapping directly from a compositor element id to the | 643 // These maps allow mapping directly from a compositor element id to the |
644 // respective property node. This will eventually allow simplifying logic in | 644 // respective property node. This will eventually allow simplifying logic in |
645 // various places that today has to map from element id to layer id, and then | 645 // various places that today has to map from element id to layer id, and then |
646 // from layer id to the respective property node. Completing that work is | 646 // from layer id to the respective property node. Completing that work is |
647 // pending the launch of Slimming Paint v2 and reworking UI compositor logic | 647 // pending the launch of Slimming Paint v2 and reworking UI compositor logic |
648 // to produce cc property trees and these maps. | 648 // to produce cc property trees and these maps. |
649 std::unordered_map<ElementId, int, ElementIdHash> | 649 base::flat_map<ElementId, int> element_id_to_effect_node_index; |
650 element_id_to_effect_node_index; | 650 base::flat_map<ElementId, int> element_id_to_scroll_node_index; |
651 std::unordered_map<ElementId, int, ElementIdHash> | 651 base::flat_map<ElementId, int> element_id_to_transform_node_index; |
652 element_id_to_scroll_node_index; | |
653 std::unordered_map<ElementId, int, ElementIdHash> | |
654 element_id_to_transform_node_index; | |
655 | 652 |
656 std::vector<int> always_use_active_tree_opacity_effect_ids; | 653 std::vector<int> always_use_active_tree_opacity_effect_ids; |
657 TransformTree transform_tree; | 654 TransformTree transform_tree; |
658 EffectTree effect_tree; | 655 EffectTree effect_tree; |
659 ClipTree clip_tree; | 656 ClipTree clip_tree; |
660 ScrollTree scroll_tree; | 657 ScrollTree scroll_tree; |
661 bool needs_rebuild; | 658 bool needs_rebuild; |
662 bool non_root_surfaces_enabled; | 659 bool non_root_surfaces_enabled; |
663 bool can_adjust_raster_scales; | 660 bool can_adjust_raster_scales; |
664 // Change tracking done on property trees needs to be preserved across commits | 661 // Change tracking done on property trees needs to be preserved across commits |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const; | 728 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const; |
732 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id, | 729 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id, |
733 int effect_id) const; | 730 int effect_id) const; |
734 | 731 |
735 PropertyTreesCachedData cached_data_; | 732 PropertyTreesCachedData cached_data_; |
736 }; | 733 }; |
737 | 734 |
738 } // namespace cc | 735 } // namespace cc |
739 | 736 |
740 #endif // CC_TREES_PROPERTY_TREE_H_ | 737 #endif // CC_TREES_PROPERTY_TREE_H_ |
OLD | NEW |