| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 #include "cc/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 viewport_size_invalid_(false), | 74 viewport_size_invalid_(false), |
| 75 needs_update_draw_properties_(true), | 75 needs_update_draw_properties_(true), |
| 76 needs_full_tree_sync_(true), | 76 needs_full_tree_sync_(true), |
| 77 next_activation_forces_redraw_(false), | 77 next_activation_forces_redraw_(false), |
| 78 has_ever_been_drawn_(false), | 78 has_ever_been_drawn_(false), |
| 79 render_surface_layer_list_id_(0), | 79 render_surface_layer_list_id_(0), |
| 80 have_scroll_event_handlers_(false), | 80 have_scroll_event_handlers_(false), |
| 81 event_listener_properties_(), | 81 event_listener_properties_(), |
| 82 top_controls_shrink_blink_size_(false), | 82 top_controls_shrink_blink_size_(false), |
| 83 top_controls_height_(0), | 83 top_controls_height_(0), |
| 84 top_controls_shown_ratio_(top_controls_shown_ratio) {} | 84 top_controls_shown_ratio_(top_controls_shown_ratio) { |
| 85 property_trees()->is_main_thread = false; |
| 86 } |
| 85 | 87 |
| 86 LayerTreeImpl::~LayerTreeImpl() { | 88 LayerTreeImpl::~LayerTreeImpl() { |
| 87 BreakSwapPromises(IsActiveTree() ? SwapPromise::SWAP_FAILS | 89 BreakSwapPromises(IsActiveTree() ? SwapPromise::SWAP_FAILS |
| 88 : SwapPromise::ACTIVATION_FAILS); | 90 : SwapPromise::ACTIVATION_FAILS); |
| 89 | 91 |
| 90 // Need to explicitly clear the tree prior to destroying this so that | 92 // Need to explicitly clear the tree prior to destroying this so that |
| 91 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. | 93 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. |
| 92 DCHECK(!root_layer_); | 94 DCHECK(!root_layer_); |
| 93 DCHECK(layers_with_copy_output_request_.empty()); | 95 DCHECK(layers_with_copy_output_request_.empty()); |
| 94 } | 96 } |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 "layers_updated_count", layers_updated_count); | 904 "layers_updated_count", layers_updated_count); |
| 903 } | 905 } |
| 904 | 906 |
| 905 DCHECK(!needs_update_draw_properties_) | 907 DCHECK(!needs_update_draw_properties_) |
| 906 << "CalcDrawProperties should not set_needs_update_draw_properties()"; | 908 << "CalcDrawProperties should not set_needs_update_draw_properties()"; |
| 907 return true; | 909 return true; |
| 908 } | 910 } |
| 909 | 911 |
| 910 void LayerTreeImpl::BuildPropertyTreesForTesting() { | 912 void LayerTreeImpl::BuildPropertyTreesForTesting() { |
| 911 LayerTreeHostCommon::PreCalculateMetaInformationForTesting(root_layer_.get()); | 913 LayerTreeHostCommon::PreCalculateMetaInformationForTesting(root_layer_.get()); |
| 914 property_trees_.transform_tree.set_source_to_parent_updates_allowed(true); |
| 912 PropertyTreeBuilder::BuildPropertyTrees( | 915 PropertyTreeBuilder::BuildPropertyTrees( |
| 913 root_layer_.get(), PageScaleLayer(), InnerViewportScrollLayer(), | 916 root_layer_.get(), PageScaleLayer(), InnerViewportScrollLayer(), |
| 914 OuterViewportScrollLayer(), OverscrollElasticityLayer(), | 917 OuterViewportScrollLayer(), OverscrollElasticityLayer(), |
| 915 elastic_overscroll()->Current(IsActiveTree()), | 918 elastic_overscroll()->Current(IsActiveTree()), |
| 916 current_page_scale_factor(), device_scale_factor(), | 919 current_page_scale_factor(), device_scale_factor(), |
| 917 gfx::Rect(DrawViewportSize()), layer_tree_host_impl_->DrawTransform(), | 920 gfx::Rect(DrawViewportSize()), layer_tree_host_impl_->DrawTransform(), |
| 918 &property_trees_); | 921 &property_trees_); |
| 922 property_trees_.transform_tree.set_source_to_parent_updates_allowed(false); |
| 919 } | 923 } |
| 920 | 924 |
| 921 void LayerTreeImpl::IncrementRenderSurfaceListIdForTesting() { | 925 void LayerTreeImpl::IncrementRenderSurfaceListIdForTesting() { |
| 922 render_surface_layer_list_id_++; | 926 render_surface_layer_list_id_++; |
| 923 } | 927 } |
| 924 | 928 |
| 925 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const { | 929 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const { |
| 926 // If this assert triggers, then the list is dirty. | 930 // If this assert triggers, then the list is dirty. |
| 927 DCHECK(!needs_update_draw_properties_); | 931 DCHECK(!needs_update_draw_properties_); |
| 928 return render_surface_layer_list_; | 932 return render_surface_layer_list_; |
| (...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2066 const gfx::BoxF& box, | 2070 const gfx::BoxF& box, |
| 2067 gfx::BoxF* bounds) const { | 2071 gfx::BoxF* bounds) const { |
| 2068 *bounds = gfx::BoxF(); | 2072 *bounds = gfx::BoxF(); |
| 2069 return layer_tree_host_impl_->animation_host() | 2073 return layer_tree_host_impl_->animation_host() |
| 2070 ? layer_tree_host_impl_->animation_host() | 2074 ? layer_tree_host_impl_->animation_host() |
| 2071 ->TransformAnimationBoundsForBox(layer->id(), box, bounds) | 2075 ->TransformAnimationBoundsForBox(layer->id(), box, bounds) |
| 2072 : true; | 2076 : true; |
| 2073 } | 2077 } |
| 2074 | 2078 |
| 2075 } // namespace cc | 2079 } // namespace cc |
| OLD | NEW |