Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h

Issue 1479923002: Enumerate the return value of dispatchEvent so it is clear. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_passive_uma_add
Patch Set: Fix typo Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "core/events/EventTarget.h"
9 #include "modules/ModulesExport.h" 10 #include "modules/ModulesExport.h"
10 #include "platform/heap/Handle.h" 11 #include "platform/heap/Handle.h"
11 #include "public/platform/WebURLRequest.h" 12 #include "public/platform/WebURLRequest.h"
12 #include "public/platform/modules/serviceworker/WebServiceWorkerResponseError.h" 13 #include "public/platform/modules/serviceworker/WebServiceWorkerResponseError.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
16 class ExceptionState; 17 class ExceptionState;
17 class ExecutionContext; 18 class ExecutionContext;
18 class ScriptPromise; 19 class ScriptPromise;
19 class ScriptState; 20 class ScriptState;
20 class ScriptValue; 21 class ScriptValue;
21 22
22 // This class observes the service worker's handling of a FetchEvent and 23 // This class observes the service worker's handling of a FetchEvent and
23 // notifies the client. 24 // notifies the client.
24 class MODULES_EXPORT RespondWithObserver final : public GarbageCollectedFinalize d<RespondWithObserver>, public ContextLifecycleObserver { 25 class MODULES_EXPORT RespondWithObserver final : public GarbageCollectedFinalize d<RespondWithObserver>, public ContextLifecycleObserver {
25 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RespondWithObserver); 26 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RespondWithObserver);
26 public: 27 public:
27 static RespondWithObserver* create(ExecutionContext*, int eventID, const KUR L& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURL Request::RequestContext); 28 static RespondWithObserver* create(ExecutionContext*, int eventID, const KUR L& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURL Request::RequestContext);
28 29
29 void contextDestroyed() override; 30 void contextDestroyed() override;
30 31
31 void didDispatchEvent(bool defaultPrevented); 32 void didDispatchEvent(DispatchEventResult dispatchResult);
32 33
33 // Observes the promise and delays calling didHandleFetchEvent() until the 34 // Observes the promise and delays calling didHandleFetchEvent() until the
34 // given promise is resolved or rejected. 35 // given promise is resolved or rejected.
35 void respondWith(ScriptState*, ScriptPromise, ExceptionState&); 36 void respondWith(ScriptState*, ScriptPromise, ExceptionState&);
36 37
37 void responseWasRejected(WebServiceWorkerResponseError); 38 void responseWasRejected(WebServiceWorkerResponseError);
38 void responseWasFulfilled(const ScriptValue&); 39 void responseWasFulfilled(const ScriptValue&);
39 40
40 DECLARE_VIRTUAL_TRACE(); 41 DECLARE_VIRTUAL_TRACE();
41 42
42 private: 43 private:
43 class ThenFunction; 44 class ThenFunction;
44 45
45 RespondWithObserver(ExecutionContext*, int eventID, const KURL& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURLRequest::Reques tContext); 46 RespondWithObserver(ExecutionContext*, int eventID, const KURL& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURLRequest::Reques tContext);
46 47
47 int m_eventID; 48 int m_eventID;
48 KURL m_requestURL; 49 KURL m_requestURL;
49 WebURLRequest::FetchRequestMode m_requestMode; 50 WebURLRequest::FetchRequestMode m_requestMode;
50 WebURLRequest::FrameType m_frameType; 51 WebURLRequest::FrameType m_frameType;
51 WebURLRequest::RequestContext m_requestContext; 52 WebURLRequest::RequestContext m_requestContext;
52 53
53 enum State { Initial, Pending, Done }; 54 enum State { Initial, Pending, Done };
54 State m_state; 55 State m_state;
55 }; 56 };
56 57
57 } // namespace blink 58 } // namespace blink
58 59
59 #endif // RespondWithObserver_h 60 #endif // RespondWithObserver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698