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

Unified Diff: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp

Issue 2747203002: Make prepareRequest() a separate callback of FetchContext (Closed)
Patch Set: addressed comments Created 3 years, 9 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/platform/loader/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
index 596adba64d86b8a6775002e2e350284ecd05409c..27cacaeec1acb8524d186339f8ec5fea16f2903a 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -506,12 +506,11 @@ ResourceFetcher::PrepareRequestResult ResourceFetcher::prepareRequest(
return Block;
}
- context().willStartLoadingResource(
- identifier, resourceRequest, factory.type(),
- request.options().initiatorInfo.name,
- (request.isSpeculativePreload()
- ? FetchContext::V8ActivityLoggingPolicy::SuppressLogging
- : FetchContext::V8ActivityLoggingPolicy::Log));
+ // For initial requests, call prepareRequest() here before revalidation
+ // policy is determined.
+ context().prepareRequest(resourceRequest,
+ FetchContext::RedirectType::kNotForRedirect);
+
if (!request.url().isValid())
return Abort;
@@ -544,6 +543,12 @@ Resource* ResourceFetcher::requestResource(
if (result == Block)
return resourceForBlockedRequest(request, factory, blockedReason);
+ if (!request.isSpeculativePreload()) {
+ // Only log if it's not for speculative preload.
+ context().recordLoadingActivity(identifier, resourceRequest, factory.type(),
+ request.options().initiatorInfo.name);
+ }
+
bool isDataUrl = resourceRequest.url().protocolIsData();
bool isStaticData = isDataUrl || substituteData.isValid() || m_archive;
if (isStaticData) {

Powered by Google App Engine
This is Rietveld 408576698