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

Unified Diff: third_party/WebKit/Source/platform/Crypto.cpp

Issue 2142783002: Use std::unique_ptr to pass around WebCryptoDigestor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « third_party/WebKit/Source/platform/Crypto.h ('k') | third_party/WebKit/public/platform/WebCrypto.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/Crypto.cpp
diff --git a/third_party/WebKit/Source/platform/Crypto.cpp b/third_party/WebKit/Source/platform/Crypto.cpp
index 79fa67b010a2c6ec717128c94a84f0799ec3648e..90808a76a5298e37aa95e4d5c6e68ca8dad4b081 100644
--- a/third_party/WebKit/Source/platform/Crypto.cpp
+++ b/third_party/WebKit/Source/platform/Crypto.cpp
@@ -7,7 +7,6 @@
#include "public/platform/Platform.h"
#include "public/platform/WebCrypto.h"
#include "public/platform/WebCryptoAlgorithm.h"
-#include "wtf/PtrUtil.h"
#include <memory>
namespace blink {
@@ -38,8 +37,9 @@ bool computeDigest(HashAlgorithm algorithm, const char* digestable, size_t lengt
ASSERT(crypto);
- std::unique_ptr<WebCryptoDigestor> digestor = wrapUnique(crypto->createDigestor(algorithmId));
- if (!digestor.get() || !digestor->consume(reinterpret_cast<const unsigned char*>(digestable), length) || !digestor->finish(result, resultSize))
+ std::unique_ptr<WebCryptoDigestor> digestor = crypto->createDigestor(algorithmId);
+ DCHECK(digestor);
+ if (!digestor->consume(reinterpret_cast<const unsigned char*>(digestable), length) || !digestor->finish(result, resultSize))
return false;
digestResult.append(static_cast<uint8_t*>(result), resultSize);
@@ -48,7 +48,7 @@ bool computeDigest(HashAlgorithm algorithm, const char* digestable, size_t lengt
std::unique_ptr<WebCryptoDigestor> createDigestor(HashAlgorithm algorithm)
{
- return wrapUnique(Platform::current()->crypto()->createDigestor(toWebCryptoAlgorithmId(algorithm)));
+ return Platform::current()->crypto()->createDigestor(toWebCryptoAlgorithmId(algorithm));
}
void finishDigestor(WebCryptoDigestor* digestor, DigestValue& digestResult)
« no previous file with comments | « third_party/WebKit/Source/platform/Crypto.h ('k') | third_party/WebKit/public/platform/WebCrypto.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698