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

Unified Diff: chrome/browser/chromeos/extensions/wallpaper_api.cc

Issue 1989653002: [Retry] Fix the browser crash when changing wallpaper with chrome.wallpaper API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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 | « no previous file | chrome/test/data/extensions/api_test/wallpaper/test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/extensions/wallpaper_api.cc
diff --git a/chrome/browser/chromeos/extensions/wallpaper_api.cc b/chrome/browser/chromeos/extensions/wallpaper_api.cc
index 5d9ca11c19e7e6c39c31d068e044e33f868eacce..b7198e8162433471868f3165ff30427ddb465bec 100644
--- a/chrome/browser/chromeos/extensions/wallpaper_api.cc
+++ b/chrome/browser/chromeos/extensions/wallpaper_api.cc
@@ -229,15 +229,17 @@ void WallpaperSetWallpaperFunction::GenerateThumbnail(
void WallpaperSetWallpaperFunction::ThumbnailGenerated(
base::RefCountedBytes* original_data,
base::RefCountedBytes* thumbnail_data) {
- BinaryValue* original_result = BinaryValue::CreateWithCopiedBuffer(
- reinterpret_cast<const char*>(original_data->front()),
- original_data->size());
- BinaryValue* thumbnail_result = BinaryValue::CreateWithCopiedBuffer(
- reinterpret_cast<const char*>(thumbnail_data->front()),
- thumbnail_data->size());
+ std::unique_ptr<BinaryValue> original_result =
+ base::WrapUnique(BinaryValue::CreateWithCopiedBuffer(
+ reinterpret_cast<const char*>(original_data->front()),
+ original_data->size()));
+ std::unique_ptr<BinaryValue> thumbnail_result =
+ base::WrapUnique(BinaryValue::CreateWithCopiedBuffer(
+ reinterpret_cast<const char*>(thumbnail_data->front()),
+ thumbnail_data->size()));
if (params_->details.thumbnail) {
- SetResult(base::WrapUnique(thumbnail_result));
+ SetResult(base::WrapUnique(thumbnail_result->DeepCopy()));
SendResponse(true);
}
@@ -248,8 +250,8 @@ void WallpaperSetWallpaperFunction::ThumbnailGenerated(
extensions::EventRouter* event_router =
extensions::EventRouter::Get(profile);
std::unique_ptr<base::ListValue> event_args(new base::ListValue());
- event_args->Append(original_result);
- event_args->Append(thumbnail_result);
+ event_args->Append(original_result->DeepCopy());
+ event_args->Append(thumbnail_result->DeepCopy());
event_args->Append(new base::StringValue(
extensions::api::wallpaper::ToString(params_->details.layout)));
// Setting wallpaper from right click menu in 'Files' app is a feature that
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/wallpaper/test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698