| Index: Source/bindings/v8/ScriptPromiseResolverWithContext.h
|
| diff --git a/Source/bindings/v8/ScriptPromiseResolverWithContext.h b/Source/bindings/v8/ScriptPromiseResolverWithContext.h
|
| index 0ccf94e1c1d77195839cb79d9341d22c808fd0b2..59861252231c11a03981c1ce95ef67f9f5141a81 100644
|
| --- a/Source/bindings/v8/ScriptPromiseResolverWithContext.h
|
| +++ b/Source/bindings/v8/ScriptPromiseResolverWithContext.h
|
| @@ -38,6 +38,8 @@ public:
|
| return resolver.release();
|
| }
|
|
|
| + virtual ~ScriptPromiseResolverWithContext();
|
| +
|
| // Anything that can be passed to toV8Value can be passed to this function.
|
| template <typename T>
|
| void resolve(T value)
|
| @@ -68,7 +70,13 @@ public:
|
| virtual void resume() OVERRIDE;
|
| virtual void stop() OVERRIDE;
|
|
|
| + // Once this function is called this resolver stays alive while the
|
| + // promise is pending and the associated ExecutionContext isn't stopped.
|
| + void keepAliveWhilePending();
|
| +
|
| protected:
|
| + // You need to call suspendIfNeeded after the construction because
|
| + // this is an ActiveDOMObject.
|
| explicit ScriptPromiseResolverWithContext(ScriptState*);
|
|
|
| private:
|
| @@ -78,6 +86,10 @@ private:
|
| Rejecting,
|
| ResolvedOrRejected,
|
| };
|
| + enum LifetimeMode {
|
| + Default,
|
| + KeepAliveWhilePending,
|
| + };
|
|
|
| template<typename T>
|
| v8::Handle<v8::Value> toV8Value(const T& value)
|
| @@ -90,6 +102,7 @@ private:
|
| {
|
| if (m_state != Pending || !executionContext() || executionContext()->activeDOMObjectsAreStopped())
|
| return;
|
| + ASSERT(newState == Resolving || newState == Rejecting);
|
| m_state = newState;
|
| // Retain this object until it is actually resolved or rejected.
|
| // |deref| will be called in |clear|.
|
| @@ -107,6 +120,7 @@ private:
|
|
|
| ResolutionState m_state;
|
| const RefPtr<ScriptState> m_scriptState;
|
| + LifetimeMode m_mode;
|
| Timer<ScriptPromiseResolverWithContext> m_timer;
|
| RefPtr<ScriptPromiseResolver> m_resolver;
|
| ScopedPersistent<v8::Value> m_value;
|
|
|