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

Unified Diff: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 2416843002: Implement FetchEvent.navigationPreload (Closed)
Patch Set: incorporated falken's comment 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/web/ServiceWorkerGlobalScopeProxy.cpp
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
index 867168b7d5ceedaa4be5aa3fd3ec823b5b38112d..723f9803af9b453c862d77f2d32595b2fc4c0e5d 100644
--- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
+++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
@@ -151,7 +151,8 @@ void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(
void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(
int fetchEventID,
- const WebServiceWorkerRequest& webRequest) {
+ const WebServiceWorkerRequest& webRequest,
+ bool navigationPreloadSent) {
ScriptState::Scope scope(
workerGlobalScope()->scriptController()->getScriptState());
WaitUntilObserver* waitUntilObserver = WaitUntilObserver::create(
@@ -168,9 +169,17 @@ void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(
eventInit.setClientId(
webRequest.isMainResourceLoad() ? WebString() : webRequest.clientId());
eventInit.setIsReload(webRequest.isReload());
+ ScriptState* scriptState =
+ workerGlobalScope()->scriptController()->getScriptState();
FetchEvent* fetchEvent = FetchEvent::create(
- workerGlobalScope()->scriptController()->getScriptState(),
- EventTypeNames::fetch, eventInit, respondWithObserver, waitUntilObserver);
+ scriptState, EventTypeNames::fetch, eventInit, respondWithObserver,
+ waitUntilObserver, navigationPreloadSent);
+ if (navigationPreloadSent) {
+ ServiceWorkerGlobalScopeClient::from(workerGlobalScope())
+ ->registerPreloadResponseCallback(
+ fetchEventID,
+ fetchEvent->createPreloadResponseCallback(scriptState));
+ }
waitUntilObserver->willDispatchEvent();
respondWithObserver->willDispatchEvent();
DispatchEventResult dispatchResult =

Powered by Google App Engine
This is Rietveld 408576698