Chromium Code Reviews| 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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 790 | 790 |
| 791 void PictureLayerTiling::UpdateEvictionCacheIfNeeded( | 791 void PictureLayerTiling::UpdateEvictionCacheIfNeeded( |
| 792 TreePriority tree_priority) { | 792 TreePriority tree_priority) { |
| 793 if (eviction_tiles_cache_valid_ && | 793 if (eviction_tiles_cache_valid_ && |
| 794 eviction_cache_tree_priority_ == tree_priority) | 794 eviction_cache_tree_priority_ == tree_priority) |
| 795 return; | 795 return; |
| 796 | 796 |
| 797 eviction_tiles_cache_.clear(); | 797 eviction_tiles_cache_.clear(); |
| 798 eviction_tiles_cache_.reserve(tiles_.size()); | 798 eviction_tiles_cache_.reserve(tiles_.size()); |
| 799 for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 799 for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { |
| 800 DCHECK(it->second); | |
|
reveman
2014/05/20 23:01:00
I don't think this is worthwhile unless we actuall
vmpstr
2014/05/27 22:41:32
Sorry that was a left over from debugging. Removed
| |
| 801 | |
| 800 // TODO(vmpstr): This should update the priority if UpdateTilePriorities | 802 // TODO(vmpstr): This should update the priority if UpdateTilePriorities |
| 801 // changes not to do this. | 803 // changes not to do this. |
| 802 eviction_tiles_cache_.push_back(it->second); | 804 eviction_tiles_cache_.push_back(it->second); |
| 803 } | 805 } |
| 804 | 806 |
| 805 std::sort(eviction_tiles_cache_.begin(), | 807 std::sort(eviction_tiles_cache_.begin(), |
| 806 eviction_tiles_cache_.end(), | 808 eviction_tiles_cache_.end(), |
| 807 TileEvictionOrder(tree_priority)); | 809 TileEvictionOrder(tree_priority)); |
| 808 eviction_tiles_cache_valid_ = true; | 810 eviction_tiles_cache_valid_ = true; |
| 809 eviction_cache_tree_priority_ = tree_priority; | 811 eviction_cache_tree_priority_ = tree_priority; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 838 } | 840 } |
| 839 | 841 |
| 840 current_tile_ = | 842 current_tile_ = |
| 841 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y()); | 843 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y()); |
| 842 if (!current_tile_ || !TileNeedsRaster(current_tile_)) | 844 if (!current_tile_ || !TileNeedsRaster(current_tile_)) |
| 843 ++(*this); | 845 ++(*this); |
| 844 } | 846 } |
| 845 | 847 |
| 846 PictureLayerTiling::TilingRasterTileIterator::~TilingRasterTileIterator() {} | 848 PictureLayerTiling::TilingRasterTileIterator::~TilingRasterTileIterator() {} |
| 847 | 849 |
| 850 bool | |
| 851 PictureLayerTiling::TilingRasterTileIterator::HasTilesRequiredForActivation() | |
| 852 const { | |
| 853 if (!*this || get_type() != TilePriority::NOW) | |
| 854 return false; | |
| 855 | |
| 856 for (TilingData::Iterator it = visible_iterator_; it; ++it) { | |
| 857 std::pair<int, int> next_index = visible_iterator_.index(); | |
| 858 Tile* tile = tiling_->TileAt(next_index.first, next_index.second); | |
| 859 if (tile && tile->required_for_activation()) | |
| 860 return true; | |
| 861 } | |
| 862 return false; | |
| 863 } | |
| 864 | |
| 848 void PictureLayerTiling::TilingRasterTileIterator::AdvancePhase() { | 865 void PictureLayerTiling::TilingRasterTileIterator::AdvancePhase() { |
| 849 DCHECK_LT(type_, TilePriority::EVENTUALLY); | 866 DCHECK_LT(type_, TilePriority::EVENTUALLY); |
| 850 | 867 |
| 851 do { | 868 do { |
| 852 type_ = static_cast<TilePriority::PriorityBin>(type_ + 1); | 869 type_ = static_cast<TilePriority::PriorityBin>(type_ + 1); |
| 853 if (type_ == TilePriority::EVENTUALLY) { | 870 if (type_ == TilePriority::EVENTUALLY) { |
| 854 spiral_iterator_ = TilingData::SpiralDifferenceIterator( | 871 spiral_iterator_ = TilingData::SpiralDifferenceIterator( |
| 855 &tiling_->tiling_data_, | 872 &tiling_->tiling_data_, |
| 856 eventually_rect_in_content_space_, | 873 eventually_rect_in_content_space_, |
| 857 skewport_in_content_space_, | 874 skewport_in_content_space_, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 962 tiling_->UpdateEvictionCacheIfNeeded(tree_priority_); | 979 tiling_->UpdateEvictionCacheIfNeeded(tree_priority_); |
| 963 tile_iterator_ = tiling_->eviction_tiles_cache_.begin(); | 980 tile_iterator_ = tiling_->eviction_tiles_cache_.begin(); |
| 964 is_valid_ = true; | 981 is_valid_ = true; |
| 965 if (tile_iterator_ != tiling_->eviction_tiles_cache_.end() && | 982 if (tile_iterator_ != tiling_->eviction_tiles_cache_.end() && |
| 966 !(*tile_iterator_)->HasResources()) { | 983 !(*tile_iterator_)->HasResources()) { |
| 967 ++(*this); | 984 ++(*this); |
| 968 } | 985 } |
| 969 } | 986 } |
| 970 | 987 |
| 971 } // namespace cc | 988 } // namespace cc |
| OLD | NEW |