Index: chrome/browser/chromeos/extensions/wallpaper_private_api.cc |
diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc |
index 08fd8aa9f5aef85aadd6c8d13a61cd186cbec4ab..fb3f871a9bfcb477be38c294c792b983e683a9fb 100644 |
--- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc |
+++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc |
@@ -286,10 +286,14 @@ void WallpaperSetWallpaperFunction::SaveToFile() { |
if (file_util::PathExists(file_path) || |
file_util::WriteFile(file_path, image_data_.c_str(), |
image_data_.size()) != -1 ) { |
+ wallpaper_.EnsureRepsForSupportedScaleFactors(); |
+ scoped_ptr<gfx::ImageSkia> deep_copy(wallpaper_.DeepCopy()); |
+ // ImageSkia is not RefCountedThreadSafe. Use a deep copied ImageSkia if |
+ // post to another thread. |
oshima
2012/11/12 16:39:28
I think you don't have to do this IF you make
wall
bshe
2012/11/12 19:12:48
I may understand this wrong. But it looks to me th
oshima
2012/11/13 17:46:42
I see, you're right.
|
BrowserThread::PostTask( |
BrowserThread::UI, FROM_HERE, |
base::Bind(&WallpaperSetWallpaperFunction::SetDecodedWallpaper, |
- this)); |
+ this, base::Passed(&deep_copy))); |
chromeos::UserImage wallpaper(wallpaper_); |
// Generates and saves small resolution wallpaper. Uses CENTER_CROPPED to |
@@ -309,10 +313,11 @@ void WallpaperSetWallpaperFunction::SaveToFile() { |
} |
} |
-void WallpaperSetWallpaperFunction::SetDecodedWallpaper() { |
+void WallpaperSetWallpaperFunction::SetDecodedWallpaper( |
+ scoped_ptr<gfx::ImageSkia> wallpaper) { |
chromeos::WallpaperManager* wallpaper_manager = |
chromeos::WallpaperManager::Get(); |
- wallpaper_manager->SetWallpaperFromImageSkia(wallpaper_, layout_); |
+ wallpaper_manager->SetWallpaperFromImageSkia(*wallpaper.get(), layout_); |
bool is_persistent = |
!chromeos::UserManager::Get()->IsCurrentUserEphemeral(); |
chromeos::WallpaperInfo info = { |