Chromium Code Reviews| Index: third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h |
| diff --git a/third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h b/third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h |
| index b87cd8b0deabaf7b313fc0768e532ea82392b94c..cc5da4107c5203c13723a8d0cd7563f71c4d048f 100644 |
| --- a/third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h |
| +++ b/third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h |
| @@ -8,6 +8,7 @@ |
| #include "core/dom/ContextLifecycleObserver.h" |
| #include "core/events/EventTarget.h" |
| #include "modules/ModulesExport.h" |
| +#include "modules/serviceworkers/WaitUntilObserver.h" |
| #include "platform/heap/Handle.h" |
| #include "public/platform/WebURLRequest.h" |
| #include "public/platform/modules/serviceworker/WebServiceWorkerResponseError.h" |
| @@ -27,7 +28,7 @@ class MODULES_EXPORT RespondWithObserver : public GarbageCollectedFinalized<Resp |
| public: |
| virtual ~RespondWithObserver(); |
| - static RespondWithObserver* create(ExecutionContext*, int eventID, const KURL& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURLRequest::RequestContext); |
| + static RespondWithObserver* create(ExecutionContext*, int eventID, const KURL& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURLRequest::RequestContext, WaitUntilObserver*); |
| void contextDestroyed() override; |
| @@ -43,7 +44,7 @@ public: |
| DECLARE_VIRTUAL_TRACE(); |
| protected: |
| - RespondWithObserver(ExecutionContext*, int eventID, const KURL& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURLRequest::RequestContext); |
| + RespondWithObserver(ExecutionContext*, int eventID, const KURL& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURLRequest::RequestContext, WaitUntilObserver*); |
| private: |
| class ThenFunction; |
| @@ -56,6 +57,13 @@ private: |
| enum State { Initial, Pending, Done }; |
| State m_state; |
| + |
| + // RespondWith should ensure the ExtendableEvent is alive until the promise |
| + // passed to RespondWith is resolved. The lifecycle of the ExtendableEvent |
| + // is controlled by WaitUntilObserver, so not only |
| + // WaitUntilObserver::Thenfunction but RespondWith needs to have a strong |
|
falken
2016/06/16 06:23:11
ThenFunction
shimazu
2016/06/21 02:43:38
Done.
|
| + // reference to the WaitUntilObserver. |
| + Member<WaitUntilObserver> m_observer; |
| }; |
| } // namespace blink |