| 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 a5eae6c5bf861db7dc1fd4028a4489e01506f60b..c47a3571ebac2ffc83cd56b8cb2eae189932848b 100644
|
| --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
|
| +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
|
| @@ -157,7 +157,8 @@ ResourceLoadPriority ResourceFetcher::computeLoadPriority(
|
| const ResourceRequest& resourceRequest,
|
| ResourcePriority::VisibilityStatus visibility,
|
| FetchRequest::DeferOption deferOption,
|
| - bool speculativePreload) {
|
| + bool isSpeculativePreload,
|
| + bool isLinkPreload) {
|
| ResourceLoadPriority priority = typeToPriority(type);
|
|
|
| // Visible resources (images in practice) get a boost to High priority.
|
| @@ -169,9 +170,14 @@ ResourceLoadPriority ResourceFetcher::computeLoadPriority(
|
| // note that this is based on when the preload scanner discovers a resource
|
| // for the most part so the main parser may not have reached the image element
|
| // yet.
|
| - if (type == Resource::Image)
|
| + if (type == Resource::Image && !isLinkPreload)
|
| m_imageFetched = true;
|
|
|
| + // A preloaded font should not take precedence over critical CSS or
|
| + // parser-blocking scripts.
|
| + if (type == Resource::Font && isLinkPreload)
|
| + priority = ResourceLoadPriorityHigh;
|
| +
|
| if (FetchRequest::IdleLoad == deferOption) {
|
| priority = ResourceLoadPriorityVeryLow;
|
| } else if (type == Resource::Script) {
|
| @@ -182,7 +188,7 @@ ResourceLoadPriority ResourceFetcher::computeLoadPriority(
|
| // Preload late in document: Medium
|
| if (FetchRequest::LazyLoad == deferOption) {
|
| priority = ResourceLoadPriorityLow;
|
| - } else if (speculativePreload && m_imageFetched) {
|
| + } else if (isSpeculativePreload && m_imageFetched) {
|
| // Speculative preload is used as a signal for scripts at the bottom of
|
| // the document.
|
| priority = ResourceLoadPriorityMedium;
|
| @@ -480,7 +486,8 @@ ResourceFetcher::PrepareRequestResult ResourceFetcher::prepareRequest(
|
|
|
| resourceRequest.setPriority(computeLoadPriority(
|
| factory.type(), request.resourceRequest(), ResourcePriority::NotVisible,
|
| - request.defer(), request.isSpeculativePreload()));
|
| + request.defer(), request.isSpeculativePreload(),
|
| + request.isLinkPreload()));
|
| initializeResourceRequest(resourceRequest, factory.type(), request.defer());
|
| network_instrumentation::resourcePrioritySet(identifier,
|
| resourceRequest.priority());
|
|
|