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

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

Issue 1907053004: cc: Make CallFunctionForEveryLayer use LayerListIterator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: FindLayers should skip layers instead of returning when switching from call-function to iteration l… Created 4 years, 8 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_serialization.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 void LayerTreeImpl::Shutdown() { 100 void LayerTreeImpl::Shutdown() {
101 if (root_layer_) 101 if (root_layer_)
102 RemoveLayer(root_layer_->id()); 102 RemoveLayer(root_layer_->id());
103 root_layer_ = nullptr; 103 root_layer_ = nullptr;
104 } 104 }
105 105
106 void LayerTreeImpl::ReleaseResources() { 106 void LayerTreeImpl::ReleaseResources() {
107 if (root_layer_) { 107 if (root_layer_) {
108 LayerTreeHostCommon::CallFunctionForEveryLayer( 108 LayerTreeHostCommon::CallFunctionForEveryLayer(
109 this, [](LayerImpl* layer) { layer->ReleaseResources(); }, 109 this, [](LayerImpl* layer) { layer->ReleaseResources(); });
110 CallFunctionLayerType::ALL_LAYERS);
111 } 110 }
112 } 111 }
113 112
114 void LayerTreeImpl::RecreateResources() { 113 void LayerTreeImpl::RecreateResources() {
115 if (root_layer_) { 114 if (root_layer_) {
116 LayerTreeHostCommon::CallFunctionForEveryLayer( 115 LayerTreeHostCommon::CallFunctionForEveryLayer(
117 this, [](LayerImpl* layer) { layer->RecreateResources(); }, 116 this, [](LayerImpl* layer) { layer->RecreateResources(); });
118 CallFunctionLayerType::ALL_LAYERS);
119 } 117 }
120 } 118 }
121 119
122 bool LayerTreeImpl::IsViewportLayerId(int id) const { 120 bool LayerTreeImpl::IsViewportLayerId(int id) const {
123 if (id == inner_viewport_scroll_layer_id_ || 121 if (id == inner_viewport_scroll_layer_id_ ||
124 id == outer_viewport_scroll_layer_id_) 122 id == outer_viewport_scroll_layer_id_)
125 return true; 123 return true;
126 if (InnerViewportContainerLayer() && 124 if (InnerViewportContainerLayer() &&
127 id == InnerViewportContainerLayer()->id()) 125 id == InnerViewportContainerLayer()->id())
128 return true; 126 return true;
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 546
549 void LayerTreeImpl::UpdatePropertyTreeScrollingAndAnimationFromMainThread() { 547 void LayerTreeImpl::UpdatePropertyTreeScrollingAndAnimationFromMainThread() {
550 // TODO(enne): This should get replaced by pulling out scrolling and 548 // TODO(enne): This should get replaced by pulling out scrolling and
551 // animations into their own trees. Then scrolls and animations would have 549 // animations into their own trees. Then scrolls and animations would have
552 // their own ways of synchronizing across commits. This occurs to push 550 // their own ways of synchronizing across commits. This occurs to push
553 // updates from scrolling deltas on the compositor thread that have occurred 551 // updates from scrolling deltas on the compositor thread that have occurred
554 // after begin frame and updates from animations that have ticked since begin 552 // after begin frame and updates from animations that have ticked since begin
555 // frame to a newly-committed property tree. 553 // frame to a newly-committed property tree.
556 if (!root_layer()) 554 if (!root_layer())
557 return; 555 return;
558 LayerTreeHostCommon::CallFunctionForEveryLayer( 556 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [](LayerImpl* layer) {
559 this, 557 layer->UpdatePropertyTreeForScrollingAndAnimationIfNeeded();
560 [](LayerImpl* layer) { 558 });
561 layer->UpdatePropertyTreeForScrollingAndAnimationIfNeeded();
562 },
563 CallFunctionLayerType::ALL_LAYERS);
564 } 559 }
565 560
566 void LayerTreeImpl::SetPageScaleOnActiveTree(float active_page_scale) { 561 void LayerTreeImpl::SetPageScaleOnActiveTree(float active_page_scale) {
567 DCHECK(IsActiveTree()); 562 DCHECK(IsActiveTree());
568 if (page_scale_factor()->SetCurrent( 563 if (page_scale_factor()->SetCurrent(
569 ClampPageScaleFactorToLimits(active_page_scale))) { 564 ClampPageScaleFactorToLimits(active_page_scale))) {
570 DidUpdatePageScale(); 565 DidUpdatePageScale();
571 if (PageScaleLayer()) { 566 if (PageScaleLayer()) {
572 draw_property_utils::UpdatePageScaleFactor( 567 draw_property_utils::UpdatePageScaleFactor(
573 property_trees(), PageScaleLayer(), current_page_scale_factor(), 568 property_trees(), PageScaleLayer(), current_page_scale_factor(),
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 layer_tree_host_impl_->SetFullRootLayerDamage(); 1061 layer_tree_host_impl_->SetFullRootLayerDamage();
1067 next_activation_forces_redraw_ = false; 1062 next_activation_forces_redraw_ = false;
1068 } 1063 }
1069 1064
1070 // Always reset this flag on activation, as we would only have activated 1065 // Always reset this flag on activation, as we would only have activated
1071 // if we were in a good state. 1066 // if we were in a good state.
1072 layer_tree_host_impl_->ResetRequiresHighResToDraw(); 1067 layer_tree_host_impl_->ResetRequiresHighResToDraw();
1073 1068
1074 if (root_layer()) { 1069 if (root_layer()) {
1075 LayerTreeHostCommon::CallFunctionForEveryLayer( 1070 LayerTreeHostCommon::CallFunctionForEveryLayer(
1076 this, [](LayerImpl* layer) { layer->DidBecomeActive(); }, 1071 this, [](LayerImpl* layer) { layer->DidBecomeActive(); });
1077 CallFunctionLayerType::ALL_LAYERS);
1078 } 1072 }
1079 1073
1080 for (const auto& swap_promise : swap_promise_list_) 1074 for (const auto& swap_promise : swap_promise_list_)
1081 swap_promise->DidActivate(); 1075 swap_promise->DidActivate();
1082 devtools_instrumentation::DidActivateLayerTree(layer_tree_host_impl_->id(), 1076 devtools_instrumentation::DidActivateLayerTree(layer_tree_host_impl_->id(),
1083 source_frame_number_); 1077 source_frame_number_);
1084 } 1078 }
1085 1079
1086 bool LayerTreeImpl::RequiresHighResToDraw() const { 1080 bool LayerTreeImpl::RequiresHighResToDraw() const {
1087 return layer_tree_host_impl_->RequiresHighResToDraw(); 1081 return layer_tree_host_impl_->RequiresHighResToDraw();
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 } 2078 }
2085 2079
2086 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { 2080 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) {
2087 layers_that_should_push_properties_.clear(); 2081 layers_that_should_push_properties_.clear();
2088 for (auto* layer : *this) 2082 for (auto* layer : *this)
2089 layer->ResetChangeTracking(); 2083 layer->ResetChangeTracking();
2090 property_trees_.ResetAllChangeTracking(flag); 2084 property_trees_.ResetAllChangeTracking(flag);
2091 } 2085 }
2092 2086
2093 } // namespace cc 2087 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_serialization.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698