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

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

Issue 2383403002: Reflow comments in core/loader (Closed)
Patch Set: Created 4 years, 2 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 const LinkRelAttribute& relAttribute, 128 const LinkRelAttribute& relAttribute,
129 const KURL& href, 129 const KURL& href,
130 Document& document, 130 Document& document,
131 const NetworkHintsInterface& networkHintsInterface, 131 const NetworkHintsInterface& networkHintsInterface,
132 LinkCaller caller) { 132 LinkCaller caller) {
133 if (relAttribute.isDNSPrefetch()) { 133 if (relAttribute.isDNSPrefetch()) {
134 UseCounter::count(document, UseCounter::LinkRelDnsPrefetch); 134 UseCounter::count(document, UseCounter::LinkRelDnsPrefetch);
135 if (caller == LinkCalledFromHeader) 135 if (caller == LinkCalledFromHeader)
136 UseCounter::count(document, UseCounter::LinkHeaderDnsPrefetch); 136 UseCounter::count(document, UseCounter::LinkHeaderDnsPrefetch);
137 Settings* settings = document.settings(); 137 Settings* settings = document.settings();
138 // FIXME: The href attribute of the link element can be in "//hostname" form , and we shouldn't attempt 138 // FIXME: The href attribute of the link element can be in "//hostname"
139 // to complete that as URL <https://bugs.webkit.org/show_bug.cgi?id=48857>. 139 // form, and we shouldn't attempt to complete that as URL
140 // <https://bugs.webkit.org/show_bug.cgi?id=48857>.
140 if (settings && settings->dnsPrefetchingEnabled() && href.isValid() && 141 if (settings && settings->dnsPrefetchingEnabled() && href.isValid() &&
141 !href.isEmpty()) { 142 !href.isEmpty()) {
142 if (settings->logDnsPrefetchAndPreconnect()) 143 if (settings->logDnsPrefetchAndPreconnect())
143 document.addConsoleMessage(ConsoleMessage::create( 144 document.addConsoleMessage(ConsoleMessage::create(
144 OtherMessageSource, DebugMessageLevel, 145 OtherMessageSource, DebugMessageLevel,
145 String("DNS prefetch triggered for " + href.host()))); 146 String("DNS prefetch triggered for " + href.host())));
146 networkHintsInterface.dnsPrefetchHost(href.host()); 147 networkHintsInterface.dnsPrefetchHost(href.host());
147 } 148 }
148 } 149 }
149 } 150 }
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, 381 bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute,
381 CrossOriginAttributeValue crossOrigin, 382 CrossOriginAttributeValue crossOrigin,
382 const String& type, 383 const String& type,
383 const String& as, 384 const String& as,
384 const String& media, 385 const String& media,
385 const KURL& href, 386 const KURL& href,
386 Document& document, 387 Document& document,
387 const NetworkHintsInterface& networkHintsInterface) { 388 const NetworkHintsInterface& networkHintsInterface) {
388 // TODO(yoav): Do all links need to load only after they're in document??? 389 // TODO(yoav): Do all links need to load only after they're in document???
389 390
390 // TODO(yoav): Convert all uses of the CrossOriginAttribute to CrossOriginAttr ibuteValue. crbug.com/486689 391 // TODO(yoav): Convert all uses of the CrossOriginAttribute to
391 // FIXME(crbug.com/463266): We're ignoring type here, for everything but prelo ad. Maybe we shouldn't. 392 // CrossOriginAttributeValue. crbug.com/486689
393
394 // FIXME(crbug.com/463266): We're ignoring type here, for everything but
395 // preload. Maybe we shouldn't.
392 dnsPrefetchIfNeeded(relAttribute, href, document, networkHintsInterface, 396 dnsPrefetchIfNeeded(relAttribute, href, document, networkHintsInterface,
393 LinkCalledFromMarkup); 397 LinkCalledFromMarkup);
394 398
395 preconnectIfNeeded(relAttribute, href, document, crossOrigin, 399 preconnectIfNeeded(relAttribute, href, document, crossOrigin,
396 networkHintsInterface, LinkCalledFromMarkup); 400 networkHintsInterface, LinkCalledFromMarkup);
397 401
398 bool errorOccurred = false; 402 bool errorOccurred = false;
399 if (m_client->shouldLoadLink()) 403 if (m_client->shouldLoadLink())
400 createLinkPreloadResourceClient(preloadIfNeeded( 404 createLinkPreloadResourceClient(preloadIfNeeded(
401 relAttribute, href, document, as, type, media, crossOrigin, 405 relAttribute, href, document, as, type, media, crossOrigin,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 } 437 }
434 // TODO(gavinp): Handle changes to rel types of existing prerenders. 438 // TODO(gavinp): Handle changes to rel types of existing prerenders.
435 } else if (m_prerender) { 439 } else if (m_prerender) {
436 m_prerender->cancel(); 440 m_prerender->cancel();
437 m_prerender.clear(); 441 m_prerender.clear();
438 } 442 }
439 return true; 443 return true;
440 } 444 }
441 445
442 void LinkLoader::released() { 446 void LinkLoader::released() {
443 // Only prerenders need treatment here; other links either use the Resource in terface, or are notionally 447 // Only prerenders need treatment here; other links either use the Resource
444 // atomic (dns prefetch). 448 // interface, or are notionally atomic (dns prefetch).
445 if (m_prerender) { 449 if (m_prerender) {
446 m_prerender->cancel(); 450 m_prerender->cancel();
447 m_prerender.clear(); 451 m_prerender.clear();
448 } 452 }
449 if (m_linkPreloadResourceClient) 453 if (m_linkPreloadResourceClient)
450 m_linkPreloadResourceClient->clear(); 454 m_linkPreloadResourceClient->clear();
451 } 455 }
452 456
453 DEFINE_TRACE(LinkLoader) { 457 DEFINE_TRACE(LinkLoader) {
454 visitor->trace(m_client); 458 visitor->trace(m_client);
455 visitor->trace(m_prerender); 459 visitor->trace(m_prerender);
456 visitor->trace(m_linkPreloadResourceClient); 460 visitor->trace(m_linkPreloadResourceClient);
457 ResourceOwner<Resource, ResourceClient>::trace(visitor); 461 ResourceOwner<Resource, ResourceClient>::trace(visitor);
458 PrerenderClient::trace(visitor); 462 PrerenderClient::trace(visitor);
459 } 463 }
460 464
461 } // namespace blink 465 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698