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

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

Issue 2173953002: Remove LinkPreconnect runtime flag (status=stable) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 } 153 }
154 } 154 }
155 155
156 static void preconnectIfNeeded(const LinkRelAttribute& relAttribute, const KURL& href, Document& document, const CrossOriginAttributeValue crossOrigin, const Ne tworkHintsInterface& networkHintsInterface, LinkCaller caller) 156 static void preconnectIfNeeded(const LinkRelAttribute& relAttribute, const KURL& href, Document& document, const CrossOriginAttributeValue crossOrigin, const Ne tworkHintsInterface& networkHintsInterface, LinkCaller caller)
157 { 157 {
158 if (relAttribute.isPreconnect() && href.isValid() && href.protocolIsInHTTPFa mily()) { 158 if (relAttribute.isPreconnect() && href.isValid() && href.protocolIsInHTTPFa mily()) {
159 UseCounter::count(document, UseCounter::LinkRelPreconnect); 159 UseCounter::count(document, UseCounter::LinkRelPreconnect);
160 if (caller == LinkCalledFromHeader) 160 if (caller == LinkCalledFromHeader)
161 UseCounter::count(document, UseCounter::LinkHeaderPreconnect); 161 UseCounter::count(document, UseCounter::LinkHeaderPreconnect);
162 ASSERT(RuntimeEnabledFeatures::linkPreconnectEnabled());
163 Settings* settings = document.settings(); 162 Settings* settings = document.settings();
164 if (settings && settings->logDnsPrefetchAndPreconnect()) { 163 if (settings && settings->logDnsPrefetchAndPreconnect()) {
165 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource , DebugMessageLevel, String("Preconnect triggered for ") + href.getString())); 164 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource , DebugMessageLevel, String("Preconnect triggered for ") + href.getString()));
166 if (crossOrigin != CrossOriginAttributeNotSet) { 165 if (crossOrigin != CrossOriginAttributeNotSet) {
167 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSo urce, DebugMessageLevel, 166 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSo urce, DebugMessageLevel,
168 String("Preconnect CORS setting is ") + String((crossOrigin == CrossOriginAttributeAnonymous) ? "anonymous" : "use-credentials"))); 167 String("Preconnect CORS setting is ") + String((crossOrigin == CrossOriginAttributeAnonymous) ? "anonymous" : "use-credentials")));
169 } 168 }
170 } 169 }
171 networkHintsInterface.preconnectHost(href, crossOrigin); 170 networkHintsInterface.preconnectHost(href, crossOrigin);
172 } 171 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 312
314 LinkRelAttribute relAttribute(header.rel()); 313 LinkRelAttribute relAttribute(header.rel());
315 KURL url(baseURL, header.url()); 314 KURL url(baseURL, header.url());
316 // Sanity check to avoid re-entrancy here. 315 // Sanity check to avoid re-entrancy here.
317 if (url == baseURL) 316 if (url == baseURL)
318 continue; 317 continue;
319 if (canLoadResources != OnlyLoadResources) { 318 if (canLoadResources != OnlyLoadResources) {
320 if (RuntimeEnabledFeatures::linkHeaderEnabled()) 319 if (RuntimeEnabledFeatures::linkHeaderEnabled())
321 dnsPrefetchIfNeeded(relAttribute, url, *document, networkHintsIn terface, LinkCalledFromHeader); 320 dnsPrefetchIfNeeded(relAttribute, url, *document, networkHintsIn terface, LinkCalledFromHeader);
322 321
323 if (RuntimeEnabledFeatures::linkPreconnectEnabled()) 322 preconnectIfNeeded(relAttribute, url, *document, crossOriginAttribut eValue(header.crossOrigin()), networkHintsInterface, LinkCalledFromHeader);
324 preconnectIfNeeded(relAttribute, url, *document, crossOriginAttr ibuteValue(header.crossOrigin()), networkHintsInterface, LinkCalledFromHeader);
325 } 323 }
326 if (canLoadResources != DoNotLoadResources) { 324 if (canLoadResources != DoNotLoadResources) {
327 bool errorOccurred = false; 325 bool errorOccurred = false;
328 if (RuntimeEnabledFeatures::linkPreloadEnabled()) { 326 if (RuntimeEnabledFeatures::linkPreloadEnabled()) {
329 ViewportDescription* viewportDescription = (viewportDescriptionW rapper && viewportDescriptionWrapper->set) ? &(viewportDescriptionWrapper->descr iption) : nullptr; 327 ViewportDescription* viewportDescription = (viewportDescriptionW rapper && viewportDescriptionWrapper->set) ? &(viewportDescriptionWrapper->descr iption) : nullptr;
330 preloadIfNeeded(relAttribute, url, *document, header.as(), heade r.mimeType(), header.media(), crossOriginAttributeValue(header.crossOrigin()), L inkCalledFromHeader, errorOccurred, viewportDescription); 328 preloadIfNeeded(relAttribute, url, *document, header.as(), heade r.mimeType(), header.media(), crossOriginAttributeValue(header.crossOrigin()), L inkCalledFromHeader, errorOccurred, viewportDescription);
331 } 329 }
332 } 330 }
333 // TODO(yoav): Add more supported headers as needed. 331 // TODO(yoav): Add more supported headers as needed.
334 } 332 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 DEFINE_TRACE(LinkLoader) 394 DEFINE_TRACE(LinkLoader)
397 { 395 {
398 visitor->trace(m_client); 396 visitor->trace(m_client);
399 visitor->trace(m_prerender); 397 visitor->trace(m_prerender);
400 visitor->trace(m_linkPreloadResourceClient); 398 visitor->trace(m_linkPreloadResourceClient);
401 ResourceOwner<Resource, ResourceClient>::trace(visitor); 399 ResourceOwner<Resource, ResourceClient>::trace(visitor);
402 PrerenderClient::trace(visitor); 400 PrerenderClient::trace(visitor);
403 } 401 }
404 402
405 } // namespace blink 403 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/LinkRelAttribute.cpp ('k') | third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698