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

Unified Diff: components/user_manager/user_image/user_image.cc

Issue 1917673002: Convert //components/[u-z]* 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/user_manager/user_image/user_image.h ('k') | components/user_manager/user_manager_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/user_manager/user_image/user_image.cc
diff --git a/components/user_manager/user_image/user_image.cc b/components/user_manager/user_image/user_image.cc
index ce37ca2f64377700c959ffcafa616da4d151f70e..c06c847405f5d0f7f15215edea62cf0519c75a9a 100644
--- a/components/user_manager/user_image/user_image.cc
+++ b/components/user_manager/user_image/user_image.cc
@@ -4,6 +4,7 @@
#include "components/user_manager/user_image/user_image.h"
+#include "base/memory/ptr_util.h"
#include "base/trace_event/trace_event.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/codec/jpeg_codec.h"
@@ -18,11 +19,11 @@ const int kDefaultEncodingQuality = 90;
} // namespace
// static
-scoped_ptr<UserImage::Bytes> UserImage::Encode(const SkBitmap& bitmap) {
+std::unique_ptr<UserImage::Bytes> UserImage::Encode(const SkBitmap& bitmap) {
TRACE_EVENT2("oobe", "UserImage::Encode",
"width", bitmap.width(), "height", bitmap.height());
SkAutoLockPixels lock_bitmap(bitmap);
- scoped_ptr<Bytes> output(new Bytes);
+ std::unique_ptr<Bytes> output(new Bytes);
if (gfx::JPEGCodec::Encode(
reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)),
gfx::JPEGCodec::FORMAT_SkBitmap,
@@ -37,18 +38,19 @@ scoped_ptr<UserImage::Bytes> UserImage::Encode(const SkBitmap& bitmap) {
}
// static
-scoped_ptr<UserImage> UserImage::CreateAndEncode(const gfx::ImageSkia& image) {
+std::unique_ptr<UserImage> UserImage::CreateAndEncode(
+ const gfx::ImageSkia& image) {
if (image.isNull())
- return make_scoped_ptr(new UserImage);
+ return base::WrapUnique(new UserImage);
- scoped_ptr<Bytes> image_bytes = Encode(*image.bitmap());
+ std::unique_ptr<Bytes> image_bytes = Encode(*image.bitmap());
if (image_bytes) {
// TODO(crbug.com/593251): Remove the data copy via |image_bytes|.
- scoped_ptr<UserImage> result(new UserImage(image, *image_bytes));
+ std::unique_ptr<UserImage> result(new UserImage(image, *image_bytes));
result->MarkAsSafe();
return result;
}
- return make_scoped_ptr(new UserImage(image));
+ return base::WrapUnique(new UserImage(image));
}
UserImage::UserImage()
« no previous file with comments | « components/user_manager/user_image/user_image.h ('k') | components/user_manager/user_manager_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698