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

Side by Side Diff: public/platform/WebCrypto.h

Issue 1228373006: Reliably cancel in-progress CryptoResult(Impl) upon shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: initialize stopped crypto result as cancelled Created 5 years, 4 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
« no previous file with comments | « Source/platform/exported/WebCryptoResult.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 27 matching lines...) Expand all
38 #include "WebString.h" 38 #include "WebString.h"
39 #include "WebVector.h" 39 #include "WebVector.h"
40 40
41 #if INSIDE_BLINK 41 #if INSIDE_BLINK
42 #include "platform/heap/Handle.h" 42 #include "platform/heap/Handle.h"
43 #endif 43 #endif
44 44
45 namespace blink { 45 namespace blink {
46 46
47 class CryptoResult; 47 class CryptoResult;
48 class CryptoResultCancel;
48 class WebString; 49 class WebString;
49 50
50 enum WebCryptoErrorType { 51 enum WebCryptoErrorType {
51 WebCryptoErrorTypeType, 52 WebCryptoErrorTypeType,
52 WebCryptoErrorTypeNotSupported, 53 WebCryptoErrorTypeNotSupported,
53 WebCryptoErrorTypeSyntax, 54 WebCryptoErrorTypeSyntax,
54 WebCryptoErrorTypeInvalidAccess, 55 WebCryptoErrorTypeInvalidAccess,
55 WebCryptoErrorTypeData, 56 WebCryptoErrorTypeData,
56 WebCryptoErrorTypeOperation, 57 WebCryptoErrorTypeOperation,
57 }; 58 };
(...skipping 29 matching lines...) Expand all
87 BLINK_PLATFORM_EXPORT void completeWithJson(const char* utf8Data, unsigned l ength); 88 BLINK_PLATFORM_EXPORT void completeWithJson(const char* utf8Data, unsigned l ength);
88 BLINK_PLATFORM_EXPORT void completeWithBoolean(bool); 89 BLINK_PLATFORM_EXPORT void completeWithBoolean(bool);
89 BLINK_PLATFORM_EXPORT void completeWithKey(const WebCryptoKey&); 90 BLINK_PLATFORM_EXPORT void completeWithKey(const WebCryptoKey&);
90 BLINK_PLATFORM_EXPORT void completeWithKeyPair(const WebCryptoKey& publicKey , const WebCryptoKey& privateKey); 91 BLINK_PLATFORM_EXPORT void completeWithKeyPair(const WebCryptoKey& publicKey , const WebCryptoKey& privateKey);
91 92
92 // Returns true if the underlying operation was cancelled. 93 // Returns true if the underlying operation was cancelled.
93 // This method can be called from any thread. 94 // This method can be called from any thread.
94 BLINK_PLATFORM_EXPORT bool cancelled() const; 95 BLINK_PLATFORM_EXPORT bool cancelled() const;
95 96
96 #if INSIDE_BLINK 97 #if INSIDE_BLINK
97 BLINK_PLATFORM_EXPORT explicit WebCryptoResult(const PassRefPtrWillBeRawPtr< CryptoResult>&); 98 BLINK_PLATFORM_EXPORT WebCryptoResult(const PassRefPtrWillBeRawPtr<CryptoRes ult>&, const PassRefPtr<CryptoResultCancel>&);
98 #endif 99 #endif
99 100
100 private: 101 private:
101 BLINK_PLATFORM_EXPORT void reset(); 102 BLINK_PLATFORM_EXPORT void reset();
102 BLINK_PLATFORM_EXPORT void assign(const WebCryptoResult&); 103 BLINK_PLATFORM_EXPORT void assign(const WebCryptoResult&);
103 104
104 WebPrivatePtr<CryptoResult> m_impl; 105 WebPrivatePtr<CryptoResult, WebPrivatePtrDestructionCrossThread> m_impl;
106 WebPrivatePtr<CryptoResultCancel, WebPrivatePtrDestructionCrossThread> m_can cel;
105 }; 107 };
106 108
107 class WebCryptoDigestor { 109 class WebCryptoDigestor {
108 public: 110 public:
109 virtual ~WebCryptoDigestor() { } 111 virtual ~WebCryptoDigestor() { }
110 112
111 // consume() will return |true| on the successful addition of data to the 113 // consume() will return |true| on the successful addition of data to the
112 // partially generated digest. It will return |false| when that fails. After 114 // partially generated digest. It will return |false| when that fails. After
113 // a return of |false|, consume() should not be called again (nor should 115 // a return of |false|, consume() should not be called again (nor should
114 // finish() be called). 116 // finish() be called).
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // Returns true on success. 268 // Returns true on success.
267 virtual bool serializeKeyForClone(const WebCryptoKey&, WebVector<unsigned ch ar>&) { return false; } 269 virtual bool serializeKeyForClone(const WebCryptoKey&, WebVector<unsigned ch ar>&) { return false; }
268 270
269 protected: 271 protected:
270 virtual ~WebCrypto() { } 272 virtual ~WebCrypto() { }
271 }; 273 };
272 274
273 } // namespace blink 275 } // namespace blink
274 276
275 #endif // WebCrypto_h 277 #endif // WebCrypto_h
OLDNEW
« no previous file with comments | « Source/platform/exported/WebCryptoResult.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698