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

Side by Side Diff: chrome/utility/image_decoder_impl.cc

Issue 1899083002: Convert //chrome from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/utility/image_decoder_impl.h" 5 #include "chrome/utility/image_decoder_impl.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 if (encoded_data.size() == 0) { 46 if (encoded_data.size() == 0) {
47 callback.Run(nullptr); 47 callback.Run(nullptr);
48 return; 48 return;
49 } 49 }
50 50
51 SkBitmap decoded_image; 51 SkBitmap decoded_image;
52 #if defined(OS_CHROMEOS) 52 #if defined(OS_CHROMEOS)
53 if (codec == mojom::ImageCodec::ROBUST_JPEG) { 53 if (codec == mojom::ImageCodec::ROBUST_JPEG) {
54 // Our robust jpeg decoding is using IJG libjpeg. 54 // Our robust jpeg decoding is using IJG libjpeg.
55 if (encoded_data.size()) { 55 if (encoded_data.size()) {
56 scoped_ptr<SkBitmap> decoded_jpeg( 56 std::unique_ptr<SkBitmap> decoded_jpeg(gfx::JPEGCodecRobustSlow::Decode(
57 gfx::JPEGCodecRobustSlow::Decode(encoded_data.storage().data(), 57 encoded_data.storage().data(), encoded_data.size()));
58 encoded_data.size()));
59 if (decoded_jpeg.get() && !decoded_jpeg->empty()) 58 if (decoded_jpeg.get() && !decoded_jpeg->empty())
60 decoded_image = *decoded_jpeg; 59 decoded_image = *decoded_jpeg;
61 } 60 }
62 } else if (codec == mojom::ImageCodec::ROBUST_PNG) { 61 } else if (codec == mojom::ImageCodec::ROBUST_PNG) {
63 // Our robust PNG decoding is using libpng. 62 // Our robust PNG decoding is using libpng.
64 if (encoded_data.size()) { 63 if (encoded_data.size()) {
65 SkBitmap decoded_png; 64 SkBitmap decoded_png;
66 if (gfx::PNGCodec::Decode(encoded_data.storage().data(), 65 if (gfx::PNGCodec::Decode(encoded_data.storage().data(),
67 encoded_data.size(), &decoded_png)) { 66 encoded_data.size(), &decoded_png)) {
68 decoded_image = decoded_png; 67 decoded_image = decoded_png;
(...skipping 27 matching lines...) Expand all
96 decoded_image.reset(); 95 decoded_image.reset();
97 } 96 }
98 } 97 }
99 } 98 }
100 99
101 if (decoded_image.isNull()) 100 if (decoded_image.isNull())
102 callback.Run(nullptr); 101 callback.Run(nullptr);
103 else 102 else
104 callback.Run(skia::mojom::Bitmap::From(decoded_image)); 103 callback.Run(skia::mojom::Bitmap::From(decoded_image));
105 } 104 }
OLDNEW
« no previous file with comments | « chrome/utility/extensions/extensions_handler.cc ('k') | chrome/utility/image_writer/disk_unmounter_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698