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

Unified Diff: third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h

Issue 2715663002: ServiceWorker: Factor out FetchEvent related logics from RespondWithObserver. (Closed)
Patch Set: RespondWithObserver Created 3 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 side-by-side diff with in-line comments
Download patch
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 194402fda7f9365f9634ccea5889ad217e3299a7..388a870ab753e13aefb70f29fba1e405ff291f86 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h
+++ b/third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.h
@@ -8,9 +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"
namespace blink {
@@ -20,9 +18,10 @@ class ExecutionContext;
class ScriptPromise;
class ScriptState;
class ScriptValue;
+class WaitUntilObserver;
-// This class observes the service worker's handling of a FetchEvent and
-// notifies the client.
+// This class observes the service worker's handling of events which have
shimazu 2017/03/08 01:39:03 I feel it's better to rewrite this comment to desc
falken 2017/03/09 04:59:00 +1. Is this base class ever supposed to be instant
zino 2017/03/10 17:57:17 Done.
+// respondWith(), and notifies the client.
class MODULES_EXPORT RespondWithObserver
: public GarbageCollectedFinalized<RespondWithObserver>,
public ContextLifecycleObserver {
@@ -32,48 +31,28 @@ class MODULES_EXPORT RespondWithObserver
virtual ~RespondWithObserver();
static RespondWithObserver* create(ExecutionContext*,
- int fetchEventID,
- const KURL& requestURL,
- WebURLRequest::FetchRequestMode,
- WebURLRequest::FetchRedirectMode,
- WebURLRequest::FrameType,
- WebURLRequest::RequestContext,
+ int eventID,
WaitUntilObserver*);
falken 2017/03/09 04:59:00 Is this function used?
zino 2017/03/10 17:57:17 Done.
void contextDestroyed(ExecutionContext*) override;
void willDispatchEvent();
- void didDispatchEvent(DispatchEventResult dispatchResult);
+ virtual void didDispatchEvent(DispatchEventResult dispatchResult);
- // Observes the promise and delays calling didHandleFetchEvent() until the
- // given promise is resolved or rejected.
+ // Observes the promise and delays calling didHandle*Event() until the given
falken 2017/03/09 04:59:00 This comment may be confusing since this class doe
+ // promise is resolved or rejected.
void respondWith(ScriptState*, ScriptPromise, ExceptionState&);
- void responseWasRejected(WebServiceWorkerResponseError);
+ virtual void responseWasRejected(WebServiceWorkerResponseError);
virtual void responseWasFulfilled(const ScriptValue&);
DECLARE_VIRTUAL_TRACE();
protected:
- RespondWithObserver(ExecutionContext*,
- int fetchEventID,
- const KURL& requestURL,
- WebURLRequest::FetchRequestMode,
- WebURLRequest::FetchRedirectMode,
- WebURLRequest::FrameType,
- WebURLRequest::RequestContext,
- WaitUntilObserver*);
-
- private:
class ThenFunction;
- const int m_fetchEventID;
- const KURL m_requestURL;
- const WebURLRequest::FetchRequestMode m_requestMode;
- const WebURLRequest::FetchRedirectMode m_redirectMode;
- const WebURLRequest::FrameType m_frameType;
- const WebURLRequest::RequestContext m_requestContext;
-
+ RespondWithObserver(ExecutionContext*, int eventID, WaitUntilObserver*);
+ const int m_eventID;
double m_eventDispatchTime = 0;
enum State { Initial, Pending, Done };

Powered by Google App Engine
This is Rietveld 408576698