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

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: comment format 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
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() {

Powered by Google App Engine
This is Rietveld 408576698