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

Unified Diff: cc/resources/tile_manager.cc

Issue 1035043002: cc: Fix memory limit edge cases for SetIsLikelyToRequireADraw. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 71f2e83017547d2aa9131b37c619bf8bee749041..b86b1a0d66396ba3bbe85aa5daec8761d971723e 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -426,6 +426,11 @@ void TileManager::SynchronouslyRasterizeTiles(
std::numeric_limits<size_t>::max(),
&tiles_that_need_to_be_rasterized);
+ // Since we are synchronously rasterizing all tiles, we don't require further
+ // draws for that. Set the flag to false so that we can clear it if it was set
+ // earlier by PrepareTiles.
+ client_->SetIsLikelyToRequireADraw(false);
vmpstr 2015/03/27 17:23:28 Just FYI, this function is kind of slated for remo
sunnyps 2015/03/27 18:38:04 Yeah, would be nice to keep the test while it's al
+
// We must reduce the amount of unused resources before calling
// RunTasks to prevent usage from rising above limits.
resource_pool_->ReduceResourceUsage();
@@ -876,6 +881,10 @@ void TileManager::SetTileTaskRunnerForTesting(
tile_task_runner_->SetClient(this);
}
+void TileManager::CheckIfMoreTilesNeedToBePreparedForTesting() {
+ CheckIfMoreTilesNeedToBePrepared();
vmpstr 2015/03/27 17:23:28 Feel free to inline this. (We don't typically impl
sunnyps 2015/03/27 18:38:04 Done.
+}
+
bool TileManager::AreRequiredTilesReadyToDraw(
RasterTilePriorityQueue::Type type) const {
scoped_ptr<RasterTilePriorityQueue> raster_priority_queue(
@@ -961,6 +970,12 @@ void TileManager::CheckIfMoreTilesNeedToBePrepared() {
scheduled_raster_task_limit_,
&tiles_that_need_to_be_rasterized);
+ // Inform the client that will likely require a draw if the highest priority
+ // tile that will be rasterized is required for draw.
+ client_->SetIsLikelyToRequireADraw(
+ !tiles_that_need_to_be_rasterized.empty() &&
+ (*tiles_that_need_to_be_rasterized.begin())->required_for_draw());
+
// |tiles_that_need_to_be_rasterized| will be empty when we reach a
// steady memory state. Keep scheduling tasks until we reach this state.
if (!tiles_that_need_to_be_rasterized.empty()) {

Powered by Google App Engine
This is Rietveld 408576698