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

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

Issue 741683003: cc: Move LayerEvictionTileIterator to a separate file and make it a queue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years 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
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_perftest.cc » ('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/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 #include <set> 10 #include <set>
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 break; 1209 break;
1210 } 1210 }
1211 current_tile_ = tiling_->TileAt(next_index.first, next_index.second); 1211 current_tile_ = tiling_->TileAt(next_index.first, next_index.second);
1212 } 1212 }
1213 1213
1214 if (current_tile_) 1214 if (current_tile_)
1215 tiling_->UpdateTileAndTwinPriority(current_tile_); 1215 tiling_->UpdateTileAndTwinPriority(current_tile_);
1216 return *this; 1216 return *this;
1217 } 1217 }
1218 1218
1219 PictureLayerTiling::TilingEvictionTileIterator::TilingEvictionTileIterator()
1220 : eviction_tiles_(NULL), current_eviction_tiles_index_(0u) {
1221 }
1222
1223 PictureLayerTiling::TilingEvictionTileIterator::TilingEvictionTileIterator(
1224 PictureLayerTiling* tiling,
1225 TreePriority tree_priority,
1226 EvictionCategory category)
1227 : eviction_tiles_(tiling->GetEvictionTiles(tree_priority, category)),
1228 // Note: initializing to "0 - 1" works as overflow is well defined for
1229 // unsigned integers.
1230 current_eviction_tiles_index_(static_cast<size_t>(0) - 1) {
1231 DCHECK(eviction_tiles_);
1232 ++(*this);
1233 }
1234
1235 PictureLayerTiling::TilingEvictionTileIterator::~TilingEvictionTileIterator() {
1236 }
1237
1238 PictureLayerTiling::TilingEvictionTileIterator::operator bool() const {
1239 return eviction_tiles_ &&
1240 current_eviction_tiles_index_ != eviction_tiles_->size();
1241 }
1242
1243 Tile* PictureLayerTiling::TilingEvictionTileIterator::operator*() {
1244 DCHECK(*this);
1245 return (*eviction_tiles_)[current_eviction_tiles_index_];
1246 }
1247
1248 const Tile* PictureLayerTiling::TilingEvictionTileIterator::operator*() const {
1249 DCHECK(*this);
1250 return (*eviction_tiles_)[current_eviction_tiles_index_];
1251 }
1252
1253 PictureLayerTiling::TilingEvictionTileIterator&
1254 PictureLayerTiling::TilingEvictionTileIterator::
1255 operator++() {
1256 DCHECK(*this);
1257 do {
1258 ++current_eviction_tiles_index_;
1259 } while (current_eviction_tiles_index_ != eviction_tiles_->size() &&
1260 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources());
1261
1262 return *this;
1263 }
1264
1265 } // namespace cc 1219 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698