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

Unified Diff: cc/tiles/tile_manager.cc

Issue 1998393002: (reland) cc: Cleanup tile manager a bit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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/tiles/tile_manager.h ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/tile_manager.cc
diff --git a/cc/tiles/tile_manager.cc b/cc/tiles/tile_manager.cc
index 8d0c6c73c5aa659076c3d0888651d16ae8b8a897..4ddcf570ff5f639d433b7d9beb7c0c11913e1214 100644
--- a/cc/tiles/tile_manager.cc
+++ b/cc/tiles/tile_manager.cc
@@ -304,19 +304,6 @@ RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats) {
return std::move(state);
}
-// static
-std::unique_ptr<TileManager> TileManager::Create(
- TileManagerClient* client,
- base::SequencedTaskRunner* task_runner,
- size_t scheduled_raster_task_limit,
- bool use_partial_raster) {
- // TODO(vmpstr): |task_runner| is a raw pointer that is implicitly converted
- // into a scoped_refptr. Figure out whether to plumb a ref pointer or whether
- // tile manager can have a non-owning pointer and fix.
- return base::WrapUnique(new TileManager(
- client, task_runner, scheduled_raster_task_limit, use_partial_raster));
-}
-
TileManager::TileManager(TileManagerClient* client,
scoped_refptr<base::SequencedTaskRunner> task_runner,
size_t scheduled_raster_task_limit,
@@ -481,13 +468,8 @@ bool TileManager::PrepareTiles(
FreeResourcesForReleasedTiles();
CleanUpReleasedTiles();
- PrioritizedTileVector tiles_that_need_to_be_rasterized;
- std::unique_ptr<RasterTilePriorityQueue> raster_priority_queue(
- client_->BuildRasterQueue(global_state_.tree_priority,
- RasterTilePriorityQueue::Type::ALL));
- AssignGpuMemoryToTiles(raster_priority_queue.get(),
- scheduled_raster_task_limit_,
- &tiles_that_need_to_be_rasterized);
+ std::vector<PrioritizedTile> tiles_that_need_to_be_rasterized =
+ AssignGpuMemoryToTiles();
// Inform the client that will likely require a draw if the highest priority
// tile that will be rasterized is required for draw.
@@ -600,10 +582,7 @@ bool TileManager::TilePriorityViolatesMemoryPolicy(
return true;
}
-void TileManager::AssignGpuMemoryToTiles(
- RasterTilePriorityQueue* raster_priority_queue,
- size_t scheduled_raster_task_limit,
- PrioritizedTileVector* tiles_that_need_to_be_rasterized) {
+std::vector<PrioritizedTile> TileManager::AssignGpuMemoryToTiles() {
TRACE_EVENT_BEGIN0("cc", "TileManager::AssignGpuMemoryToTiles");
DCHECK(resource_pool_);
@@ -628,7 +607,11 @@ void TileManager::AssignGpuMemoryToTiles(
MemoryUsage memory_usage(resource_pool_->memory_usage_bytes(),
resource_pool_->resource_count());
+ std::unique_ptr<RasterTilePriorityQueue> raster_priority_queue(
+ client_->BuildRasterQueue(global_state_.tree_priority,
+ RasterTilePriorityQueue::Type::ALL));
std::unique_ptr<EvictionTilePriorityQueue> eviction_priority_queue;
+ std::vector<PrioritizedTile> tiles_that_need_to_be_rasterized;
for (; !raster_priority_queue->IsEmpty(); raster_priority_queue->Pop()) {
const PrioritizedTile& prioritized_tile = raster_priority_queue->Top();
Tile* tile = prioritized_tile.tile();
@@ -662,8 +645,8 @@ void TileManager::AssignGpuMemoryToTiles(
}
// We won't be able to schedule this tile, so break out early.
- if (tiles_that_need_to_be_rasterized->size() >=
- scheduled_raster_task_limit) {
+ if (tiles_that_need_to_be_rasterized.size() >=
+ scheduled_raster_task_limit_) {
all_tiles_that_need_to_be_rasterized_are_scheduled_ = false;
break;
}
@@ -707,7 +690,7 @@ void TileManager::AssignGpuMemoryToTiles(
}
memory_usage += memory_required_by_tile_to_be_scheduled;
- tiles_that_need_to_be_rasterized->push_back(prioritized_tile);
+ tiles_that_need_to_be_rasterized.push_back(prioritized_tile);
// Since we scheduled the tile, set whether it was a prepaint or not
// assuming that the tile will successfully finish running. We don't have
@@ -739,6 +722,7 @@ void TileManager::AssignGpuMemoryToTiles(
all_tiles_that_need_to_be_rasterized_are_scheduled_,
"had_enough_memory_to_schedule_tiles_needed_now",
had_enough_memory_to_schedule_tiles_needed_now);
+ return tiles_that_need_to_be_rasterized;
}
void TileManager::FreeResourcesForTile(Tile* tile) {
@@ -758,7 +742,7 @@ void TileManager::FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(
}
void TileManager::ScheduleTasks(
- const PrioritizedTileVector& tiles_that_need_to_be_rasterized) {
+ const std::vector<PrioritizedTile>& tiles_that_need_to_be_rasterized) {
TRACE_EVENT1("cc", "TileManager::ScheduleTasks", "count",
tiles_that_need_to_be_rasterized.size());
@@ -1085,13 +1069,8 @@ void TileManager::CheckIfMoreTilesNeedToBePrepared() {
// When OOM, keep re-assigning memory until we reach a steady state
// where top-priority tiles are initialized.
- PrioritizedTileVector tiles_that_need_to_be_rasterized;
- std::unique_ptr<RasterTilePriorityQueue> raster_priority_queue(
- client_->BuildRasterQueue(global_state_.tree_priority,
- RasterTilePriorityQueue::Type::ALL));
- AssignGpuMemoryToTiles(raster_priority_queue.get(),
- scheduled_raster_task_limit_,
- &tiles_that_need_to_be_rasterized);
+ std::vector<PrioritizedTile> tiles_that_need_to_be_rasterized =
+ AssignGpuMemoryToTiles();
// Inform the client that will likely require a draw if the highest priority
// tile that will be rasterized is required for draw.
« no previous file with comments | « cc/tiles/tile_manager.h ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698