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

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

Issue 1195023002: Add a Setting to make iframes load at VeryLow priority, disabled by default. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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
Index: Source/core/fetch/ResourceFetcher.cpp
diff --git a/Source/core/fetch/ResourceFetcher.cpp b/Source/core/fetch/ResourceFetcher.cpp
index 27f7aa1c4da11214ec03a1c2ae350bd25f784839..d02da3811d33b0d2f2d2a74f35d9d312e7e17f57 100644
--- a/Source/core/fetch/ResourceFetcher.cpp
+++ b/Source/core/fetch/ResourceFetcher.cpp
@@ -56,7 +56,7 @@ using blink::WebURLRequest;
namespace blink {
-ResourceLoadPriority ResourceFetcher::loadPriority(Resource::Type type, const FetchRequest& request)
+ResourceLoadPriority ResourceFetcher::loadPriority(Resource::Type type, const FetchRequest& request, bool isLowPriorityIframe)
{
// TODO(yoav): Change it here so that priority can be changed even after it was resolved.
if (request.priority() != ResourceLoadPriorityUnresolved)
@@ -64,7 +64,7 @@ ResourceLoadPriority ResourceFetcher::loadPriority(Resource::Type type, const Fe
switch (type) {
case Resource::MainResource:
- return ResourceLoadPriorityVeryHigh;
+ return isLowPriorityIframe ? ResourceLoadPriorityVeryLow : ResourceLoadPriorityVeryHigh;
case Resource::CSSStyleSheet:
return ResourceLoadPriorityHigh;
case Resource::Raw:
@@ -323,7 +323,7 @@ ResourcePtr<Resource> ResourceFetcher::requestResource(FetchRequest& request, co
resource->setIdentifier(createUniqueIdentifier());
if (!request.forPreload() || policy != Use) {
- ResourceLoadPriority priority = loadPriority(factory.type(), request);
+ ResourceLoadPriority priority = loadPriority(factory.type(), request, context().isLowPriorityIframe());
// When issuing another request for a resource that is already in-flight make
// sure to not demote the priority of the in-flight request. If the new request
// isn't at the same priority as the in-flight request, only allow promotions.

Powered by Google App Engine
This is Rietveld 408576698