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

Unified Diff: crypto/secure_hash.cc

Issue 2095523002: Make //crypto factories return std::unique_ptr<>s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: I'm blind Created 4 years, 6 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 | « crypto/secure_hash.h ('k') | crypto/signature_creator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/secure_hash.cc
diff --git a/crypto/secure_hash.cc b/crypto/secure_hash.cc
index 2a5a1f02089e6f1ddd24523ab6f39fd31bea744a..76d42d33f72a00aa6d84dea35d5a6c4a41ccbeb2 100644
--- a/crypto/secure_hash.cc
+++ b/crypto/secure_hash.cc
@@ -9,6 +9,7 @@
#include <stddef.h>
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/pickle.h"
#include "crypto/openssl_util.h"
@@ -40,8 +41,8 @@ class SecureHashSHA256 : public SecureHash {
SHA256_Final(result.safe_buffer(), &ctx_);
}
- SecureHash* Clone() const override {
- return new SecureHashSHA256(*this);
+ std::unique_ptr<SecureHash> Clone() const override {
+ return base::MakeUnique<SecureHashSHA256>(*this);
}
size_t GetHashLength() const override { return SHA256_DIGEST_LENGTH; }
@@ -52,13 +53,13 @@ class SecureHashSHA256 : public SecureHash {
} // namespace
-SecureHash* SecureHash::Create(Algorithm algorithm) {
+std::unique_ptr<SecureHash> SecureHash::Create(Algorithm algorithm) {
switch (algorithm) {
case SHA256:
- return new SecureHashSHA256();
+ return base::MakeUnique<SecureHashSHA256>();
default:
NOTIMPLEMENTED();
- return NULL;
+ return nullptr;
}
}
« no previous file with comments | « crypto/secure_hash.h ('k') | crypto/signature_creator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698