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

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

Issue 2620463002: Show service worker navigation preload requests in DevTools Network tab (Closed)
Patch Set: fix crash 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 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 cbc0caabae0ea7cffa1de2ffc4a9afd4a358da90..8ade93f2a08cef6a37f70f33598eb373390b9bc8 100644
--- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
+++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
@@ -37,6 +37,7 @@
#include "core/dom/ExecutionContextTask.h"
#include "core/dom/MessagePort.h"
#include "core/inspector/ConsoleMessage.h"
+#include "core/inspector/InspectorInstrumentation.h"
#include "core/origin_trials/OriginTrials.h"
#include "core/workers/ParentFrameTaskRunners.h"
#include "core/workers/WorkerGlobalScope.h"
@@ -61,6 +62,7 @@
#include "modules/serviceworkers/ServiceWorkerWindowClient.h"
#include "modules/serviceworkers/WaitUntilObserver.h"
#include "platform/RuntimeEnabledFeatures.h"
+#include "platform/network/ResourceError.h"
#include "public/platform/modules/notifications/WebNotificationData.h"
#include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h"
#include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h"
@@ -68,6 +70,7 @@
#include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h"
#include "web/WebEmbeddedWorkerImpl.h"
#include "wtf/Assertions.h"
+#include "wtf/CurrentTime.h"
#include "wtf/Functional.h"
#include "wtf/PtrUtil.h"
#include <memory>
@@ -197,10 +200,22 @@ void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(
waitUntilObserver->didDispatchEvent(false /* errorOccurred */);
}
+void ServiceWorkerGlobalScopeProxy::onNavigationPreloadSent(int fetchEventID,
+ const WebURL& url) {
+ FetchInitiatorInfo info;
+ ResourceRequest request(url);
+ InspectorInstrumentation::willSendRequest(workerGlobalScope(), fetchEventID,
+ nullptr, request,
+ ResourceResponse(), info);
+}
+
void ServiceWorkerGlobalScopeProxy::onNavigationPreloadResponse(
int fetchEventID,
std::unique_ptr<WebURLResponse> response,
std::unique_ptr<WebDataConsumerHandle> dataConsumeHandle) {
+ InspectorInstrumentation::didReceiveResourceResponse(
+ workerGlobalScope(), fetchEventID, nullptr,
+ response->toResourceResponse(), nullptr);
FetchEvent* fetchEvent = m_pendingPreloadFetchEvents.take(fetchEventID);
DCHECK(fetchEvent);
fetchEvent->onNavigationPreloadResponse(
@@ -211,6 +226,10 @@ void ServiceWorkerGlobalScopeProxy::onNavigationPreloadResponse(
void ServiceWorkerGlobalScopeProxy::onNavigationPreloadError(
int fetchEventID,
std::unique_ptr<WebServiceWorkerError> error) {
+ InspectorInstrumentation::didFailLoading(
+ workerGlobalScope(), fetchEventID,
+ ResourceError(errorDomainBlinkInternal, 0, "", error->message));
+
FetchEvent* fetchEvent = m_pendingPreloadFetchEvents.take(fetchEventID);
// This method may be called after onNavigationPreloadResponse() was called.
if (!fetchEvent)
@@ -220,6 +239,14 @@ void ServiceWorkerGlobalScopeProxy::onNavigationPreloadError(
std::move(error));
}
+void ServiceWorkerGlobalScopeProxy::onNavigationPreloadCompleted(
+ int fetchEventID,
+ int64_t encodedDataLength) {
+ InspectorInstrumentation::didFinishLoading(workerGlobalScope(), fetchEventID,
+ monotonicallyIncreasingTime(),
+ encodedDataLength);
+}
+
void ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(
int fetchEventID,
const WebServiceWorkerRequest& webRequest) {
« no previous file with comments | « third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h ('k') | third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698