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

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

Issue 314423004: Handle main resource preload request better (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/ResourceFetcher.cpp
diff --git a/Source/core/fetch/ResourceFetcher.cpp b/Source/core/fetch/ResourceFetcher.cpp
index f92a1d343172d46cdbbddd5226f0d742b20f7dfe..f9aaea5f86d191b02f4ba1b7b6a55820f95ffbc2 100644
--- a/Source/core/fetch/ResourceFetcher.cpp
+++ b/Source/core/fetch/ResourceFetcher.cpp
@@ -674,6 +674,11 @@ ResourcePtr<Resource> ResourceFetcher::requestResource(Resource::Type type, Fetc
{
ASSERT(request.options().synchronousPolicy == RequestAsynchronously || type == Resource::Raw);
+ // If loading main resource ensure main resources aren't preloaded.
+ if (type == Resource::MainResource && request.forPreload()) {
Nate Chapin 2014/06/06 23:00:01 Ok. What if we move both this and the old code blo
+ return 0;
+ }
+
TRACE_EVENT0("webkit", "ResourceFetcher::requestResource");
KURL url = request.resourceRequest().url();
@@ -756,14 +761,11 @@ ResourcePtr<Resource> ResourceFetcher::requestResource(Resource::Type type, Fetc
// resources, we should be sure to understand the implications for memory
// use.
//
- // Ensure main resources aren't preloaded, and other main resource loads
- // are removed from cache to prevent reuse.
+ // Main resource loads are removed from cache to prevent reuse.
if (type == Resource::MainResource) {
ASSERT(policy != Use || m_documentLoader->substituteData().isValid());
ASSERT(policy != Revalidate);
memoryCache()->remove(resource.get());
- if (request.forPreload())
- return 0;
}
requestLoadStarted(resource.get(), request, policy == Use ? ResourceLoadingFromCache : ResourceLoadingFromNetwork);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698