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

Unified Diff: Source/modules/crypto/CryptoResultImpl.h

Issue 343723003: [webcrypto] Allow crypto operations to be cancelled by the platform implementation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix comment typo Created 6 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
Index: Source/modules/crypto/CryptoResultImpl.h
diff --git a/Source/modules/crypto/CryptoResultImpl.h b/Source/modules/crypto/CryptoResultImpl.h
index 63a0193e001c53cc9a19ad67065fb7cb57ead704..b3aa64f47a520c9d0c8d1ffd5f47887547c61940 100644
--- a/Source/modules/crypto/CryptoResultImpl.h
+++ b/Source/modules/crypto/CryptoResultImpl.h
@@ -50,7 +50,7 @@ ExceptionCode webCryptoErrorToExceptionCode(blink::WebCryptoErrorType);
//
// * At creation time there must be an active ExecutionContext.
// * The CryptoResult interface must only be called from the origin thread.
-// * addref() and deref() can be called from any thread.
+// * ref(), deref(), cancelled() and cancel() can be called from any thread.
// * One of the completeWith***() functions must be called, or the
// m_resolver will be leaked until the ExecutionContext is destroyed.
class CryptoResultImpl FINAL : public CryptoResult {
@@ -65,14 +65,19 @@ public:
virtual void completeWithBoolean(bool) OVERRIDE;
virtual void completeWithKey(const blink::WebCryptoKey&) OVERRIDE;
virtual void completeWithKeyPair(const blink::WebCryptoKey& publicKey, const blink::WebCryptoKey& privateKey) OVERRIDE;
+ virtual bool cancelled() const OVERRIDE;
// It is only valid to call this before completion.
ScriptPromise promise();
private:
+ class WeakResolver;
explicit CryptoResultImpl(ScriptState*);
+ void cancel();
+
WeakPtr<ScriptPromiseResolverWithContext> m_resolver;
+ volatile int m_cancelled;
};
} // namespace WebCore
« no previous file with comments | « LayoutTests/crypto/resources/worker-start-slow-operations.js ('k') | Source/modules/crypto/CryptoResultImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698