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

Unified Diff: ui/gfx/codec/jpeg_codec.cc

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 | « ui/gfx/codec/jpeg_codec.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/codec/jpeg_codec.cc
diff --git a/ui/gfx/codec/jpeg_codec.cc b/ui/gfx/codec/jpeg_codec.cc
index 8a08fe0291afcc8a61c6b4f560396a4a50057da8..79c7d20d881021e83cbc86d9a5940b61d6a911e3 100644
--- a/ui/gfx/codec/jpeg_codec.cc
+++ b/ui/gfx/codec/jpeg_codec.cc
@@ -603,16 +603,17 @@ bool JPEGCodec::Decode(const unsigned char* input, size_t input_size,
}
// static
-SkBitmap* JPEGCodec::Decode(const unsigned char* input, size_t input_size) {
+std::unique_ptr<SkBitmap> JPEGCodec::Decode(const unsigned char* input,
+ size_t input_size) {
int w, h;
std::vector<unsigned char> data_vector;
if (!Decode(input, input_size, FORMAT_SkBitmap, &data_vector, &w, &h))
- return NULL;
+ return nullptr;
// Skia only handles 32 bit images.
int data_length = w * h * 4;
- SkBitmap* bitmap = new SkBitmap();
+ std::unique_ptr<SkBitmap> bitmap(new SkBitmap());
bitmap->allocN32Pixels(w, h);
memcpy(bitmap->getAddr32(0, 0), &data_vector[0], data_length);
« no previous file with comments | « ui/gfx/codec/jpeg_codec.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698