Chromium Code Reviews| Index: cc/resources/tile_manager.cc |
| diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc |
| index f9fafbbca09b5943bf4a63a516f153181802e3c0..d051f35ec9331c4d8443611d78e94a20d5442bdf 100644 |
| --- a/cc/resources/tile_manager.cc |
| +++ b/cc/resources/tile_manager.cc |
| @@ -675,7 +675,8 @@ void TileManager::GetTilesWithAssignedBins(PrioritizedTileSet* tiles) { |
| // should keep it in the prioritized tile set to ensure that AssignGpuMemory |
| // can visit it. |
| if (mts.bin == NEVER_BIN && |
| - !mts.tile_versions[mts.raster_mode].raster_task_) { |
| + !mts.tile_versions[mts.raster_mode].raster_task_ && |
| + !tile->required_for_activation()) { |
|
reveman
2014/04/25 20:44:08
hm, is this really correct? should we not be able
vmpstr
2014/04/25 22:09:52
Yeah that's true, but the problem is that with thi
reveman
2014/04/25 22:23:59
Ok, thanks for explaining.
|
| FreeResourcesForTile(tile); |
| continue; |
| } |
| @@ -840,6 +841,7 @@ void TileManager::AssignGpuMemoryToTiles( |
| size_t max_raster_bytes = max_raster_usage_bytes_ / 2; |
| size_t raster_bytes = 0; |
| + size_t required_for_activation_processed_count = 0u; |
| unsigned schedule_priority = 1u; |
| for (PrioritizedTileSet::Iterator it(tiles, true); it; ++it) { |
| Tile* tile = *it; |
| @@ -859,6 +861,8 @@ void TileManager::AssignGpuMemoryToTiles( |
| // If the tile is not needed, free it up. |
| if (mts.bin == NEVER_BIN) { |
| FreeResourcesForTile(tile); |
| + if (tile->required_for_activation()) |
| + ++required_for_activation_processed_count; |
| continue; |
| } |
| @@ -917,8 +921,10 @@ void TileManager::AssignGpuMemoryToTiles( |
| hard_bytes_left -= tile_bytes; |
| soft_bytes_left = |
| (soft_bytes_left > tile_bytes) ? soft_bytes_left - tile_bytes : 0; |
| - if (tile_version.resource_) |
| + if (tile_version.resource_) { |
| + DCHECK(tile->IsReadyToDraw()); |
| continue; |
| + } |
| } |
| DCHECK(!tile_version.resource_); |
| @@ -937,16 +943,30 @@ void TileManager::AssignGpuMemoryToTiles( |
| if (!can_schedule_tile) { |
| all_tiles_that_need_to_be_rasterized_have_memory_ = false; |
| - if (tile->required_for_activation()) |
| - all_tiles_required_for_activation_have_memory_ = false; |
| it.DisablePriorityOrdering(); |
| continue; |
| } |
| raster_bytes = raster_bytes_if_rastered; |
| tiles_that_need_to_be_rasterized->push_back(tile); |
| + if (tile->required_for_activation()) |
| + ++required_for_activation_processed_count; |
| } |
| + size_t total_required_for_activation_tile_count = 0; |
| + for (std::vector<PictureLayerImpl*>::const_iterator it = layers_.begin(); |
| + it != layers_.end(); |
| + ++it) { |
| + if ((*it)->IsOnActiveOrPendingTree()) { |
| + total_required_for_activation_tile_count += |
| + (*it)->RequiredForActivationTileNeedsRasterCount(); |
| + } |
| + } |
| + |
| + all_tiles_required_for_activation_have_memory_ = |
| + required_for_activation_processed_count == |
| + total_required_for_activation_tile_count; |
| + |
| // OOM reporting uses hard-limit, soft-OOM is normal depending on limit. |
| ever_exceeded_memory_budget_ |= oomed_hard; |
| if (ever_exceeded_memory_budget_) { |
| @@ -1199,6 +1219,8 @@ void TileManager::OnRasterTaskCompleted( |
| ++resources_releasable_; |
| } |
| + client_->NotifyTileInitialized(tile); |
| + |
| FreeUnusedResourcesForTile(tile); |
| if (tile->priority(ACTIVE_TREE).distance_to_visible == 0.f) |
| did_initialize_visible_tile_ = true; |