Index: Source/modules/crypto/CryptoResultImpl.h |
diff --git a/Source/modules/crypto/CryptoResultImpl.h b/Source/modules/crypto/CryptoResultImpl.h |
index e8a1f5c87bbf26b5e2780ad686a05a7b24e36c9c..70c2e0942af75848ed01e2516efc449a46e812b2 100644 |
--- a/Source/modules/crypto/CryptoResultImpl.h |
+++ b/Source/modules/crypto/CryptoResultImpl.h |
@@ -32,17 +32,22 @@ |
#define CryptoResultImpl_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 { |
+class DOMWrapperWorld; |
class ScriptPromiseResolver; |
+class ScriptState; |
// 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 +60,23 @@ public: |
virtual void completeWithKeyPair(const blink::WebCryptoKey& publicKey, const blink::WebCryptoKey& privateKey) OVERRIDE; |
private: |
- explicit CryptoResultImpl(ScriptPromise); |
+ CryptoResultImpl(ExecutionContext*, DOMWrapperWorld*, 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; |
RefPtr<ScriptPromiseResolver> m_promiseResolver; |
+ RefPtr<DOMWrapperWorld> m_world; |
+ |
+#if !ASSERT_DISABLED |
+ ThreadIdentifier m_owningThread; |
bool m_finished; |
+#endif |
}; |
} // namespace WebCore |