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

Side by Side Diff: third_party/WebKit/Source/core/loader/LinkLoader.cpp

Issue 2072613002: Make ResourceLoadPriority calculation simpler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/LinkResource.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 ResourceFetcher::determineRequestContext(resourceRequest, resourceType, fals e); 290 ResourceFetcher::determineRequestContext(resourceRequest, resourceType, fals e);
291 FetchRequest linkRequest(resourceRequest, FetchInitiatorTypeNames::link, doc ument.encodingName()); 291 FetchRequest linkRequest(resourceRequest, FetchInitiatorTypeNames::link, doc ument.encodingName());
292 292
293 if (crossOrigin != CrossOriginAttributeNotSet) 293 if (crossOrigin != CrossOriginAttributeNotSet)
294 linkRequest.setCrossOriginAccessControl(document.getSecurityOrigin(), cr ossOrigin); 294 linkRequest.setCrossOriginAccessControl(document.getSecurityOrigin(), cr ossOrigin);
295 Settings* settings = document.settings(); 295 Settings* settings = document.settings();
296 if (settings && settings->logPreload()) 296 if (settings && settings->logPreload())
297 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, De bugMessageLevel, String("Preload triggered for " + href.host() + href.path()))); 297 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, De bugMessageLevel, String("Preload triggered for " + href.host() + href.path())));
298 linkRequest.setForPreload(true, monotonicallyIncreasingTime()); 298 linkRequest.setForPreload(true, monotonicallyIncreasingTime());
299 linkRequest.setLinkPreload(true); 299 linkRequest.setLinkPreload(true);
300 linkRequest.setPriority(document.fetcher()->loadPriority(resourceType, linkR equest)); 300 if (resourceType == Resource::LinkPreload)
301 linkRequest.setDefer(FetchRequest::LazyLoad);
Yoav Weiss 2016/06/30 09:09:14 I think you left that one out, as we said LinkPrel
Nate Chapin 2016/07/20 19:05:03 The tests currently expect LinkPreloads to be prio
301 return document.loader()->startPreload(resourceType, linkRequest); 302 return document.loader()->startPreload(resourceType, linkRequest);
302 } 303 }
303 304
304 void LinkLoader::loadLinksFromHeader(const String& headerValue, const KURL& base URL, Document* document, const NetworkHintsInterface& networkHintsInterface, 305 void LinkLoader::loadLinksFromHeader(const String& headerValue, const KURL& base URL, Document* document, const NetworkHintsInterface& networkHintsInterface,
305 CanLoadResources canLoadResources, ViewportDescriptionWrapper* viewportDescr iptionWrapper) 306 CanLoadResources canLoadResources, ViewportDescriptionWrapper* viewportDescr iptionWrapper)
306 { 307 {
307 if (!document || headerValue.isEmpty()) 308 if (!document || headerValue.isEmpty())
308 return; 309 return;
309 LinkHeaderSet headerSet(headerValue); 310 LinkHeaderSet headerSet(headerValue);
310 for (auto& header : headerSet) { 311 for (auto& header : headerSet) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 DEFINE_TRACE(LinkLoader) 394 DEFINE_TRACE(LinkLoader)
394 { 395 {
395 visitor->trace(m_client); 396 visitor->trace(m_client);
396 visitor->trace(m_prerender); 397 visitor->trace(m_prerender);
397 visitor->trace(m_linkPreloadResourceClient); 398 visitor->trace(m_linkPreloadResourceClient);
398 ResourceOwner<Resource, ResourceClient>::trace(visitor); 399 ResourceOwner<Resource, ResourceClient>::trace(visitor);
399 PrerenderClient::trace(visitor); 400 PrerenderClient::trace(visitor);
400 } 401 }
401 402
402 } // namespace blink 403 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/LinkResource.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698