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

Unified Diff: chrome/browser/chromeos/login/wallpaper_manager.cc

Issue 11361131: Pass the ImageSkia by pointer instead of by reference, which will create shallow copy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win_aura Created 8 years, 1 month 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 | « chrome/browser/chromeos/login/wallpaper_manager.h ('k') | chrome/browser/ui/metro_pin_tab_helper_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/wallpaper_manager.cc
diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc
index 12df7fc872c7481f34d685fb28890f0ebb65a8f9..1c00baadf672b4e38ea9f5aab2116d6f34107938 100644
--- a/chrome/browser/chromeos/login/wallpaper_manager.cc
+++ b/chrome/browser/chromeos/login/wallpaper_manager.cc
@@ -737,9 +737,10 @@ void WallpaperManager::CacheUserWallpaper(const std::string& email) {
}
void WallpaperManager::CacheThumbnail(const std::string& email,
- const gfx::ImageSkia& wallpaper) {
+ scoped_ptr<gfx::ImageSkia> wallpaper) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- custom_wallpaper_thumbnail_cache_[email] = GetWallpaperThumbnail(wallpaper);
+ custom_wallpaper_thumbnail_cache_[email] =
+ GetWallpaperThumbnail(*wallpaper.get());
}
void WallpaperManager::DeleteWallpaperInList(
@@ -1083,13 +1084,16 @@ void WallpaperManager::OnWallpaperDecoded(const std::string& email,
}
return;
}
+ // Generate all reps before passing to another thread.
+ wallpaper.image().EnsureRepsForSupportedScaleFactors();
+ scoped_ptr<gfx::ImageSkia> deep_copy(wallpaper.image().DeepCopy());
BrowserThread::PostTask(
BrowserThread::FILE,
FROM_HERE,
base::Bind(&WallpaperManager::CacheThumbnail,
base::Unretained(this), email,
- wallpaper.image().DeepCopy()));
+ base::Passed(&deep_copy)));
// Only cache user wallpaper at login screen.
if (!UserManager::Get()->IsUserLoggedIn()) {
wallpaper_cache_.insert(std::make_pair(email, wallpaper.image()));
« no previous file with comments | « chrome/browser/chromeos/login/wallpaper_manager.h ('k') | chrome/browser/ui/metro_pin_tab_helper_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698