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

Unified Diff: cc/resources/tile_manager.cc

Issue 1069493003: cc: Optimize TileManager::CleanUpReleasedTiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/tile_manager.cc
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc
index 5d183ae55290c5ef6909462f62c34fe3225d2b55..1e3c132ab646e4078f458dcc236dfe711f34723b 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -277,12 +277,10 @@ void TileManager::FreeResourcesForReleasedTiles() {
}
void TileManager::CleanUpReleasedTiles() {
- std::vector<Tile*>::iterator it = released_tiles_.begin();
- while (it != released_tiles_.end()) {
- Tile* tile = *it;
-
+ std::vector<Tile*> tiles_to_retain;
enne (OOO) 2015/04/07 23:04:48 Should you reserve this to be the number of tiles
vmpstr 2015/04/07 23:10:23 I'm not sure it's worth it, since the number of ti
+ for (auto* tile : released_tiles_) {
if (tile->HasRasterTask()) {
- ++it;
+ tiles_to_retain.push_back(tile);
continue;
}
@@ -299,8 +297,8 @@ void TileManager::CleanUpReleasedTiles() {
}
delete tile;
- it = released_tiles_.erase(it);
}
+ released_tiles_.swap(tiles_to_retain);
}
void TileManager::DidFinishRunningTileTasks(TaskSet task_set) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698