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

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp

Issue 2417173002: Loading: bulk style errors fix in core/fetch (Closed)
Patch Set: Created 4 years, 2 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/core/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
index 05af9497195ce3039210d337f13a1f1aa7ffb4e9..c11d7205ebfb2a54c6ebbb79e1c4cac2f2906b69 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -324,10 +324,11 @@ void ResourceFetcher::requestLoadStarted(unsigned long identifier,
bool isStaticData) {
if (type == ResourceLoadingFromCache &&
resource->getStatus() == Resource::Cached &&
- !m_validatedURLs.contains(resource->url()))
+ !m_validatedURLs.contains(resource->url())) {
context().dispatchDidLoadResourceFromMemoryCache(
identifier, resource, request.resourceRequest().frameType(),
request.resourceRequest().requestContext());
+ }
if (isStaticData)
return;
@@ -522,11 +523,12 @@ Resource* ResourceFetcher::requestResource(
if (!request.forPreload()) {
V8DOMActivityLogger* activityLogger = nullptr;
if (request.options().initiatorInfo.name ==
- FetchInitiatorTypeNames::xmlhttprequest)
+ FetchInitiatorTypeNames::xmlhttprequest) {
activityLogger = V8DOMActivityLogger::currentActivityLogger();
- else
+ } else {
activityLogger =
V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld();
+ }
if (activityLogger) {
Vector<String> argv;
@@ -550,9 +552,10 @@ Resource* ResourceFetcher::requestResource(
if (!resource && !isDataUrl && m_archive)
return nullptr;
}
- if (!resource)
+ if (!resource) {
resource =
memoryCache()->resourceForURL(request.url(), getCacheIdentifier());
+ }
// See if we can use an existing resource from the cache. If so, we need to
// move it to be load blocking.
@@ -688,13 +691,15 @@ void ResourceFetcher::initializeRevalidation(
resource->response().httpHeaderField(HTTPNames::ETag);
if (!lastModified.isEmpty() || !eTag.isEmpty()) {
DCHECK_NE(context().getCachePolicy(), CachePolicyReload);
- if (context().getCachePolicy() == CachePolicyRevalidate)
+ if (context().getCachePolicy() == CachePolicyRevalidate) {
revalidatingRequest.setHTTPHeaderField(HTTPNames::Cache_Control,
"max-age=0");
+ }
}
- if (!lastModified.isEmpty())
+ if (!lastModified.isEmpty()) {
revalidatingRequest.setHTTPHeaderField(HTTPNames::If_Modified_Since,
lastModified);
+ }
if (!eTag.isEmpty())
revalidatingRequest.setHTTPHeaderField(HTTPNames::If_None_Match, eTag);
@@ -1220,9 +1225,10 @@ void ResourceFetcher::didReceiveResponse(Resource* resource,
resource->resourceRequest().requestContext(), resource);
resource->responseReceived(response, std::move(handle));
if (resource->loader() && response.httpStatusCode() >= 400 &&
- !resource->shouldIgnoreHTTPStatusCodeErrors())
+ !resource->shouldIgnoreHTTPStatusCodeErrors()) {
resource->loader()->didFail(nullptr,
ResourceError::cancelledError(response.url()));
+ }
}
void ResourceFetcher::didReceiveData(const Resource* resource,

Powered by Google App Engine
This is Rietveld 408576698