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

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

Issue 2416843002: Implement FetchEvent.navigationPreload (Closed)
Patch Set: stop using nullable promise Created 4 years, 2 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/FetchEvent.h
diff --git a/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h b/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h
index 98e7c440390a4af4310e155e1c9a1e787e4c4409..b8e6289c6edf10949b96a4ae9111bde03c0e14f3 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h
+++ b/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h
@@ -6,6 +6,7 @@
#define FetchEvent_h
#include "bindings/core/v8/ScriptPromise.h"
+#include "bindings/core/v8/ScriptPromiseProperty.h"
#include "modules/EventModules.h"
#include "modules/ModulesExport.h"
#include "modules/fetch/Request.h"
@@ -19,7 +20,12 @@ namespace blink {
class ExceptionState;
class Request;
+class Response;
class RespondWithObserver;
+class ScriptState;
+class WebDataConsumerHandle;
+struct WebServiceWorkerError;
+class WebServiceWorkerResponse;
// A fetch event is dispatched by the client to a service worker's script
// context. RespondWithObserver can be used to notify the client about the
@@ -28,6 +34,9 @@ class MODULES_EXPORT FetchEvent final : public ExtendableEvent {
DEFINE_WRAPPERTYPEINFO();
public:
+ using PreloadResponseProperty = ScriptPromiseProperty<Member<FetchEvent>,
+ Member<Response>,
+ Member<DOMException>>;
static FetchEvent* create(ScriptState*,
const AtomicString& type,
const FetchEventInit&);
@@ -35,13 +44,19 @@ class MODULES_EXPORT FetchEvent final : public ExtendableEvent {
const AtomicString& type,
const FetchEventInit&,
RespondWithObserver*,
- WaitUntilObserver*);
+ WaitUntilObserver*,
+ bool navigationPreloadSent);
Request* request() const;
String clientId() const;
bool isReload() const;
void respondWith(ScriptState*, ScriptPromise, ExceptionState&);
+ ScriptPromise navigationPreload(ScriptState*);
+
+ void onNavigationPreloadResponse(std::unique_ptr<WebServiceWorkerResponse>,
+ std::unique_ptr<WebDataConsumerHandle>);
+ void onNavigationPreloadError(std::unique_ptr<WebServiceWorkerError>);
const AtomicString& interfaceName() const override;
@@ -52,11 +67,14 @@ class MODULES_EXPORT FetchEvent final : public ExtendableEvent {
const AtomicString& type,
const FetchEventInit&,
RespondWithObserver*,
- WaitUntilObserver*);
+ WaitUntilObserver*,
+ bool navigationPreloadSent);
private:
+ RefPtr<ScriptState> m_scriptState;
Member<RespondWithObserver> m_observer;
Member<Request> m_request;
+ Member<PreloadResponseProperty> m_navigationPreloadProperty;
String m_clientId;
bool m_isReload;
};

Powered by Google App Engine
This is Rietveld 408576698