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

Unified Diff: components/wallpaper/wallpaper_manager_base.cc

Issue 1794323003: Make user_manager::UserImage non-copyable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just rebase Created 4 years, 8 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 | « components/wallpaper/wallpaper_manager_base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/wallpaper/wallpaper_manager_base.cc
diff --git a/components/wallpaper/wallpaper_manager_base.cc b/components/wallpaper/wallpaper_manager_base.cc
index eabe252ce15513904e4be916b8a2d43443692cf6..a1538c46ecbd2d27903dc62fb59c74226f4b072b 100644
--- a/components/wallpaper/wallpaper_manager_base.cc
+++ b/components/wallpaper/wallpaper_manager_base.cc
@@ -910,17 +910,19 @@ base::TimeDelta WallpaperManagerBase::GetWallpaperLoadDelay() const {
void WallpaperManagerBase::OnCustomizedDefaultWallpaperDecoded(
const GURL& wallpaper_url,
scoped_ptr<CustomizedWallpaperRescaledFiles> rescaled_files,
- const user_manager::UserImage& wallpaper) {
+ scoped_ptr<user_manager::UserImage> wallpaper) {
DCHECK(thread_checker_.CalledOnValidThread());
// If decoded wallpaper is empty, we have probably failed to decode the file.
- if (wallpaper.image().isNull()) {
+ if (wallpaper->image().isNull()) {
LOG(WARNING) << "Failed to decode customized wallpaper.";
return;
}
- wallpaper.image().EnsureRepsForSupportedScales();
- scoped_ptr<gfx::ImageSkia> deep_copy(wallpaper.image().DeepCopy());
+ wallpaper->image().EnsureRepsForSupportedScales();
+ // TODO(crbug.com/593251): DeepCopy() may be unnecessary as this function
+ // owns |wallpaper| as scoped_ptr whereas it used to be a const reference.
+ scoped_ptr<gfx::ImageSkia> deep_copy(wallpaper->image().DeepCopy());
scoped_ptr<bool> success(new bool(false));
scoped_ptr<gfx::ImageSkia> small_wallpaper_image(new gfx::ImageSkia);
@@ -929,7 +931,8 @@ void WallpaperManagerBase::OnCustomizedDefaultWallpaperDecoded(
// TODO(bshe): This may break if Bytes becomes RefCountedMemory.
base::Closure resize_closure = base::Bind(
&WallpaperManagerBase::ResizeCustomizedDefaultWallpaper,
- base::Passed(&deep_copy), wallpaper.image_bytes(),
+ // TODO(crbug.com/593251): Remove the data copy via image_bytes().
+ base::Passed(&deep_copy), wallpaper->image_bytes(),
base::Unretained(rescaled_files.get()), base::Unretained(success.get()),
base::Unretained(small_wallpaper_image.get()),
base::Unretained(large_wallpaper_image.get()));
« no previous file with comments | « components/wallpaper/wallpaper_manager_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698