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 |