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

Side by Side Diff: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 2618313003: Use WebURLResponse to pass the navigation preload response from SWContextClient to FetchEvent. (Closed)
Patch Set: incorporated falken's comment Created 3 years, 11 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "modules/serviceworkers/ForeignFetchEvent.h" 57 #include "modules/serviceworkers/ForeignFetchEvent.h"
58 #include "modules/serviceworkers/InstallEvent.h" 58 #include "modules/serviceworkers/InstallEvent.h"
59 #include "modules/serviceworkers/ServiceWorkerClient.h" 59 #include "modules/serviceworkers/ServiceWorkerClient.h"
60 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" 60 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h"
61 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" 61 #include "modules/serviceworkers/ServiceWorkerWindowClient.h"
62 #include "modules/serviceworkers/WaitUntilObserver.h" 62 #include "modules/serviceworkers/WaitUntilObserver.h"
63 #include "platform/RuntimeEnabledFeatures.h" 63 #include "platform/RuntimeEnabledFeatures.h"
64 #include "public/platform/modules/notifications/WebNotificationData.h" 64 #include "public/platform/modules/notifications/WebNotificationData.h"
65 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h" 65 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h"
66 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" 66 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h"
67 #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h"
68 #include "public/web/WebSerializedScriptValue.h" 67 #include "public/web/WebSerializedScriptValue.h"
69 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" 68 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h"
70 #include "web/WebEmbeddedWorkerImpl.h" 69 #include "web/WebEmbeddedWorkerImpl.h"
71 #include "wtf/Assertions.h" 70 #include "wtf/Assertions.h"
72 #include "wtf/Functional.h" 71 #include "wtf/Functional.h"
73 #include "wtf/PtrUtil.h" 72 #include "wtf/PtrUtil.h"
74 #include <memory> 73 #include <memory>
75 #include <utility> 74 #include <utility>
76 75
77 namespace blink { 76 namespace blink {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 DispatchEventResult dispatchResult = 192 DispatchEventResult dispatchResult =
194 workerGlobalScope()->dispatchEvent(fetchEvent); 193 workerGlobalScope()->dispatchEvent(fetchEvent);
195 respondWithObserver->didDispatchEvent(dispatchResult); 194 respondWithObserver->didDispatchEvent(dispatchResult);
196 // false is okay because waitUntil for fetch event doesn't care about the 195 // false is okay because waitUntil for fetch event doesn't care about the
197 // promise rejection or an uncaught runtime script error. 196 // promise rejection or an uncaught runtime script error.
198 waitUntilObserver->didDispatchEvent(false /* errorOccurred */); 197 waitUntilObserver->didDispatchEvent(false /* errorOccurred */);
199 } 198 }
200 199
201 void ServiceWorkerGlobalScopeProxy::onNavigationPreloadResponse( 200 void ServiceWorkerGlobalScopeProxy::onNavigationPreloadResponse(
202 int fetchEventID, 201 int fetchEventID,
203 std::unique_ptr<WebServiceWorkerResponse> response, 202 std::unique_ptr<WebURLResponse> response,
204 std::unique_ptr<WebDataConsumerHandle> dataConsumeHandle) { 203 std::unique_ptr<WebDataConsumerHandle> dataConsumeHandle) {
205 FetchEvent* fetchEvent = m_pendingPreloadFetchEvents.take(fetchEventID); 204 FetchEvent* fetchEvent = m_pendingPreloadFetchEvents.take(fetchEventID);
206 DCHECK(fetchEvent); 205 DCHECK(fetchEvent);
207 fetchEvent->onNavigationPreloadResponse( 206 fetchEvent->onNavigationPreloadResponse(
208 workerGlobalScope()->scriptController()->getScriptState(), 207 workerGlobalScope()->scriptController()->getScriptState(),
209 std::move(response), std::move(dataConsumeHandle)); 208 std::move(response), std::move(dataConsumeHandle));
210 } 209 }
211 210
212 void ServiceWorkerGlobalScopeProxy::onNavigationPreloadError( 211 void ServiceWorkerGlobalScopeProxy::onNavigationPreloadError(
213 int fetchEventID, 212 int fetchEventID,
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 return *m_document; 486 return *m_document;
488 } 487 }
489 488
490 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() 489 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope()
491 const { 490 const {
492 DCHECK(m_workerGlobalScope); 491 DCHECK(m_workerGlobalScope);
493 return m_workerGlobalScope; 492 return m_workerGlobalScope;
494 } 493 }
495 494
496 } // namespace blink 495 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698