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

Side by Side Diff: third_party/WebKit/Source/platform/Crypto.h

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // TODO(jww) The original Blink-style header guard for this file conflicts with 5 // TODO(jww) The original Blink-style header guard for this file conflicts with
6 // the header guard in Source/modules/crypto/Crypto.h, so this is a 6 // the header guard in Source/modules/crypto/Crypto.h, so this is a
7 // Chromium-style header guard instead. There is now a bug 7 // Chromium-style header guard instead. There is now a bug
8 // (https://crbug.com/360121) to track a proposal to change all header guards 8 // (https://crbug.com/360121) to track a proposal to change all header guards
9 // to a similar style. Thus, whenever that is resolved, this header guard 9 // to a similar style. Thus, whenever that is resolved, this header guard
10 // should be changed to whatever style is agreed upon. 10 // should be changed to whatever style is agreed upon.
11 #ifndef SOURCE_PLATFORM_CRYPTO_H_ 11 #ifndef SOURCE_PLATFORM_CRYPTO_H_
12 #define SOURCE_PLATFORM_CRYPTO_H_ 12 #define SOURCE_PLATFORM_CRYPTO_H_
13 13
14 #include "platform/PlatformExport.h" 14 #include "platform/PlatformExport.h"
15 #include "public/platform/WebCrypto.h" 15 #include "public/platform/WebCrypto.h"
16 #include "wtf/Allocator.h" 16 #include "wtf/Allocator.h"
17 #include "wtf/HashSet.h" 17 #include "wtf/HashSet.h"
18 #include "wtf/StringHasher.h" 18 #include "wtf/StringHasher.h"
19 #include "wtf/Vector.h" 19 #include "wtf/Vector.h"
20 #include <memory>
20 21
21 namespace blink { 22 namespace blink {
22 23
23 static const size_t kMaxDigestSize = 64; 24 static const size_t kMaxDigestSize = 64;
24 typedef Vector<uint8_t, kMaxDigestSize> DigestValue; 25 typedef Vector<uint8_t, kMaxDigestSize> DigestValue;
25 26
26 const size_t sha1HashSize = 20; 27 const size_t sha1HashSize = 20;
27 enum HashAlgorithm { 28 enum HashAlgorithm {
28 HashAlgorithmSha1, 29 HashAlgorithmSha1,
29 HashAlgorithmSha256, 30 HashAlgorithmSha256,
30 HashAlgorithmSha384, 31 HashAlgorithmSha384,
31 HashAlgorithmSha512 32 HashAlgorithmSha512
32 }; 33 };
33 34
34 PLATFORM_EXPORT bool computeDigest(HashAlgorithm, const char* digestable, size_t length, DigestValue& digestResult); 35 PLATFORM_EXPORT bool computeDigest(HashAlgorithm, const char* digestable, size_t length, DigestValue& digestResult);
35 PLATFORM_EXPORT PassOwnPtr<WebCryptoDigestor> createDigestor(HashAlgorithm); 36 PLATFORM_EXPORT std::unique_ptr<WebCryptoDigestor> createDigestor(HashAlgorithm) ;
36 PLATFORM_EXPORT void finishDigestor(WebCryptoDigestor*, DigestValue& digestResul t); 37 PLATFORM_EXPORT void finishDigestor(WebCryptoDigestor*, DigestValue& digestResul t);
37 38
38 } // namespace blink 39 } // namespace blink
39 40
40 namespace WTF { 41 namespace WTF {
41 42
42 struct DigestValueHash { 43 struct DigestValueHash {
43 STATIC_ONLY(DigestValueHash); 44 STATIC_ONLY(DigestValueHash);
44 static unsigned hash(const blink::DigestValue& v) 45 static unsigned hash(const blink::DigestValue& v)
45 { 46 {
(...skipping 16 matching lines...) Expand all
62 STATIC_ONLY(DefaultHash); 63 STATIC_ONLY(DefaultHash);
63 typedef IntHash<blink::HashAlgorithm> Hash; 64 typedef IntHash<blink::HashAlgorithm> Hash;
64 }; 65 };
65 template <> 66 template <>
66 struct HashTraits<blink::HashAlgorithm> : UnsignedWithZeroKeyHashTraits<blink::H ashAlgorithm> { 67 struct HashTraits<blink::HashAlgorithm> : UnsignedWithZeroKeyHashTraits<blink::H ashAlgorithm> {
67 STATIC_ONLY(HashTraits); 68 STATIC_ONLY(HashTraits);
68 }; 69 };
69 70
70 } // namespace WTF 71 } // namespace WTF
71 #endif // SOURCE_PLATFORM_CRYPTO_H_ 72 #endif // SOURCE_PLATFORM_CRYPTO_H_
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/CrossThreadCopier.cpp ('k') | third_party/WebKit/Source/platform/Crypto.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698