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

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

Issue 12259027: cc: Simplify the logic for deciding to update tile priorities. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sper simple x2 Created 7 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 | Annotate | Revision Log
« cc/trees/layer_tree_impl.h ('K') | « cc/trees/layer_tree_impl.h ('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 "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/animation/animation.h" 8 #include "cc/animation/animation.h"
9 #include "cc/animation/animation_id_provider.h" 9 #include "cc/animation/animation_id_provider.h"
10 #include "cc/animation/keyframed_animation_curve.h" 10 #include "cc/animation/keyframed_animation_curve.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 horiz->SetViewportWithinScrollableArea(scrollable_viewport, 245 horiz->SetViewportWithinScrollableArea(scrollable_viewport,
246 ScrollableSize()); 246 ScrollableSize());
247 } 247 }
248 if (ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer()) { 248 if (ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer()) {
249 vertical->set_vertical_adjust(vertical_adjust); 249 vertical->set_vertical_adjust(vertical_adjust);
250 vertical->SetViewportWithinScrollableArea(scrollable_viewport, 250 vertical->SetViewportWithinScrollableArea(scrollable_viewport,
251 ScrollableSize()); 251 ScrollableSize());
252 } 252 }
253 } 253 }
254 254
255 struct UpdateTilePrioritiesForLayer { 255 void LayerTreeImpl::UpdateDrawProperties() {
256 void operator()(LayerImpl *layer) {
257 layer->UpdateTilePriorities();
258 }
259 };
260
261 void LayerTreeImpl::UpdateDrawProperties(UpdateDrawPropertiesReason reason) {
262 if (IsActiveTree() && RootScrollLayer() && RootClipLayer()) 256 if (IsActiveTree() && RootScrollLayer() && RootClipLayer())
263 UpdateRootScrollLayerSizeDelta(); 257 UpdateRootScrollLayerSizeDelta();
264 258
265 if (settings().solid_color_scrollbars && 259 if (settings().solid_color_scrollbars &&
266 IsActiveTree() && 260 IsActiveTree() &&
267 RootScrollLayer()) { 261 RootScrollLayer()) {
268 UpdateSolidColorScrollbars(); 262 UpdateSolidColorScrollbars();
269 263
270 // The top controls manager is incompatible with the WebKit-created cliprect 264 // The top controls manager is incompatible with the WebKit-created cliprect
271 // because it can bring into view a larger amount of content when it 265 // because it can bring into view a larger amount of content when it
272 // hides. It's safe to deactivate the clip rect if no non-overlay scrollbars 266 // hides. It's safe to deactivate the clip rect if no non-overlay scrollbars
273 // are present. 267 // are present.
274 if (RootClipLayer() && layer_tree_host_impl_->top_controls_manager()) 268 if (RootClipLayer() && layer_tree_host_impl_->top_controls_manager())
275 RootClipLayer()->SetMasksToBounds(false); 269 RootClipLayer()->SetMasksToBounds(false);
276 } 270 }
277 271
278 if (!needs_update_draw_properties_) {
279 if (reason == UPDATE_ACTIVE_TREE_FOR_DRAW && root_layer())
280 LayerTreeHostCommon::CallFunctionForSubtree<UpdateTilePrioritiesForLayer>(
281 root_layer());
282 return;
283 }
284
285 needs_update_draw_properties_ = false; 272 needs_update_draw_properties_ = false;
286 render_surface_layer_list_.clear(); 273 render_surface_layer_list_.clear();
287 274
288 // For max_texture_size. 275 // For max_texture_size.
289 if (!layer_tree_host_impl_->renderer()) 276 if (!layer_tree_host_impl_->renderer())
290 return; 277 return;
291 278
292 if (!root_layer()) 279 if (!root_layer())
293 return; 280 return;
294 281
295 if (root_scroll_layer_) { 282 if (root_scroll_layer_) {
296 root_scroll_layer_->SetImplTransform(ImplTransform()); 283 root_scroll_layer_->SetImplTransform(ImplTransform());
297 // Setting the impl transform re-sets this. 284 // Setting the impl transform re-sets this.
298 needs_update_draw_properties_ = false; 285 needs_update_draw_properties_ = false;
299 } 286 }
300 287
301 { 288 {
302 TRACE_EVENT1("cc", 289 TRACE_EVENT1("cc",
303 "LayerTreeImpl::UpdateDrawProperties", 290 "LayerTreeImpl::UpdateDrawProperties",
304 "IsActive", 291 "IsActive",
305 IsActiveTree()); 292 IsActiveTree());
293
294 base::TimeTicks frame_time = CurrentFrameTime();
306 bool update_tile_priorities = 295 bool update_tile_priorities =
307 reason == UPDATE_PENDING_TREE || 296 frame_time != frame_time_last_update_tile_priorities_;
308 reason == UPDATE_ACTIVE_TREE_FOR_DRAW; 297 frame_time_last_update_tile_priorities_ = frame_time;
298
309 LayerTreeHostCommon::CalculateDrawProperties( 299 LayerTreeHostCommon::CalculateDrawProperties(
310 root_layer(), 300 root_layer(),
311 device_viewport_size(), 301 device_viewport_size(),
312 device_scale_factor(), 302 device_scale_factor(),
313 total_page_scale_factor(), 303 total_page_scale_factor(),
314 MaxTextureSize(), 304 MaxTextureSize(),
315 settings().can_use_lcd_text, 305 settings().can_use_lcd_text,
316 &render_surface_layer_list_, 306 &render_surface_layer_list_,
317 update_tile_priorities); 307 update_tile_priorities);
318 } 308 }
319 309
320 DCHECK(!needs_update_draw_properties_) << 310 DCHECK(!needs_update_draw_properties_) <<
321 "calcDrawProperties should not set_needs_update_draw_properties()"; 311 "CalcDrawProperties should not set_needs_update_draw_properties()";
322 } 312 }
323 313
324 static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) { 314 static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) {
325 DCHECK(current); 315 DCHECK(current);
326 for (size_t i = 0; i < current->children().size(); ++i) 316 for (size_t i = 0; i < current->children().size(); ++i)
327 ClearRenderSurfacesOnLayerImplRecursive(current->children()[i]); 317 ClearRenderSurfacesOnLayerImplRecursive(current->children()[i]);
328 current->ClearRenderSurface(); 318 current->ClearRenderSurface();
329 } 319 }
330 320
331 void LayerTreeImpl::ClearRenderSurfaces() { 321 void LayerTreeImpl::ClearRenderSurfaces() {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 365
376 void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) { 366 void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) {
377 DCHECK(LayerById(layer->id())); 367 DCHECK(LayerById(layer->id()));
378 layer_id_map_.erase(layer->id()); 368 layer_id_map_.erase(layer->id());
379 } 369 }
380 370
381 void LayerTreeImpl::PushPersistedState(LayerTreeImpl* pending_tree) { 371 void LayerTreeImpl::PushPersistedState(LayerTreeImpl* pending_tree) {
382 int id = currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0; 372 int id = currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0;
383 pending_tree->SetCurrentlyScrollingLayer( 373 pending_tree->SetCurrentlyScrollingLayer(
384 LayerTreeHostCommon::FindLayerInSubtree(pending_tree->root_layer(), id)); 374 LayerTreeHostCommon::FindLayerInSubtree(pending_tree->root_layer(), id));
375
376 frame_time_last_update_tile_priorities_ =
377 pending_tree->frame_time_last_update_tile_priorities_;
385 } 378 }
386 379
387 static void DidBecomeActiveRecursive(LayerImpl* layer) { 380 static void DidBecomeActiveRecursive(LayerImpl* layer) {
388 layer->DidBecomeActive(); 381 layer->DidBecomeActive();
389 for (size_t i = 0; i < layer->children().size(); ++i) 382 for (size_t i = 0; i < layer->children().size(); ++i)
390 DidBecomeActiveRecursive(layer->children()[i]); 383 DidBecomeActiveRecursive(layer->children()[i]);
391 } 384 }
392 385
393 void LayerTreeImpl::DidBecomeActive() { 386 void LayerTreeImpl::DidBecomeActive() {
394 if (root_layer()) 387 if (root_layer())
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 gfx::Vector2dF original_viewport_size = 673 gfx::Vector2dF original_viewport_size =
681 gfx::RectF(root_clip->bounds()).bottom_right() - 674 gfx::RectF(root_clip->bounds()).bottom_right() -
682 gfx::PointF(); 675 gfx::PointF();
683 original_viewport_size.Scale(1 / page_scale_factor()); 676 original_viewport_size.Scale(1 / page_scale_factor());
684 677
685 root_scroll->SetFixedContainerSizeDelta( 678 root_scroll->SetFixedContainerSizeDelta(
686 scrollable_viewport_size - original_viewport_size); 679 scrollable_viewport_size - original_viewport_size);
687 } 680 }
688 681
689 } // namespace cc 682 } // namespace cc
OLDNEW
« cc/trees/layer_tree_impl.h ('K') | « cc/trees/layer_tree_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698