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

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

Issue 2676163002: Refactor the forPreload flag to mean speculative preload. (Closed)
Patch Set: Created 3 years, 10 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
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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 if (crossOrigin != CrossOriginAttributeNotSet) { 332 if (crossOrigin != CrossOriginAttributeNotSet) {
333 linkRequest.setCrossOriginAccessControl(document.getSecurityOrigin(), 333 linkRequest.setCrossOriginAccessControl(document.getSecurityOrigin(),
334 crossOrigin); 334 crossOrigin);
335 } 335 }
336 Settings* settings = document.settings(); 336 Settings* settings = document.settings();
337 if (settings && settings->getLogPreload()) { 337 if (settings && settings->getLogPreload()) {
338 document.addConsoleMessage(ConsoleMessage::create( 338 document.addConsoleMessage(ConsoleMessage::create(
339 OtherMessageSource, VerboseMessageLevel, 339 OtherMessageSource, VerboseMessageLevel,
340 String("Preload triggered for " + href.host() + href.path()))); 340 String("Preload triggered for " + href.host() + href.path())));
341 } 341 }
342 linkRequest.setForPreload(true, monotonicallyIncreasingTime());
Charlie Harrison 2017/02/05 18:39:11 I think this will affect metrics, but I think it i
Yoav Weiss 2017/02/06 09:58:35 Yeah, I agree
343 linkRequest.setLinkPreload(true); 342 linkRequest.setLinkPreload(true);
344 return document.loader()->startPreload(resourceType.value(), linkRequest); 343 return document.loader()->startPreload(resourceType.value(), linkRequest);
345 } 344 }
346 345
347 static Resource* prefetchIfNeeded(Document& document, 346 static Resource* prefetchIfNeeded(Document& document,
348 const KURL& href, 347 const KURL& href,
349 const LinkRelAttribute& relAttribute, 348 const LinkRelAttribute& relAttribute,
350 CrossOriginAttributeValue crossOrigin, 349 CrossOriginAttributeValue crossOrigin,
351 ReferrerPolicy referrerPolicy) { 350 ReferrerPolicy referrerPolicy) {
352 if (relAttribute.isLinkPrefetch() && href.isValid() && document.frame()) { 351 if (relAttribute.isLinkPrefetch() && href.isValid() && document.frame()) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 488
490 DEFINE_TRACE(LinkLoader) { 489 DEFINE_TRACE(LinkLoader) {
491 visitor->trace(m_client); 490 visitor->trace(m_client);
492 visitor->trace(m_prerender); 491 visitor->trace(m_prerender);
493 visitor->trace(m_linkPreloadResourceClient); 492 visitor->trace(m_linkPreloadResourceClient);
494 ResourceOwner<Resource, ResourceClient>::trace(visitor); 493 ResourceOwner<Resource, ResourceClient>::trace(visitor);
495 PrerenderClient::trace(visitor); 494 PrerenderClient::trace(visitor);
496 } 495 }
497 496
498 } // namespace blink 497 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698