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

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

Issue 2894673008: Refactor scrollbar maps from multimap & std::set to simpler flat_{map, set} (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_LAYER_TREE_IMPL_H_ 5 #ifndef CC_TREES_LAYER_TREE_IMPL_H_
6 #define CC_TREES_LAYER_TREE_IMPL_H_ 6 #define CC_TREES_LAYER_TREE_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 std::unordered_map<ElementId, gfx::Transform, ElementIdHash> 571 std::unordered_map<ElementId, gfx::Transform, ElementIdHash>
572 element_id_to_transform_animations_; 572 element_id_to_transform_animations_;
573 std::unordered_map<ElementId, FilterOperations, ElementIdHash> 573 std::unordered_map<ElementId, FilterOperations, ElementIdHash>
574 element_id_to_filter_animations_; 574 element_id_to_filter_animations_;
575 575
576 // Maps from clip layer ids to scroll layer ids. Note that this only includes 576 // Maps from clip layer ids to scroll layer ids. Note that this only includes
577 // the subset of clip layers that act as scrolling containers. (This is 577 // the subset of clip layers that act as scrolling containers. (This is
578 // derived from LayerImpl::scroll_clip_layer_ and exists to avoid O(n) walks.) 578 // derived from LayerImpl::scroll_clip_layer_ and exists to avoid O(n) walks.)
579 std::unordered_map<int, int> clip_scroll_map_; 579 std::unordered_map<int, int> clip_scroll_map_;
580 580
581 // Maps scroll element ids to scrollbar layer ids. For each scroll layer, 581 struct ScrollbarLayerIds {
582 // there may be 1 or 2 scrollbar layers (for vertical and horizontal). (This 582 int horizontal = Layer::INVALID_ID;
583 // is derived from ScrollbarLayerImplBase::scroll_element_id_ and exists to 583 int vertical = Layer::INVALID_ID;
584 // avoid O(n) walks.) 584 };
585 // TODO(pdr): Refactor this to be more efficient--likely a map where the value 585 // Each scroll layer can have up to two scrollbar layers (vertical and
586 // is a pair of scrollbar layer ids instead of using a multimap. 586 // horizontal). This mapping is derived from ScrollbarLayerImplBase's
wkorman 2017/05/20 01:46:29 Suggest removing "This mapping..." since code/clas
pdr. 2017/05/22 16:20:40 Done
587 std::multimap<ElementId, int> element_id_to_scrollbar_layer_ids_; 587 // scroll_element_id_ and updated in RegisterScrollbar/UnregisterScrollbar.
588 base::flat_map<ElementId, ScrollbarLayerIds>
589 element_id_to_scrollbar_layer_ids_;
588 590
589 std::vector<PictureLayerImpl*> picture_layers_; 591 std::vector<PictureLayerImpl*> picture_layers_;
590 LayerImplList surface_layers_; 592 LayerImplList surface_layers_;
591 593
592 // List of render surfaces for the most recently prepared frame. 594 // List of render surfaces for the most recently prepared frame.
593 RenderSurfaceList render_surface_list_; 595 RenderSurfaceList render_surface_list_;
594 // After drawing the |render_surface_list_| the areas in this region 596 // After drawing the |render_surface_list_| the areas in this region
595 // would not be fully covered by opaque content. 597 // would not be fully covered by opaque content.
596 Region unoccluded_screen_space_region_; 598 Region unoccluded_screen_space_region_;
597 599
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 // lifecycle states. See: |LayerTreeLifecycle|. 635 // lifecycle states. See: |LayerTreeLifecycle|.
634 LayerTreeLifecycle lifecycle_; 636 LayerTreeLifecycle lifecycle_;
635 637
636 private: 638 private:
637 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); 639 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl);
638 }; 640 };
639 641
640 } // namespace cc 642 } // namespace cc
641 643
642 #endif // CC_TREES_LAYER_TREE_IMPL_H_ 644 #endif // CC_TREES_LAYER_TREE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698