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

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

Issue 133253002: [webcrypto] Fix TODO regarding asynchronous completion of crypto operations. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove unused forward declaration of ScriptState Created 6 years, 11 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 | « Source/core/platform/CryptoResult.h ('k') | Source/modules/crypto/CryptoResultImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/crypto/CryptoResultImpl.h
diff --git a/Source/modules/crypto/CryptoResultImpl.h b/Source/modules/crypto/CryptoResultImpl.h
index e8a1f5c87bbf26b5e2780ad686a05a7b24e36c9c..aa5428b0c0f870d61787d941a7bcfe6fc555eb67 100644
--- a/Source/modules/crypto/CryptoResultImpl.h
+++ b/Source/modules/crypto/CryptoResultImpl.h
@@ -31,10 +31,14 @@
#ifndef CryptoResultImpl_h
#define CryptoResultImpl_h
+#include "bindings/v8/DOMRequestState.h"
#include "bindings/v8/ScriptPromise.h"
+#include "core/dom/ContextLifecycleObserver.h"
#include "core/platform/CryptoResult.h"
#include "public/platform/WebCrypto.h"
+#include "wtf/Assertions.h"
#include "wtf/Forward.h"
+#include "wtf/Threading.h"
namespace WebCore {
@@ -42,7 +46,7 @@ class ScriptPromiseResolver;
// Wrapper around a Promise to notify completion of the crypto operation.
// Platform cannot know about Promises which are declared in bindings.
-class CryptoResultImpl FINAL : public CryptoResult {
+class CryptoResultImpl FINAL : public CryptoResult, public ContextLifecycleObserver {
public:
~CryptoResultImpl();
@@ -55,11 +59,25 @@ public:
virtual void completeWithKeyPair(const blink::WebCryptoKey& publicKey, const blink::WebCryptoKey& privateKey) OVERRIDE;
private:
- explicit CryptoResultImpl(ScriptPromise);
+ CryptoResultImpl(ExecutionContext*, ScriptPromise);
void finish();
+ void CheckValidThread() const;
+
+ // Override from ContextLifecycleObserver
+ virtual void contextDestroyed() OVERRIDE;
+
+ // Returns true if the ExecutionContext is still alive and running.
+ bool canCompletePromise() const;
+
+ void clearPromiseResolver();
RefPtr<ScriptPromiseResolver> m_promiseResolver;
+ DOMRequestState m_requestState;
+
+#if !ASSERT_DISABLED
+ ThreadIdentifier m_owningThread;
bool m_finished;
+#endif
};
} // namespace WebCore
« no previous file with comments | « Source/core/platform/CryptoResult.h ('k') | Source/modules/crypto/CryptoResultImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698