| OLD | NEW |
| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 void SetNeedsRedraw(); | 123 void SetNeedsRedraw(); |
| 124 | 124 |
| 125 // Tracing methods. | 125 // Tracing methods. |
| 126 // --------------------------------------------------------------------------- | 126 // --------------------------------------------------------------------------- |
| 127 void GetAllPrioritizedTilesForTracing( | 127 void GetAllPrioritizedTilesForTracing( |
| 128 std::vector<PrioritizedTile>* prioritized_tiles) const; | 128 std::vector<PrioritizedTile>* prioritized_tiles) const; |
| 129 void AsValueInto(base::trace_event::TracedValue* dict) const; | 129 void AsValueInto(base::trace_event::TracedValue* dict) const; |
| 130 | 130 |
| 131 // Other public methods | 131 // Other public methods |
| 132 // --------------------------------------------------------------------------- | 132 // --------------------------------------------------------------------------- |
| 133 LayerImpl* root_layer() const { return root_layer_.get(); } | 133 LayerImpl* root_layer() const { return root_layer_; } |
| 134 void SetRootLayer(scoped_ptr<LayerImpl>); | 134 void SetRootLayer(scoped_ptr<LayerImpl>); |
| 135 scoped_ptr<LayerImpl> DetachLayerTree(); | 135 scoped_ptr<OwnedLayerImplList> DetachLayers(); |
| 136 void ClearLayers(); |
| 136 | 137 |
| 137 void SetPropertyTrees(const PropertyTrees property_trees) { | 138 void SetPropertyTrees(const PropertyTrees property_trees) { |
| 138 property_trees_ = property_trees; | 139 property_trees_ = property_trees; |
| 139 property_trees_.is_main_thread = false; | 140 property_trees_.is_main_thread = false; |
| 140 property_trees_.is_active = IsActiveTree(); | 141 property_trees_.is_active = IsActiveTree(); |
| 141 property_trees_.transform_tree.set_source_to_parent_updates_allowed(false); | 142 property_trees_.transform_tree.set_source_to_parent_updates_allowed(false); |
| 142 } | 143 } |
| 143 PropertyTrees* property_trees() { return &property_trees_; } | 144 PropertyTrees* property_trees() { return &property_trees_; } |
| 144 | 145 |
| 145 void UpdatePropertyTreesForBoundsDelta(); | 146 void UpdatePropertyTreesForBoundsDelta(); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 301 |
| 301 void AddLayerShouldPushProperties(LayerImpl* layer); | 302 void AddLayerShouldPushProperties(LayerImpl* layer); |
| 302 void RemoveLayerShouldPushProperties(LayerImpl* layer); | 303 void RemoveLayerShouldPushProperties(LayerImpl* layer); |
| 303 std::unordered_set<LayerImpl*>& LayersThatShouldPushProperties(); | 304 std::unordered_set<LayerImpl*>& LayersThatShouldPushProperties(); |
| 304 bool LayerNeedsPushPropertiesForTesting(LayerImpl* layer); | 305 bool LayerNeedsPushPropertiesForTesting(LayerImpl* layer); |
| 305 | 306 |
| 306 // These should be called by LayerImpl's ctor/dtor. | 307 // These should be called by LayerImpl's ctor/dtor. |
| 307 void RegisterLayer(LayerImpl* layer); | 308 void RegisterLayer(LayerImpl* layer); |
| 308 void UnregisterLayer(LayerImpl* layer); | 309 void UnregisterLayer(LayerImpl* layer); |
| 309 | 310 |
| 311 // These manage ownership of the LayerImpl. |
| 312 void AddLayer(scoped_ptr<LayerImpl> layer); |
| 313 scoped_ptr<LayerImpl> RemoveLayer(int id); |
| 314 |
| 310 size_t NumLayers(); | 315 size_t NumLayers(); |
| 311 | 316 |
| 312 void DidBecomeActive(); | 317 void DidBecomeActive(); |
| 313 | 318 |
| 314 // Set on the active tree when the viewport size recently changed | 319 // Set on the active tree when the viewport size recently changed |
| 315 // and the active tree's size is now out of date. | 320 // and the active tree's size is now out of date. |
| 316 bool ViewportSizeInvalid() const; | 321 bool ViewportSizeInvalid() const; |
| 317 void SetViewportSizeInvalid(); | 322 void SetViewportSizeInvalid(); |
| 318 void ResetViewportSizeInvalid(); | 323 void ResetViewportSizeInvalid(); |
| 319 | 324 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 float max_page_scale_factor); | 494 float max_page_scale_factor); |
| 490 bool SetPageScaleFactorLimits(float min_page_scale_factor, | 495 bool SetPageScaleFactorLimits(float min_page_scale_factor, |
| 491 float max_page_scale_factor); | 496 float max_page_scale_factor); |
| 492 bool IsViewportLayerId(int id) const; | 497 bool IsViewportLayerId(int id) const; |
| 493 void UpdateScrollbars(int scroll_layer_id, int clip_layer_id); | 498 void UpdateScrollbars(int scroll_layer_id, int clip_layer_id); |
| 494 void DidUpdatePageScale(); | 499 void DidUpdatePageScale(); |
| 495 void PushTopControls(const float* top_controls_shown_ratio); | 500 void PushTopControls(const float* top_controls_shown_ratio); |
| 496 LayerTreeHostImpl* layer_tree_host_impl_; | 501 LayerTreeHostImpl* layer_tree_host_impl_; |
| 497 int source_frame_number_; | 502 int source_frame_number_; |
| 498 int is_first_frame_after_commit_tracker_; | 503 int is_first_frame_after_commit_tracker_; |
| 499 scoped_ptr<LayerImpl> root_layer_; | 504 LayerImpl* root_layer_; |
| 500 HeadsUpDisplayLayerImpl* hud_layer_; | 505 HeadsUpDisplayLayerImpl* hud_layer_; |
| 501 PropertyTrees property_trees_; | 506 PropertyTrees property_trees_; |
| 502 SkColor background_color_; | 507 SkColor background_color_; |
| 503 bool has_transparent_background_; | 508 bool has_transparent_background_; |
| 504 | 509 |
| 505 int last_scrolled_layer_id_; | 510 int last_scrolled_layer_id_; |
| 506 int overscroll_elasticity_layer_id_; | 511 int overscroll_elasticity_layer_id_; |
| 507 int page_scale_layer_id_; | 512 int page_scale_layer_id_; |
| 508 int inner_viewport_scroll_layer_id_; | 513 int inner_viewport_scroll_layer_id_; |
| 509 int outer_viewport_scroll_layer_id_; | 514 int outer_viewport_scroll_layer_id_; |
| 510 | 515 |
| 511 LayerSelection selection_; | 516 LayerSelection selection_; |
| 512 | 517 |
| 513 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor_; | 518 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor_; |
| 514 float min_page_scale_factor_; | 519 float min_page_scale_factor_; |
| 515 float max_page_scale_factor_; | 520 float max_page_scale_factor_; |
| 516 | 521 |
| 517 float device_scale_factor_; | 522 float device_scale_factor_; |
| 518 float painted_device_scale_factor_; | 523 float painted_device_scale_factor_; |
| 519 | 524 |
| 520 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll_; | 525 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll_; |
| 521 | 526 |
| 522 using LayerIdMap = std::unordered_map<int, LayerImpl*>; | 527 scoped_ptr<OwnedLayerImplList> layers_; |
| 523 LayerIdMap layer_id_map_; | 528 LayerImplMap layer_id_map_; |
| 524 // Set of layers that need to push properties. | 529 // Set of layers that need to push properties. |
| 525 std::unordered_set<LayerImpl*> layers_that_should_push_properties_; | 530 std::unordered_set<LayerImpl*> layers_that_should_push_properties_; |
| 526 | 531 |
| 527 std::unordered_map<uint64_t, ElementLayers> element_layers_map_; | 532 std::unordered_map<uint64_t, ElementLayers> element_layers_map_; |
| 528 | 533 |
| 529 // Maps from clip layer ids to scroll layer ids. Note that this only includes | 534 // Maps from clip layer ids to scroll layer ids. Note that this only includes |
| 530 // the subset of clip layers that act as scrolling containers. (This is | 535 // the subset of clip layers that act as scrolling containers. (This is |
| 531 // derived from LayerImpl::scroll_clip_layer_ and exists to avoid O(n) walks.) | 536 // derived from LayerImpl::scroll_clip_layer_ and exists to avoid O(n) walks.) |
| 532 std::unordered_map<int, int> clip_scroll_map_; | 537 std::unordered_map<int, int> clip_scroll_map_; |
| 533 | 538 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 585 |
| 581 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; | 586 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; |
| 582 | 587 |
| 583 private: | 588 private: |
| 584 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); | 589 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); |
| 585 }; | 590 }; |
| 586 | 591 |
| 587 } // namespace cc | 592 } // namespace cc |
| 588 | 593 |
| 589 #endif // CC_TREES_LAYER_TREE_IMPL_H_ | 594 #endif // CC_TREES_LAYER_TREE_IMPL_H_ |
| OLD | NEW |