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

Unified Diff: cc/resources/tile_manager.cc

Issue 366113002: cc: Do not cleanup tiles with raster tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup after checkforcompletedtasks Created 6 years, 5 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 | « cc/resources/tile_manager.h ('k') | 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 d508f6a0a17a5639290949fb9cf083eb4ffb6e10..3d84f1e02eb9556cedabcbba791e673835c42d6e 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -389,18 +389,16 @@ TileManager::~TileManager() {
// our memory usage to drop to zero.
global_state_ = GlobalStateThatImpactsTilePriority();
- CleanUpReleasedTiles();
- DCHECK_EQ(0u, tiles_.size());
-
RasterTaskQueue empty;
rasterizer_->ScheduleTasks(&empty);
- orphan_raster_tasks_.clear();
// This should finish all pending tasks and release any uninitialized
// resources.
rasterizer_->Shutdown();
rasterizer_->CheckForCompletedTasks();
+ CleanUpReleasedTiles();
+
DCHECK_EQ(0u, bytes_releasable_);
DCHECK_EQ(0u, resources_releasable_);
}
@@ -419,15 +417,21 @@ bool TileManager::ShouldForceTasksRequiredForActivationToComplete() const {
}
void TileManager::CleanUpReleasedTiles() {
- for (std::vector<Tile*>::iterator it = released_tiles_.begin();
- it != released_tiles_.end();
- ++it) {
+ std::vector<Tile*>::iterator it = released_tiles_.begin();
+ while (it != released_tiles_.end()) {
Tile* tile = *it;
ManagedTileState& mts = tile->managed_state();
+ bool tile_has_raster_task = false;
for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) {
FreeResourceForTile(tile, static_cast<RasterMode>(mode));
reveman 2014/07/09 14:15:30 What's the difference between this and only releas
sohanjg 2014/07/09 14:32:11 Hmm, 1 thing could be we optimize resource usage (
vmpstr 2014/07/09 18:41:21 I think at this point the tile is set to be delete
reveman 2014/07/09 20:09:43 Maybe we should make this a bit more explicit by a
vmpstr 2014/07/09 23:15:14 That sounds good to me.
sohanjg 2014/07/10 13:29:45 Done.
- orphan_raster_tasks_.push_back(mts.tile_versions[mode].raster_task_);
+ if (mts.tile_versions[mode].raster_task_)
+ tile_has_raster_task = true;
+ }
+
+ if (tile_has_raster_task) {
+ ++it;
+ continue;
}
DCHECK(tiles_.find(tile->id()) != tiles_.end());
vmpstr 2014/07/09 23:15:14 Sorry to backtrack a bit. My previous comment alre
reveman 2014/07/10 11:23:03 I prefer to keep it in |tiles_| and change the "it
sohanjg 2014/07/10 13:29:45 Done.
@@ -442,9 +446,8 @@ void TileManager::CleanUpReleasedTiles() {
}
delete tile;
+ it = released_tiles_.erase(it);
}
-
- released_tiles_.clear();
}
void TileManager::UpdatePrioritizedTileSetIfNeeded() {
@@ -970,11 +973,6 @@ void TileManager::ScheduleTasks(
// in |raster_tasks_|.
rasterizer_->ScheduleTasks(&raster_queue_);
- // It's now safe to clean up orphan tasks as raster worker pool is not
- // allowed to keep around unreferenced raster tasks after ScheduleTasks() has
- // been called.
- orphan_raster_tasks_.clear();
-
did_check_for_completed_tasks_since_last_schedule_tasks_ = false;
}
@@ -1078,8 +1076,6 @@ void TileManager::OnRasterTaskCompleted(
Tile* tile = it->second;
ManagedTileState& mts = tile->managed_state();
ManagedTileState::TileVersion& tile_version = mts.tile_versions[raster_mode];
- DCHECK(tile_version.raster_task_);
- orphan_raster_tasks_.push_back(tile_version.raster_task_);
tile_version.raster_task_ = NULL;
if (was_canceled) {
« no previous file with comments | « cc/resources/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698