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

Unified Diff: cc/resources/tile_manager.cc

Issue 868803002: cc: Change the activation/ready for draw check from layer to queue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 years, 11 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') | cc/resources/tile_manager_unittest.cc » ('j') | 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 5cb149de9ce4a807d533a8cf25399aff6504c807..9871acc18e884ce1c27cc7489356753d87f9bb6d 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -865,31 +865,31 @@ 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));
+ // It is insufficient to check whether the raster queue we constructed is
+ // empty. The reason for this is that there are situations (rasterize on
+ // demand) when the tile both needs raster and it's ready to draw. Hence, we
+ // have to iterate the queue to check whether the required tiles are 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() {
« no previous file with comments | « cc/resources/tile_manager.h ('k') | cc/resources/tile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698