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

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

Issue 514893002: Lower priority of async scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cleaned up a few stray member variables Created 6 years, 3 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 | « Source/core/fetch/FetchRequest.h ('k') | Source/core/html/parser/HTMLPreloadScanner.cpp » ('j') | 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 a68391978a14becd56019fead25d2cd78ba5f250..15c75596971ad0f937f0542849fffb8667f9a991 100644
--- a/Source/core/fetch/ResourceFetcher.cpp
+++ b/Source/core/fetch/ResourceFetcher.cpp
@@ -124,11 +124,16 @@ static ResourceLoadPriority loadPriority(Resource::Type type, const FetchRequest
case Resource::Raw:
return request.options().synchronousPolicy == RequestSynchronously ? ResourceLoadPriorityVeryHigh : ResourceLoadPriorityMedium;
case Resource::Script:
+ // Async scripts do not block the parser so they get the lowest priority and can be
+ // loaded in parser order with images.
+ if (FetchRequest::LazyLoad == request.defer())
+ return ResourceLoadPriorityLow;
+ return ResourceLoadPriorityMedium;
case Resource::Font:
case Resource::ImportResource:
return ResourceLoadPriorityMedium;
case Resource::Image:
- // We'll default images to VeryLow, and promote whatever is visible. This improves
+ // Default images to VeryLow, and promote whatever is visible. This improves
// speed-index by ~5% on average, ~14% at the 99th percentile.
return ResourceLoadPriorityVeryLow;
case Resource::Media:
« no previous file with comments | « Source/core/fetch/FetchRequest.h ('k') | Source/core/html/parser/HTMLPreloadScanner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698