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

Side by Side Diff: cc/resources/picture_layer_tiling.cc

Issue 246673005: cc: Start using raster/eviction iterators in tile manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
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/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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 765
766 void PictureLayerTiling::UpdateEvictionCacheIfNeeded( 766 void PictureLayerTiling::UpdateEvictionCacheIfNeeded(
767 TreePriority tree_priority) { 767 TreePriority tree_priority) {
768 if (eviction_tiles_cache_valid_ && 768 if (eviction_tiles_cache_valid_ &&
769 eviction_cache_tree_priority_ == tree_priority) 769 eviction_cache_tree_priority_ == tree_priority)
770 return; 770 return;
771 771
772 eviction_tiles_cache_.clear(); 772 eviction_tiles_cache_.clear();
773 eviction_tiles_cache_.reserve(tiles_.size()); 773 eviction_tiles_cache_.reserve(tiles_.size());
774 for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { 774 for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
775 DCHECK(it->second);
776
775 // TODO(vmpstr): This should update the priority if UpdateTilePriorities 777 // TODO(vmpstr): This should update the priority if UpdateTilePriorities
776 // changes not to do this. 778 // changes not to do this.
777 eviction_tiles_cache_.push_back(it->second); 779 eviction_tiles_cache_.push_back(it->second);
778 } 780 }
779 781
780 std::sort(eviction_tiles_cache_.begin(), 782 std::sort(eviction_tiles_cache_.begin(),
781 eviction_tiles_cache_.end(), 783 eviction_tiles_cache_.end(),
782 TileEvictionOrder(tree_priority)); 784 TileEvictionOrder(tree_priority));
783 eviction_tiles_cache_valid_ = true; 785 eviction_tiles_cache_valid_ = true;
784 eviction_cache_tree_priority_ = tree_priority; 786 eviction_cache_tree_priority_ = tree_priority;
(...skipping 26 matching lines...) Expand all
811 } 813 }
812 814
813 current_tile_ = 815 current_tile_ =
814 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y()); 816 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y());
815 if (!current_tile_ || !TileNeedsRaster(current_tile_)) 817 if (!current_tile_ || !TileNeedsRaster(current_tile_))
816 ++(*this); 818 ++(*this);
817 } 819 }
818 820
819 PictureLayerTiling::TilingRasterTileIterator::~TilingRasterTileIterator() {} 821 PictureLayerTiling::TilingRasterTileIterator::~TilingRasterTileIterator() {}
820 822
823 bool
824 PictureLayerTiling::TilingRasterTileIterator::HasTilesRequiredForActivation()
825 const {
826 if (!*this || get_type() != TilePriority::NOW)
827 return false;
828
829 for (TilingData::Iterator it = visible_iterator_; it; ++it) {
830 std::pair<int, int> next_index = visible_iterator_.index();
831 Tile* tile = tiling_->TileAt(next_index.first, next_index.second);
832 if (tile && tile->required_for_activation())
833 return true;
834 }
835 return false;
836 }
837
821 void PictureLayerTiling::TilingRasterTileIterator::AdvancePhase() { 838 void PictureLayerTiling::TilingRasterTileIterator::AdvancePhase() {
822 DCHECK_LT(type_, TilePriority::EVENTUALLY); 839 DCHECK_LT(type_, TilePriority::EVENTUALLY);
823 840
824 do { 841 do {
825 type_ = static_cast<TilePriority::PriorityBin>(type_ + 1); 842 type_ = static_cast<TilePriority::PriorityBin>(type_ + 1);
826 if (type_ == TilePriority::EVENTUALLY) { 843 if (type_ == TilePriority::EVENTUALLY) {
827 spiral_iterator_ = TilingData::SpiralDifferenceIterator( 844 spiral_iterator_ = TilingData::SpiralDifferenceIterator(
828 &tiling_->tiling_data_, 845 &tiling_->tiling_data_,
829 eventually_rect_in_content_space_, 846 eventually_rect_in_content_space_,
830 skewport_in_content_space_, 847 skewport_in_content_space_,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 tiling_->UpdateEvictionCacheIfNeeded(tree_priority_); 940 tiling_->UpdateEvictionCacheIfNeeded(tree_priority_);
924 tile_iterator_ = tiling_->eviction_tiles_cache_.begin(); 941 tile_iterator_ = tiling_->eviction_tiles_cache_.begin();
925 is_valid_ = true; 942 is_valid_ = true;
926 if (tile_iterator_ != tiling_->eviction_tiles_cache_.end() && 943 if (tile_iterator_ != tiling_->eviction_tiles_cache_.end() &&
927 !(*tile_iterator_)->HasResources()) { 944 !(*tile_iterator_)->HasResources()) {
928 ++(*this); 945 ++(*this);
929 } 946 }
930 } 947 }
931 948
932 } // namespace cc 949 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698