| OLD | NEW |
| 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 Loading... |
| 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::DidBecomeActive() { |
| 319 WhichTree dst_tree) { | |
| 320 DCHECK(src_tree != dst_tree); | |
| 321 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 319 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { |
| 322 it->second->set_priority(dst_tree, it->second->priority(src_tree)); | 320 it->second->set_priority(ACTIVE_TREE, it->second->priority(PENDING_TREE)); |
| 323 it->second->set_priority(src_tree, TilePriority()); | 321 it->second->set_priority(PENDING_TREE, TilePriority()); |
| 322 |
| 323 // Tile holds a ref onto a picture pile. If the tile never gets invalidated |
| 324 // and recreated, then that picture pile ref could exist indefinitely. To |
| 325 // prevent this, ask the client to update the pile to its own ref. This |
| 326 // will cause PicturePileImpls and their clones to get deleted once the |
| 327 // corresponding PictureLayerImpl and any in flight raster jobs go out of |
| 328 // scope. |
| 329 client_->UpdatePile(it->second); |
| 324 } | 330 } |
| 325 } | 331 } |
| 326 | 332 |
| 327 } // namespace cc | 333 } // namespace cc |
| OLD | NEW |