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

Unified Diff: cc/resources/tile_manager.cc

Issue 895853003: Update from https://crrev.com/314320 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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 da888cd77297c66a19ba39bc84425ce3abe040f4..2b247aa20856e22a2ba12b321ce0d3dd6f2e9d7c 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -362,6 +362,11 @@ void TileManager::PrepareTiles(
scoped_ptr<RasterTilePriorityQueue> raster_priority_queue(
client_->BuildRasterQueue(global_state_.tree_priority,
RasterTilePriorityQueue::Type::ALL));
+ // Inform the client that will likely require a draw if the top tile is
+ // required for draw.
+ client_->SetIsLikelyToRequireADraw(
+ !raster_priority_queue->IsEmpty() &&
+ raster_priority_queue->Top()->required_for_draw());
AssignGpuMemoryToTiles(raster_priority_queue.get(),
scheduled_raster_task_limit_,
&tiles_that_need_to_be_rasterized);
@@ -830,8 +835,10 @@ void TileManager::UpdateTileDrawInfo(
if (analysis.is_solid_color) {
draw_info.set_solid_color(analysis.solid_color);
- resource_pool_->ReleaseResource(resource.Pass());
+ if (resource)
+ resource_pool_->ReleaseResource(resource.Pass());
} else {
+ DCHECK(resource);
draw_info.set_use_resource();
draw_info.resource_ = resource.Pass();
}
@@ -863,31 +870,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