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

Unified Diff: cc/tiles/image_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/image_manager.h ('k') | cc/tiles/image_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/image_manager.cc
diff --git a/cc/tiles/image_manager.cc b/cc/tiles/image_manager.cc
index cb11e9ec19266ae01c1577b07fb3b2dfe7e13996..bec8ca2061ea084d92011d83ff288683883c92d1 100644
--- a/cc/tiles/image_manager.cc
+++ b/cc/tiles/image_manager.cc
@@ -10,6 +10,14 @@ ImageManager::ImageManager() = default;
ImageManager::~ImageManager() = default;
void ImageManager::SetImageDecodeController(ImageDecodeController* controller) {
+ // We can only switch from null to non-null and back.
+ DCHECK(controller || controller_);
+ DCHECK(!controller || !controller_);
+
+ if (!controller) {
+ SetPredecodeImages(std::vector<DrawImage>(),
+ ImageDecodeController::TracingInfo());
+ }
controller_ = controller;
}
@@ -43,4 +51,14 @@ void ImageManager::ReduceMemoryUsage() {
controller_->ReduceCacheUsage();
}
+std::vector<scoped_refptr<TileTask>> ImageManager::SetPredecodeImages(
+ std::vector<DrawImage> images,
+ const ImageDecodeController::TracingInfo& tracing_info) {
+ std::vector<scoped_refptr<TileTask>> new_tasks;
+ GetTasksForImagesAndRef(&images, &new_tasks, tracing_info);
+ UnrefImages(predecode_locked_images_);
+ predecode_locked_images_ = std::move(images);
+ return new_tasks;
+}
+
} // namespace cc
« no previous file with comments | « cc/tiles/image_manager.h ('k') | cc/tiles/image_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698