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

Side by Side Diff: cc/layer_tree_impl.cc

Issue 12045086: cc: Throttle tile priority updates to once a frame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebasedonmaster Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_impl.h ('k') | cc/occlusion_tracker_unittest.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 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/layer_tree_impl.h" 5 #include "cc/layer_tree_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/layer_tree_host_common.h" 8 #include "cc/layer_tree_host_common.h"
9 #include "cc/layer_tree_host_impl.h" 9 #include "cc/layer_tree_host_impl.h"
10 #include "ui/gfx/vector2d_conversions.h" 10 #include "ui/gfx/vector2d_conversions.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - 114 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() -
115 gfx::RectF(view_bounds).bottom_right(); 115 gfx::RectF(view_bounds).bottom_right();
116 116
117 // The viewport may be larger than the contents in some cases, such as 117 // The viewport may be larger than the contents in some cases, such as
118 // having a vertical scrollbar but no horizontal overflow. 118 // having a vertical scrollbar but no horizontal overflow.
119 max_scroll.ClampToMin(gfx::Vector2dF()); 119 max_scroll.ClampToMin(gfx::Vector2dF());
120 120
121 root_scroll_layer_->setMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); 121 root_scroll_layer_->setMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll));
122 } 122 }
123 123
124 void LayerTreeImpl::UpdateDrawProperties() { 124 struct UpdateTilePrioritiesForLayer {
125 if (!needs_update_draw_properties_) 125 void operator()(LayerImpl *layer) {
126 layer->updateTilePriorities();
127 }
128 };
129
130 void LayerTreeImpl::UpdateDrawProperties(UpdateDrawPropertiesReason reason) {
131 if (!needs_update_draw_properties_) {
132 if (reason == UPDATE_ACTIVE_TREE_FOR_DRAW && RootLayer())
133 LayerTreeHostCommon::callFunctionForSubtree<UpdateTilePrioritiesForLayer>(
134 RootLayer());
126 return; 135 return;
136 }
127 137
128 needs_update_draw_properties_ = false; 138 needs_update_draw_properties_ = false;
129 render_surface_layer_list_.clear(); 139 render_surface_layer_list_.clear();
130 140
131 // For maxTextureSize. 141 // For maxTextureSize.
132 if (!layer_tree_host_impl_->renderer()) 142 if (!layer_tree_host_impl_->renderer())
133 return; 143 return;
134 144
135 if (!RootLayer()) 145 if (!RootLayer())
136 return; 146 return;
137 147
138 if (root_scroll_layer_) { 148 if (root_scroll_layer_) {
139 root_scroll_layer_->setImplTransform( 149 root_scroll_layer_->setImplTransform(
140 layer_tree_host_impl_->implTransform()); 150 layer_tree_host_impl_->implTransform());
141 // Setting the impl transform re-sets this. 151 // Setting the impl transform re-sets this.
142 needs_update_draw_properties_ = false; 152 needs_update_draw_properties_ = false;
143 } 153 }
144 154
145 { 155 {
146 TRACE_EVENT1("cc", "LayerTreeImpl::UpdateDrawProperties", "IsActive", IsActi veTree()); 156 TRACE_EVENT1("cc", "LayerTreeImpl::UpdateDrawProperties", "IsActive", IsActi veTree());
157 bool update_tile_priorities =
158 reason == UPDATE_PENDING_TREE ||
159 reason == UPDATE_ACTIVE_TREE_FOR_DRAW;
147 LayerTreeHostCommon::calculateDrawProperties( 160 LayerTreeHostCommon::calculateDrawProperties(
148 RootLayer(), 161 RootLayer(),
149 device_viewport_size(), 162 device_viewport_size(),
150 device_scale_factor(), 163 device_scale_factor(),
151 pinch_zoom_viewport().total_page_scale_factor(), 164 pinch_zoom_viewport().total_page_scale_factor(),
152 MaxTextureSize(), 165 MaxTextureSize(),
153 settings().canUseLCDText, 166 settings().canUseLCDText,
154 render_surface_layer_list_); 167 render_surface_layer_list_,
168 update_tile_priorities);
155 } 169 }
156 170
157 DCHECK(!needs_update_draw_properties_) << 171 DCHECK(!needs_update_draw_properties_) <<
158 "calcDrawProperties should not set_needs_update_draw_properties()"; 172 "calcDrawProperties should not set_needs_update_draw_properties()";
159 } 173 }
160 174
161 static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) 175 static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current)
162 { 176 {
163 DCHECK(current); 177 DCHECK(current);
164 for (size_t i = 0; i < current->children().size(); ++i) 178 for (size_t i = 0; i < current->children().size(); ++i)
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 355
342 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { 356 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const {
343 return layer_tree_host_impl_->animationRegistrar(); 357 return layer_tree_host_impl_->animationRegistrar();
344 } 358 }
345 359
346 const PinchZoomViewport& LayerTreeImpl::pinch_zoom_viewport() const { 360 const PinchZoomViewport& LayerTreeImpl::pinch_zoom_viewport() const {
347 return layer_tree_host_impl_->pinchZoomViewport(); 361 return layer_tree_host_impl_->pinchZoomViewport();
348 } 362 }
349 363
350 } // namespace cc 364 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_impl.h ('k') | cc/occlusion_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698