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

Unified Diff: components/suggestions/image_encoder_ios.mm

Issue 1879443002: JPEG decoding: replace ownership comments with std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fixes 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/suggestions/image_encoder.cc ('k') | printing/emf_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/suggestions/image_encoder_ios.mm
diff --git a/components/suggestions/image_encoder_ios.mm b/components/suggestions/image_encoder_ios.mm
index 9c27a3ec1ee29daeebe9357deb087830cf0c4176..1fe64d056eac753738b884a21898e5b594ec4d9a 100644
--- a/components/suggestions/image_encoder_ios.mm
+++ b/components/suggestions/image_encoder_ios.mm
@@ -8,15 +8,17 @@
#import <UIKit/UIKit.h>
#include "base/mac/scoped_cftyperef.h"
+#include "base/memory/ptr_util.h"
#include "skia/ext/skia_utils_ios.h"
namespace suggestions {
-SkBitmap* DecodeJPEGToSkBitmap(const void* encoded_data, size_t size) {
+std::unique_ptr<SkBitmap> DecodeJPEGToSkBitmap(const void* encoded_data,
+ size_t size) {
NSData* data = [NSData dataWithBytes:encoded_data length:size];
UIImage* image = [UIImage imageWithData:data scale:1.0];
- return new SkBitmap(skia::CGImageToSkBitmap(image.CGImage, [image size],
- YES));
+ return base::WrapUnique(
+ new SkBitmap(skia::CGImageToSkBitmap(image.CGImage, [image size], YES)));
}
bool EncodeSkBitmapToJPEG(const SkBitmap& bitmap,
« no previous file with comments | « components/suggestions/image_encoder.cc ('k') | printing/emf_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698