| 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/resources/picture_layer_tiling.h" | 5 #include "cc/resources/picture_layer_tiling.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 | 659 |
| 660 void PictureLayerTiling::DidBecomeActive() { | 660 void PictureLayerTiling::DidBecomeActive() { |
| 661 PicturePileImpl* active_pile = client_->GetPile(); | 661 PicturePileImpl* active_pile = client_->GetPile(); |
| 662 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 662 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { |
| 663 it->second->SetPriority(ACTIVE_TREE, it->second->priority(PENDING_TREE)); | 663 it->second->SetPriority(ACTIVE_TREE, it->second->priority(PENDING_TREE)); |
| 664 it->second->SetPriority(PENDING_TREE, TilePriority()); | 664 it->second->SetPriority(PENDING_TREE, TilePriority()); |
| 665 | 665 |
| 666 // Tile holds a ref onto a picture pile. If the tile never gets invalidated | 666 // Tile holds a ref onto a picture pile. If the tile never gets invalidated |
| 667 // and recreated, then that picture pile ref could exist indefinitely. To | 667 // and recreated, then that picture pile ref could exist indefinitely. To |
| 668 // prevent this, ask the client to update the pile to its own ref. This | 668 // prevent this, ask the client to update the pile to its own ref. This |
| 669 // will cause PicturePileImpls and their clones to get deleted once the | 669 // will cause PicturePileImpls to get deleted once the corresponding |
| 670 // corresponding PictureLayerImpl and any in flight raster jobs go out of | 670 // PictureLayerImpl and any in flight raster jobs go out of scope. |
| 671 // scope. | |
| 672 it->second->set_picture_pile(active_pile); | 671 it->second->set_picture_pile(active_pile); |
| 673 } | 672 } |
| 674 } | 673 } |
| 675 | 674 |
| 676 void PictureLayerTiling::AsValueInto(base::debug::TracedValue* state) const { | 675 void PictureLayerTiling::AsValueInto(base::debug::TracedValue* state) const { |
| 677 state->SetInteger("num_tiles", tiles_.size()); | 676 state->SetInteger("num_tiles", tiles_.size()); |
| 678 state->SetDouble("content_scale", contents_scale_); | 677 state->SetDouble("content_scale", contents_scale_); |
| 679 state->BeginDictionary("tiling_size"); | 678 state->BeginDictionary("tiling_size"); |
| 680 MathUtil::AddToTracedValue(tiling_size(), state); | 679 MathUtil::AddToTracedValue(tiling_size(), state); |
| 681 state->EndDictionary(); | 680 state->EndDictionary(); |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 DCHECK(*this); | 1089 DCHECK(*this); |
| 1091 do { | 1090 do { |
| 1092 ++current_eviction_tiles_index_; | 1091 ++current_eviction_tiles_index_; |
| 1093 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && | 1092 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && |
| 1094 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); | 1093 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); |
| 1095 | 1094 |
| 1096 return *this; | 1095 return *this; |
| 1097 } | 1096 } |
| 1098 | 1097 |
| 1099 } // namespace cc | 1098 } // namespace cc |
| OLD | NEW |