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

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

Issue 10820049: Load 2x resources on demand (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For preview Created 8 years, 4 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
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 2b03b28172f48a0ecc062993ab8f91174efb5cb7..8229d6311d4c04f54b8445be5e4a4f56255c5fc5 100644
--- a/chrome/browser/chromeos/login/wallpaper_manager.cc
+++ b/chrome/browser/chromeos/login/wallpaper_manager.cc
@@ -72,14 +72,8 @@ gfx::ImageSkia GetWallpaperThumbnail(const gfx::ImageSkia& wallpaper) {
skia::ImageOperations::RESIZE_LANCZOS3,
gfx::Size(kThumbnailWidth, kThumbnailHeight));
- // Ideally, this would call thumbnail.GetRepresentations(). But since that
- // isn't exposed on non-mac yet, we have to do this here.
- std::vector<ui::ScaleFactor> scales = ui::GetSupportedScaleFactors();
- for (size_t i = 0; i < scales.size(); ++i) {
- if (wallpaper.HasRepresentation(scales[i]))
- thumbnail.GetRepresentation(scales[i]);
- }
-
+ thumbnail.EnsureRepsForSupportedScaleFactors();
+ thumbnail.SetReadOnly();
return thumbnail;
}
@@ -90,6 +84,7 @@ gfx::ImageSkia ImageSkiaDeepCopy(const gfx::ImageSkia& image) {
iter != reps.end(); ++iter) {
copy.AddRepresentation(*iter);
}
+ copy.SetReadOnly();
return copy;
}
@@ -191,7 +186,7 @@ gfx::ImageSkia WallpaperManager::GetCustomWallpaperThumbnail(
const std::string& email) {
CustomWallpaperMap::const_iterator it =
custom_wallpaper_thumbnail_cache_.find(email);
- if (it != custom_wallpaper_cache_.end())
+ if (it != custom_wallpaper_thumbnail_cache_.end())
return (*it).second;
else
return gfx::ImageSkia();
@@ -529,13 +524,12 @@ void WallpaperManager::CacheWallpaper(const std::string& email,
const UserImage& wallpaper) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(custom_wallpaper_cache_.find(email) == custom_wallpaper_cache_.end());
-
BrowserThread::PostTask(
BrowserThread::FILE,
FROM_HERE,
base::Bind(&WallpaperManager::CacheThumbnail,
base::Unretained(this), email,
- ImageSkiaDeepCopy(wallpaper.image())));
+ wallpaper.image().DeepCopy()));
custom_wallpaper_cache_.insert(std::make_pair(email, wallpaper.image()));
}
@@ -550,13 +544,12 @@ void WallpaperManager::FetchWallpaper(const std::string& email,
ash::WallpaperLayout layout,
const UserImage& wallpaper) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
BrowserThread::PostTask(
BrowserThread::FILE,
FROM_HERE,
base::Bind(&WallpaperManager::CacheThumbnail,
base::Unretained(this), email,
- ImageSkiaDeepCopy(wallpaper.image())));
+ wallpaper.image().DeepCopy()));
custom_wallpaper_cache_.insert(std::make_pair(email, wallpaper.image()));
ash::Shell::GetInstance()->desktop_background_controller()->

Powered by Google App Engine
This is Rietveld 408576698