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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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>
21 20
22 namespace blink { 21 namespace blink {
23 22
24 static const size_t kMaxDigestSize = 64; 23 static const size_t kMaxDigestSize = 64;
25 typedef Vector<uint8_t, kMaxDigestSize> DigestValue; 24 typedef Vector<uint8_t, kMaxDigestSize> DigestValue;
26 25
27 const size_t sha1HashSize = 20; 26 const size_t sha1HashSize = 20;
28 enum HashAlgorithm { 27 enum HashAlgorithm {
29 HashAlgorithmSha1, 28 HashAlgorithmSha1,
30 HashAlgorithmSha256, 29 HashAlgorithmSha256,
31 HashAlgorithmSha384, 30 HashAlgorithmSha384,
32 HashAlgorithmSha512 31 HashAlgorithmSha512
33 }; 32 };
34 33
35 PLATFORM_EXPORT bool computeDigest(HashAlgorithm, const char* digestable, size_t length, DigestValue& digestResult); 34 PLATFORM_EXPORT bool computeDigest(HashAlgorithm, const char* digestable, size_t length, DigestValue& digestResult);
36 PLATFORM_EXPORT std::unique_ptr<WebCryptoDigestor> createDigestor(HashAlgorithm) ; 35 PLATFORM_EXPORT PassOwnPtr<WebCryptoDigestor> createDigestor(HashAlgorithm);
37 PLATFORM_EXPORT void finishDigestor(WebCryptoDigestor*, DigestValue& digestResul t); 36 PLATFORM_EXPORT void finishDigestor(WebCryptoDigestor*, DigestValue& digestResul t);
38 37
39 } // namespace blink 38 } // namespace blink
40 39
41 namespace WTF { 40 namespace WTF {
42 41
43 struct DigestValueHash { 42 struct DigestValueHash {
44 STATIC_ONLY(DigestValueHash); 43 STATIC_ONLY(DigestValueHash);
45 static unsigned hash(const blink::DigestValue& v) 44 static unsigned hash(const blink::DigestValue& v)
46 { 45 {
(...skipping 16 matching lines...) Expand all
63 STATIC_ONLY(DefaultHash); 62 STATIC_ONLY(DefaultHash);
64 typedef IntHash<blink::HashAlgorithm> Hash; 63 typedef IntHash<blink::HashAlgorithm> Hash;
65 }; 64 };
66 template <> 65 template <>
67 struct HashTraits<blink::HashAlgorithm> : UnsignedWithZeroKeyHashTraits<blink::H ashAlgorithm> { 66 struct HashTraits<blink::HashAlgorithm> : UnsignedWithZeroKeyHashTraits<blink::H ashAlgorithm> {
68 STATIC_ONLY(HashTraits); 67 STATIC_ONLY(HashTraits);
69 }; 68 };
70 69
71 } // namespace WTF 70 } // namespace WTF
72 #endif // SOURCE_PLATFORM_CRYPTO_H_ 71 #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