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

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

Issue 2051013002: cc : Push layer lists instead of layer tree at commit and activation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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_scroll.cc ('k') | cc/trees/layer_tree_impl.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 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // Tracing methods. 128 // Tracing methods.
129 // --------------------------------------------------------------------------- 129 // ---------------------------------------------------------------------------
130 void GetAllPrioritizedTilesForTracing( 130 void GetAllPrioritizedTilesForTracing(
131 std::vector<PrioritizedTile>* prioritized_tiles) const; 131 std::vector<PrioritizedTile>* prioritized_tiles) const;
132 void AsValueInto(base::trace_event::TracedValue* dict) const; 132 void AsValueInto(base::trace_event::TracedValue* dict) const;
133 133
134 // Other public methods 134 // Other public methods
135 // --------------------------------------------------------------------------- 135 // ---------------------------------------------------------------------------
136 LayerImpl* root_layer() const { return root_layer_; } 136 LayerImpl* root_layer() const { return root_layer_; }
137 void SetRootLayer(std::unique_ptr<LayerImpl>); 137 void SetRootLayer(std::unique_ptr<LayerImpl>);
138 void SetRootLayerFromLayerList();
138 bool IsRootLayer(const LayerImpl* layer) const; 139 bool IsRootLayer(const LayerImpl* layer) const;
139 std::unique_ptr<OwnedLayerImplList> DetachLayers(); 140 std::unique_ptr<OwnedLayerImplList> DetachLayers();
140 141
141 void SetPropertyTrees(PropertyTrees* property_trees); 142 void SetPropertyTrees(PropertyTrees* property_trees);
142 PropertyTrees* property_trees() { return &property_trees_; } 143 PropertyTrees* property_trees() { return &property_trees_; }
143 144
144 void UpdatePropertyTreesForBoundsDelta(); 145 void UpdatePropertyTreesForBoundsDelta();
145 146
146 void PushPropertiesTo(LayerTreeImpl* tree_impl); 147 void PushPropertiesTo(LayerTreeImpl* tree_impl);
147 148
148 void MoveChangeTrackingToLayers(); 149 void MoveChangeTrackingToLayers();
149 150
150 LayerListIterator<LayerImpl> begin() const; 151 LayerImplList::const_iterator begin() const;
151 LayerListIterator<LayerImpl> end() const; 152 LayerImplList::const_iterator end() const;
152 LayerListReverseIterator<LayerImpl> rbegin(); 153 LayerImplList::reverse_iterator rbegin();
153 LayerListReverseIterator<LayerImpl> rend(); 154 LayerImplList::reverse_iterator rend();
154 155
155 struct CC_EXPORT ElementLayers { 156 struct CC_EXPORT ElementLayers {
156 // Transform and opacity mutations apply to this layer. 157 // Transform and opacity mutations apply to this layer.
157 LayerImpl* main = nullptr; 158 LayerImpl* main = nullptr;
158 // Scroll mutations apply to this layer. 159 // Scroll mutations apply to this layer.
159 LayerImpl* scroll = nullptr; 160 LayerImpl* scroll = nullptr;
160 }; 161 };
161 162
162 void AddToElementMap(LayerImpl* layer); 163 void AddToElementMap(LayerImpl* layer);
163 void RemoveFromElementMap(LayerImpl* layer); 164 void RemoveFromElementMap(LayerImpl* layer);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 383
383 void RegisterScrollbar(ScrollbarLayerImplBase* scrollbar_layer); 384 void RegisterScrollbar(ScrollbarLayerImplBase* scrollbar_layer);
384 void UnregisterScrollbar(ScrollbarLayerImplBase* scrollbar_layer); 385 void UnregisterScrollbar(ScrollbarLayerImplBase* scrollbar_layer);
385 ScrollbarSet ScrollbarsFor(int scroll_layer_id) const; 386 ScrollbarSet ScrollbarsFor(int scroll_layer_id) const;
386 387
387 void RegisterScrollLayer(LayerImpl* layer); 388 void RegisterScrollLayer(LayerImpl* layer);
388 void UnregisterScrollLayer(LayerImpl* layer); 389 void UnregisterScrollLayer(LayerImpl* layer);
389 390
390 void AddSurfaceLayer(LayerImpl* layer); 391 void AddSurfaceLayer(LayerImpl* layer);
391 void RemoveSurfaceLayer(LayerImpl* layer); 392 void RemoveSurfaceLayer(LayerImpl* layer);
392 const std::vector<LayerImpl*>& SurfaceLayers() const { 393 const LayerImplList& SurfaceLayers() const { return surface_layers_; }
393 return surface_layers_;
394 }
395 394
396 LayerImpl* FindFirstScrollingLayerOrScrollbarLayerThatIsHitByPoint( 395 LayerImpl* FindFirstScrollingLayerOrScrollbarLayerThatIsHitByPoint(
397 const gfx::PointF& screen_space_point); 396 const gfx::PointF& screen_space_point);
398 397
399 LayerImpl* FindLayerThatIsHitByPoint(const gfx::PointF& screen_space_point); 398 LayerImpl* FindLayerThatIsHitByPoint(const gfx::PointF& screen_space_point);
400 399
401 LayerImpl* FindLayerThatIsHitByPointInTouchHandlerRegion( 400 LayerImpl* FindLayerThatIsHitByPointInTouchHandlerRegion(
402 const gfx::PointF& screen_space_point); 401 const gfx::PointF& screen_space_point);
403 402
404 void RegisterSelection(const LayerSelection& selection); 403 void RegisterSelection(const LayerSelection& selection);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 return event_listener_properties_[static_cast<size_t>(event_class)]; 466 return event_listener_properties_[static_cast<size_t>(event_class)];
468 } 467 }
469 void set_event_listener_properties(EventListenerClass event_class, 468 void set_event_listener_properties(EventListenerClass event_class,
470 EventListenerProperties event_properties) { 469 EventListenerProperties event_properties) {
471 event_listener_properties_[static_cast<size_t>(event_class)] = 470 event_listener_properties_[static_cast<size_t>(event_class)] =
472 event_properties; 471 event_properties;
473 } 472 }
474 473
475 void ResetAllChangeTracking(); 474 void ResetAllChangeTracking();
476 475
476 void AddToLayerList(LayerImpl* layer);
477
478 void ClearLayerList();
479
480 void BuildLayerListForTesting();
481
477 protected: 482 protected:
478 explicit LayerTreeImpl( 483 explicit LayerTreeImpl(
479 LayerTreeHostImpl* layer_tree_host_impl, 484 LayerTreeHostImpl* layer_tree_host_impl,
480 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, 485 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor,
481 scoped_refptr<SyncedTopControls> top_controls_shown_ratio, 486 scoped_refptr<SyncedTopControls> top_controls_shown_ratio,
482 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll); 487 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll);
483 float ClampPageScaleFactorToLimits(float page_scale_factor) const; 488 float ClampPageScaleFactorToLimits(float page_scale_factor) const;
484 void PushPageScaleFactorAndLimits(const float* page_scale_factor, 489 void PushPageScaleFactorAndLimits(const float* page_scale_factor,
485 float min_page_scale_factor, 490 float min_page_scale_factor,
486 float max_page_scale_factor); 491 float max_page_scale_factor);
(...skipping 24 matching lines...) Expand all
511 float min_page_scale_factor_; 516 float min_page_scale_factor_;
512 float max_page_scale_factor_; 517 float max_page_scale_factor_;
513 518
514 float device_scale_factor_; 519 float device_scale_factor_;
515 float painted_device_scale_factor_; 520 float painted_device_scale_factor_;
516 521
517 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll_; 522 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll_;
518 523
519 std::unique_ptr<OwnedLayerImplList> layers_; 524 std::unique_ptr<OwnedLayerImplList> layers_;
520 LayerImplMap layer_id_map_; 525 LayerImplMap layer_id_map_;
521 std::vector<LayerImpl*> layer_list_; 526 LayerImplList layer_list_;
522 // Set of layers that need to push properties. 527 // Set of layers that need to push properties.
523 std::unordered_set<LayerImpl*> layers_that_should_push_properties_; 528 std::unordered_set<LayerImpl*> layers_that_should_push_properties_;
524 529
525 std::unordered_map<uint64_t, ElementLayers> element_layers_map_; 530 std::unordered_map<uint64_t, ElementLayers> element_layers_map_;
526 531
527 std::unordered_map<int, float> opacity_animations_map_; 532 std::unordered_map<int, float> opacity_animations_map_;
528 std::unordered_map<int, gfx::Transform> transform_animations_map_; 533 std::unordered_map<int, gfx::Transform> transform_animations_map_;
529 534
530 // Maps from clip layer ids to scroll layer ids. Note that this only includes 535 // Maps from clip layer ids to scroll layer ids. Note that this only includes
531 // the subset of clip layers that act as scrolling containers. (This is 536 // the subset of clip layers that act as scrolling containers. (This is
532 // derived from LayerImpl::scroll_clip_layer_ and exists to avoid O(n) walks.) 537 // derived from LayerImpl::scroll_clip_layer_ and exists to avoid O(n) walks.)
533 std::unordered_map<int, int> clip_scroll_map_; 538 std::unordered_map<int, int> clip_scroll_map_;
534 539
535 // Maps scroll layer ids to scrollbar layer ids. For each scroll layer, there 540 // Maps scroll layer ids to scrollbar layer ids. For each scroll layer, there
536 // may be 1 or 2 scrollbar layers (for vertical and horizontal). (This is 541 // may be 1 or 2 scrollbar layers (for vertical and horizontal). (This is
537 // derived from ScrollbarLayerImplBase::scroll_layer_id_ and exists to avoid 542 // derived from ScrollbarLayerImplBase::scroll_layer_id_ and exists to avoid
538 // O(n) walks.) 543 // O(n) walks.)
539 std::multimap<int, int> scrollbar_map_; 544 std::multimap<int, int> scrollbar_map_;
540 545
541 std::vector<PictureLayerImpl*> picture_layers_; 546 std::vector<PictureLayerImpl*> picture_layers_;
542 std::vector<LayerImpl*> surface_layers_; 547 LayerImplList surface_layers_;
543 548
544 // List of visible layers for the most recently prepared frame. 549 // List of visible layers for the most recently prepared frame.
545 LayerImplList render_surface_layer_list_; 550 LayerImplList render_surface_layer_list_;
546 // After drawing the |render_surface_layer_list_| the areas in this region 551 // After drawing the |render_surface_layer_list_| the areas in this region
547 // would not be fully covered by opaque content. 552 // would not be fully covered by opaque content.
548 Region unoccluded_screen_space_region_; 553 Region unoccluded_screen_space_region_;
549 554
550 bool viewport_size_invalid_; 555 bool viewport_size_invalid_;
551 bool needs_update_draw_properties_; 556 bool needs_update_draw_properties_;
552 557
(...skipping 19 matching lines...) Expand all
572 bool top_controls_shrink_blink_size_; 577 bool top_controls_shrink_blink_size_;
573 float top_controls_height_; 578 float top_controls_height_;
574 579
575 // The amount that the top controls are shown from 0 (hidden) to 1 (fully 580 // The amount that the top controls are shown from 0 (hidden) to 1 (fully
576 // shown). 581 // shown).
577 scoped_refptr<SyncedTopControls> top_controls_shown_ratio_; 582 scoped_refptr<SyncedTopControls> top_controls_shown_ratio_;
578 583
579 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; 584 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_;
580 585
581 private: 586 private:
582 void BuildLayerListForTesting();
583 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); 587 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl);
584 }; 588 };
585 589
586 } // namespace cc 590 } // namespace cc
587 591
588 #endif // CC_TREES_LAYER_TREE_IMPL_H_ 592 #endif // CC_TREES_LAYER_TREE_IMPL_H_
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_scroll.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698