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

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

Issue 2747203002: Make prepareRequest() a separate callback of FetchContext (Closed)
Patch Set: . 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 987e0fd284e3b501a07b777a2cfe5f5fbdf931fe..ee510c47ba1cfb55de484586904e93bdd8fa8b0f 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -499,12 +499,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;
@@ -537,6 +536,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