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

Unified Diff: cc/tiles/tile_manager.cc

Issue 2345833002: cc: Move (partially) the predecode image tracking to ImageManager. (Closed)
Patch Set: initialize var Created 4 years, 3 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') | no next file » | 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 20a29ad8d0297d68109bb7cf9ef835f0ae248bc2..4af4d6fd2e267554ad793ae2fdb19826a04a14d7 100644
--- a/cc/tiles/tile_manager.cc
+++ b/cc/tiles/tile_manager.cc
@@ -361,8 +361,7 @@ void TileManager::FinishTasksAndCleanUp() {
signals_check_notifier_.Cancel();
task_set_finished_weak_ptr_factory_.InvalidateWeakPtrs();
- image_manager_.UnrefImages(locked_images_);
- locked_images_.clear();
+ image_manager_.SetImageDecodeController(nullptr);
locked_image_tasks_.clear();
}
@@ -843,21 +842,25 @@ void TileManager::ScheduleTasks(
const std::vector<PrioritizedTile>& tiles_to_process_for_images =
work_to_schedule.tiles_to_process_for_images;
std::vector<DrawImage> new_locked_images;
- std::vector<scoped_refptr<TileTask>> new_locked_image_tasks;
for (const PrioritizedTile& prioritized_tile : tiles_to_process_for_images) {
Tile* tile = prioritized_tile.tile();
std::vector<DrawImage> images;
prioritized_tile.raster_source()->GetDiscardableImagesInRect(
tile->enclosing_layer_rect(), tile->contents_scale(), &images);
- ImageDecodeController::TracingInfo tracing_info(
- prepare_tiles_count_, prioritized_tile.priority().priority_bin);
- image_manager_.GetTasksForImagesAndRef(&images, &new_locked_image_tasks,
- tracing_info);
new_locked_images.insert(new_locked_images.end(), images.begin(),
images.end());
}
+ // TODO(vmpstr): SOON is misleading here, but these images can come from
+ // several diffent tiles. Rethink what we actually want to trace here. Note
+ // that I'm using SOON, since it can't be NOW (these are prepaint).
+ ImageDecodeController::TracingInfo tracing_info(prepare_tiles_count_,
+ TilePriority::SOON);
+ std::vector<scoped_refptr<TileTask>> new_locked_image_tasks =
+ image_manager_.SetPredecodeImages(std::move(new_locked_images),
+ tracing_info);
+
for (auto& task : new_locked_image_tasks) {
auto decode_it = std::find_if(graph_.nodes.begin(), graph_.nodes.end(),
[&task](const TaskGraph::Node& node) {
@@ -872,10 +875,11 @@ void TileManager::ScheduleTasks(
graph_.edges.push_back(TaskGraph::Edge(task.get(), all_done_task.get()));
}
- image_manager_.UnrefImages(locked_images_);
- // The old locked images have to stay around until past the ScheduleTasks call
- // below, so we do a swap instead of a move.
- locked_images_.swap(new_locked_images);
+ // The old locked images tasks have to stay around until past the
+ // ScheduleTasks call below, so we do a swap instead of a move.
+ // TODO(crbug.com/647402): Have the tile_task_manager keep a ref on the tasks,
+ // since it makes it awkward for the callers to keep refs on tasks that only
+ // exist within the task graph runner.
locked_image_tasks_.swap(new_locked_image_tasks);
// We must reduce the amount of unused resources before calling
@@ -994,8 +998,7 @@ void TileManager::OnRasterTaskCompleted(
// Unref all the images.
auto images_it = scheduled_draw_images_.find(tile->id());
- const std::vector<DrawImage>& images = images_it->second;
- image_manager_.UnrefImages(images);
+ image_manager_.UnrefImages(images_it->second);
scheduled_draw_images_.erase(images_it);
if (was_canceled) {
@@ -1145,8 +1148,8 @@ void TileManager::CheckIfMoreTilesNeedToBePrepared() {
// If we're not in SMOOTHNESS_TAKES_PRIORITY mode, we should unlock all
// images since we're technically going idle here at least for this frame.
if (global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY) {
- image_manager_.UnrefImages(locked_images_);
- locked_images_.clear();
+ image_manager_.SetPredecodeImages(std::vector<DrawImage>(),
+ ImageDecodeController::TracingInfo());
locked_image_tasks_.clear();
}
« no previous file with comments | « cc/tiles/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698