Chromium Code Reviews| Index: cc/resources/tile_manager.cc |
| diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc |
| index f5c61f3d6e33b7d97e086e47730889a61576fd1e..cea38891502ffd619f4c8b9e9997d8a388699286 100644 |
| --- a/cc/resources/tile_manager.cc |
| +++ b/cc/resources/tile_manager.cc |
| @@ -862,31 +862,30 @@ void TileManager::SetTileTaskRunnerForTesting( |
| tile_task_runner_->SetClient(this); |
| } |
| -bool TileManager::IsReadyToActivate() const { |
| - TRACE_EVENT0("cc", "TileManager::IsReadyToActivate"); |
| - const std::vector<PictureLayerImpl*>& layers = client_->GetPictureLayers(); |
| - |
| - // TODO(vmpstr): Replace this with building a REQUIRED_TO_ACTIVATE raster |
| - // queue and checking if the tiles it contains are all ready to draw. |
| - for (const auto& layer : layers) { |
| - if (!layer->AllTilesRequiredForActivationAreReadyToDraw()) |
| +bool TileManager::AreRequiredTilesReadyToDraw( |
| + RasterTilePriorityQueue::Type type) const { |
| + scoped_ptr<RasterTilePriorityQueue> raster_priority_queue( |
| + client_->BuildRasterQueue(global_state_.tree_priority, type)); |
| + // The queue returns tiles that need raster. However, if the tiles were marked |
| + // as rasterize on demand, they might already be ready to draw, which is the |
| + // check we really want. Hence, we need to iterate the tiles and only return |
|
danakj
2015/01/28 00:48:18
ITYM this to explain why we're checking IsReadyToD
vmpstr
2015/01/28 19:51:17
I'm just trying to convey the fact that we still n
|
| + // false if at least one of them is not ready to draw. |
| + for (; !raster_priority_queue->IsEmpty(); raster_priority_queue->Pop()) { |
| + if (!raster_priority_queue->Top()->IsReadyToDraw()) |
| return false; |
| } |
| - |
| return true; |
| } |
| +bool TileManager::IsReadyToActivate() const { |
| + TRACE_EVENT0("cc", "TileManager::IsReadyToActivate"); |
| + return AreRequiredTilesReadyToDraw( |
| + RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION); |
| +} |
| bool TileManager::IsReadyToDraw() const { |
| - const std::vector<PictureLayerImpl*>& layers = client_->GetPictureLayers(); |
| - |
| - // TODO(vmpstr): Replace this with building a REQUIRED_TO_DRAW raster queue |
| - // and checking if the tiles it contains are all ready to draw. |
| - for (const auto& layer : layers) { |
| - if (!layer->AllTilesRequiredForDrawAreReadyToDraw()) |
| - return false; |
| - } |
| - |
| - return true; |
| + TRACE_EVENT0("cc", "TileManager::IsReadyToDraw"); |
| + return AreRequiredTilesReadyToDraw( |
| + RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); |
| } |
| void TileManager::NotifyReadyToActivate() { |