OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef RespondWithObserver_h | 5 #ifndef RespondWithObserver_h |
6 #define RespondWithObserver_h | 6 #define RespondWithObserver_h |
7 | 7 |
8 #include "core/dom/ContextLifecycleObserver.h" | 8 #include "core/dom/ContextLifecycleObserver.h" |
9 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RespondWithObserver); | 25 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RespondWithObserver); |
26 public: | 26 public: |
27 static RespondWithObserver* create(ExecutionContext*, int eventID, const KUR
L& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType); | 27 static RespondWithObserver* create(ExecutionContext*, int eventID, const KUR
L& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType); |
28 | 28 |
29 void contextDestroyed() override; | 29 void contextDestroyed() override; |
30 | 30 |
31 void didDispatchEvent(bool defaultPrevented); | 31 void didDispatchEvent(bool defaultPrevented); |
32 | 32 |
33 // Observes the promise and delays calling didHandleFetchEvent() until the | 33 // Observes the promise and delays calling didHandleFetchEvent() until the |
34 // given promise is resolved or rejected. | 34 // given promise is resolved or rejected. |
35 void respondWith(ScriptState*, ScriptPromise&, ExceptionState&); | 35 void respondWith(ScriptState*, ScriptPromise, ExceptionState&); |
36 | 36 |
37 void responseWasRejected(WebServiceWorkerResponseError); | 37 void responseWasRejected(WebServiceWorkerResponseError); |
38 void responseWasFulfilled(const ScriptValue&); | 38 void responseWasFulfilled(const ScriptValue&); |
39 | 39 |
40 DECLARE_VIRTUAL_TRACE(); | 40 DECLARE_VIRTUAL_TRACE(); |
41 | 41 |
42 private: | 42 private: |
43 class ThenFunction; | 43 class ThenFunction; |
44 | 44 |
45 RespondWithObserver(ExecutionContext*, int eventID, const KURL& requestURL,
WebURLRequest::FetchRequestMode, WebURLRequest::FrameType); | 45 RespondWithObserver(ExecutionContext*, int eventID, const KURL& requestURL,
WebURLRequest::FetchRequestMode, WebURLRequest::FrameType); |
46 | 46 |
47 int m_eventID; | 47 int m_eventID; |
48 KURL m_requestURL; | 48 KURL m_requestURL; |
49 WebURLRequest::FetchRequestMode m_requestMode; | 49 WebURLRequest::FetchRequestMode m_requestMode; |
50 WebURLRequest::FrameType m_frameType; | 50 WebURLRequest::FrameType m_frameType; |
51 | 51 |
52 enum State { Initial, Pending, Done }; | 52 enum State { Initial, Pending, Done }; |
53 State m_state; | 53 State m_state; |
54 }; | 54 }; |
55 | 55 |
56 } // namespace blink | 56 } // namespace blink |
57 | 57 |
58 #endif // RespondWithObserver_h | 58 #endif // RespondWithObserver_h |
OLD | NEW |