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

Side by Side Diff: cc/picture_layer_tiling.cc

Issue 11953005: cc: Update picture pile on tiles to prevent memory leak (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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/picture_layer_tiling.h ('k') | cc/test/fake_picture_layer_tiling_client.h » ('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 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 #include "cc/picture_layer_tiling.h" 5 #include "cc/picture_layer_tiling.h"
6 6
7 #include "cc/math_util.h" 7 #include "cc/math_util.h"
8 #include "ui/gfx/rect_conversions.h" 8 #include "ui/gfx/rect_conversions.h"
9 #include "ui/gfx/size_conversions.h" 9 #include "ui/gfx/size_conversions.h"
10 10
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 priority.time_to_visible_in_seconds = 308 priority.time_to_visible_in_seconds =
309 TilePriority::TimeForBoundsToIntersect( 309 TilePriority::TimeForBoundsToIntersect(
310 last_screen_rect, current_screen_rect, time_delta, view_rect); 310 last_screen_rect, current_screen_rect, time_delta, view_rect);
311 311
312 priority.distance_to_visible_in_pixels = 312 priority.distance_to_visible_in_pixels =
313 TilePriority::manhattanDistance(current_screen_rect, view_rect); 313 TilePriority::manhattanDistance(current_screen_rect, view_rect);
314 it->second->set_priority(tree, priority); 314 it->second->set_priority(tree, priority);
315 } 315 }
316 } 316 }
317 317
318 void PictureLayerTiling::MoveTilePriorities(WhichTree src_tree, 318 void PictureLayerTiling::MoveTilePriorities(WhichTree src_tree,
reveman 2013/01/20 19:20:29 Should we update the name of this function to refl
319 WhichTree dst_tree) { 319 WhichTree dst_tree) {
320 DCHECK(src_tree != dst_tree); 320 DCHECK(src_tree != dst_tree);
321 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { 321 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
322 it->second->set_priority(dst_tree, it->second->priority(src_tree)); 322 it->second->set_priority(dst_tree, it->second->priority(src_tree));
323 it->second->set_priority(src_tree, TilePriority()); 323 it->second->set_priority(src_tree, TilePriority());
324 // Tile holds a ref onto a picture pile. If the tile never gets invalidated
325 // and recreated, then that picture pile ref could exist indefinitely. To
326 // prevent this, ask the client to update the pile to its own ref. This
327 // will cause PicturePileImpls and their clones to get deleted once the
328 // corresponding PictureLayerImpl and any in flight raster jobs go out of
329 // scope.
330 client_->UpdatePile(it->second);
324 } 331 }
325 } 332 }
326 333
327 } // namespace cc 334 } // namespace cc
OLDNEW
« no previous file with comments | « cc/picture_layer_tiling.h ('k') | cc/test/fake_picture_layer_tiling_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698