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

Unified Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 2578983002: Loading: move V8DOMActivityLogger dependency from core/fetch (Closed)
Patch Set: merge 2572373003/#ps20001 Created 4 years 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/core/loader/FrameFetchContext.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
index 4682c6d8066a059b8ef8207d1b81bce646086a02..d34a24d5d65e635b30797fb93a39c42eae1b2f3d 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -31,8 +31,11 @@
#include "core/loader/FrameFetchContext.h"
#include "bindings/core/v8/ScriptController.h"
+#include "bindings/core/v8/V8DOMActivityLogger.h"
#include "core/dom/Document.h"
#include "core/fetch/ClientHintsPreferences.h"
+#include "core/fetch/FetchInitiatorTypeNames.h"
+#include "core/fetch/Resource.h"
#include "core/fetch/ResourceLoadingLog.h"
#include "core/fetch/UniqueIdentifier.h"
#include "core/frame/FrameConsole.h"
@@ -76,6 +79,7 @@
#include "public/platform/WebDocumentSubresourceFilter.h"
#include "public/platform/WebInsecureRequestPolicy.h"
#include "public/platform/WebViewScheduler.h"
+#include "wtf/Vector.h"
#include <algorithm>
#include <memory>
@@ -528,9 +532,12 @@ loadResourceTraceData(unsigned long identifier, const KURL& url, int priority) {
return value;
}
-void FrameFetchContext::willStartLoadingResource(unsigned long identifier,
- ResourceRequest& request,
- Resource::Type type) {
+void FrameFetchContext::willStartLoadingResource(
+ unsigned long identifier,
+ ResourceRequest& request,
+ Resource::Type type,
+ const AtomicString& fetchInitiatorName,
+ bool forPreload) {
TRACE_EVENT_ASYNC_BEGIN1(
"blink.net", "Resource", identifier, "data",
loadResourceTraceData(identifier, request.url(), request.priority()));
@@ -545,6 +552,23 @@ void FrameFetchContext::willStartLoadingResource(unsigned long identifier,
} else {
m_documentLoader->applicationCacheHost()->willStartLoadingResource(request);
}
+ if (!forPreload) {
+ V8DOMActivityLogger* activityLogger = nullptr;
+ if (fetchInitiatorName == FetchInitiatorTypeNames::xmlhttprequest) {
+ activityLogger = V8DOMActivityLogger::currentActivityLogger();
+ } else {
+ activityLogger =
+ V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld();
+ }
+
+ if (activityLogger) {
+ Vector<String> argv;
+ argv.append(Resource::resourceTypeToString(type, fetchInitiatorName));
+ argv.append(request.url());
+ activityLogger->logEvent("blinkRequestResource", argv.size(),
+ argv.data());
+ }
+ }
}
void FrameFetchContext::didLoadResource(Resource* resource) {

Powered by Google App Engine
This is Rietveld 408576698