| Index: ios/chrome/browser/suggestions/ios_image_decoder_impl.mm
|
| diff --git a/ios/chrome/browser/suggestions/ios_image_decoder_impl.mm b/ios/chrome/browser/suggestions/ios_image_decoder_impl.mm
|
| index 3f7a6436b718ad490e0f38cb47276b465391c66c..8c6d84adad23a50a85fd7578150f659ba55fe10c 100644
|
| --- a/ios/chrome/browser/suggestions/ios_image_decoder_impl.mm
|
| +++ b/ios/chrome/browser/suggestions/ios_image_decoder_impl.mm
|
| @@ -15,6 +15,10 @@
|
| #include "ios/web/public/web_thread.h"
|
| #include "ui/gfx/image/image.h"
|
|
|
| +#if !defined(__has_feature) || !__has_feature(objc_arc)
|
| +#error "This file requires ARC support."
|
| +#endif
|
| +
|
| namespace {
|
|
|
| class WebpDecoderDelegate : public webp_transcode::WebpDecoder::Delegate {
|
| @@ -26,13 +30,13 @@ class WebpDecoderDelegate : public webp_transcode::WebpDecoder::Delegate {
|
| // WebpDecoder::Delegate methods
|
| void OnFinishedDecoding(bool success) override {
|
| if (!success)
|
| - decoded_image_.reset();
|
| + decoded_image_ = nil;
|
| }
|
|
|
| void SetImageFeatures(
|
| size_t total_size,
|
| webp_transcode::WebpDecoder::DecodedImageFormat format) override {
|
| - decoded_image_.reset([[NSMutableData alloc] initWithCapacity:total_size]);
|
| + decoded_image_ = [[NSMutableData alloc] initWithCapacity:total_size];
|
| }
|
|
|
| void OnDataDecoded(NSData* data) override {
|
| @@ -42,7 +46,7 @@ class WebpDecoderDelegate : public webp_transcode::WebpDecoder::Delegate {
|
|
|
| private:
|
| ~WebpDecoderDelegate() override {}
|
| - base::scoped_nsobject<NSMutableData> decoded_image_;
|
| + NSMutableData* decoded_image_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(WebpDecoderDelegate);
|
| };
|
| @@ -56,7 +60,7 @@ base::scoped_nsobject<NSData> DecodeWebpImage(
|
| new webp_transcode::WebpDecoder(delegate.get()));
|
| decoder->OnDataReceived(webp_image);
|
| DLOG_IF(ERROR, !delegate->data()) << "WebP image decoding failed.";
|
| - return base::scoped_nsobject<NSData>([delegate->data() retain]);
|
| + return base::scoped_nsobject<NSData>(delegate->data());
|
| }
|
|
|
| // Returns true if the given image_data is a WebP image.
|
| @@ -120,10 +124,10 @@ void IOSImageDecoderImpl::DecodeImage(
|
| const std::string& image_data,
|
| const image_fetcher::ImageDecodedCallback& callback) {
|
| // Convert the |image_data| std::string to an NSData buffer.
|
| - base::scoped_nsobject<NSData> data(
|
| - [[NSData dataWithBytesNoCopy:const_cast<char*>(image_data.c_str())
|
| - length:image_data.length()
|
| - freeWhenDone:NO] retain]);
|
| + base::scoped_nsobject<NSData> data([NSData
|
| + dataWithBytesNoCopy:const_cast<char*>(image_data.c_str())
|
| + length:image_data.length()
|
| + freeWhenDone:NO]);
|
|
|
| // The WebP image format is not supported by iOS natively. Therefore WebP
|
| // images need to be decoded explicitly,
|
|
|