Index: third_party/WebKit/Source/core/loader/LinkLoader.cpp |
diff --git a/third_party/WebKit/Source/core/loader/LinkLoader.cpp b/third_party/WebKit/Source/core/loader/LinkLoader.cpp |
index fb6549e54502baa420190857417aa49970623f6a..edf7fdf07c6e2e44780a4cc40577b98f08b51044 100644 |
--- a/third_party/WebKit/Source/core/loader/LinkLoader.cpp |
+++ b/third_party/WebKit/Source/core/loader/LinkLoader.cpp |
@@ -45,13 +45,12 @@ |
#include "core/html/parser/HTMLPreloadScanner.h" |
#include "core/inspector/ConsoleMessage.h" |
#include "core/loader/DocumentLoader.h" |
-#include "core/loader/NetworkHintsInterface.h" |
#include "core/loader/PrerenderHandle.h" |
#include "platform/MIMETypeRegistry.h" |
#include "platform/Prerender.h" |
#include "platform/RuntimeEnabledFeatures.h" |
#include "platform/network/LinkHeader.h" |
-#include "platform/network/NetworkHints.h" |
+#include "public/platform/Platform.h" |
#include "public/platform/WebPrerender.h" |
namespace blink { |
@@ -135,8 +134,7 @@ enum LinkCaller { |
LinkCalledFromMarkup, |
}; |
- |
-static void dnsPrefetchIfNeeded(const LinkRelAttribute& relAttribute, const KURL& href, Document& document, const NetworkHintsInterface& networkHintsInterface, LinkCaller caller) |
+static void dnsPrefetchIfNeeded(const LinkRelAttribute& relAttribute, const KURL& href, Document& document, LinkCaller caller) |
{ |
if (relAttribute.isDNSPrefetch()) { |
UseCounter::count(document, UseCounter::LinkRelDnsPrefetch); |
@@ -148,12 +146,12 @@ static void dnsPrefetchIfNeeded(const LinkRelAttribute& relAttribute, const KURL |
if (settings && settings->dnsPrefetchingEnabled() && href.isValid() && !href.isEmpty()) { |
if (settings->logDnsPrefetchAndPreconnect()) |
document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, DebugMessageLevel, String("DNS prefetch triggered for " + href.host()))); |
- networkHintsInterface.dnsPrefetchHost(href.host()); |
+ Platform::current()->preresolve(href); |
} |
} |
} |
-static void preconnectIfNeeded(const LinkRelAttribute& relAttribute, const KURL& href, Document& document, const CrossOriginAttributeValue crossOrigin, const NetworkHintsInterface& networkHintsInterface, LinkCaller caller) |
+static void preconnectIfNeeded(const LinkRelAttribute& relAttribute, const KURL& href, Document& document, const CrossOriginAttributeValue crossOrigin, LinkCaller caller) |
{ |
if (relAttribute.isPreconnect() && href.isValid() && href.protocolIsInHTTPFamily()) { |
UseCounter::count(document, UseCounter::LinkRelPreconnect); |
@@ -168,7 +166,7 @@ static void preconnectIfNeeded(const LinkRelAttribute& relAttribute, const KURL& |
String("Preconnect CORS setting is ") + String((crossOrigin == CrossOriginAttributeAnonymous) ? "anonymous" : "use-credentials"))); |
} |
} |
- networkHintsInterface.preconnectHost(href, crossOrigin); |
+ Platform::current()->preconnect(href, crossOrigin != CrossOriginAttributeAnonymous, 1); |
} |
} |
@@ -301,8 +299,7 @@ static Resource* preloadIfNeeded(const LinkRelAttribute& relAttribute, const KUR |
return document.loader()->startPreload(resourceType, linkRequest); |
} |
-void LinkLoader::loadLinksFromHeader(const String& headerValue, const KURL& baseURL, Document* document, const NetworkHintsInterface& networkHintsInterface, |
- CanLoadResources canLoadResources, ViewportDescriptionWrapper* viewportDescriptionWrapper) |
+void LinkLoader::loadLinksFromHeader(const String& headerValue, const KURL& baseURL, Document* document, CanLoadResources canLoadResources, ViewportDescriptionWrapper* viewportDescriptionWrapper) |
{ |
if (!document || headerValue.isEmpty()) |
return; |
@@ -315,10 +312,10 @@ void LinkLoader::loadLinksFromHeader(const String& headerValue, const KURL& base |
KURL url(baseURL, header.url()); |
if (canLoadResources != OnlyLoadResources) { |
if (RuntimeEnabledFeatures::linkHeaderEnabled()) |
- dnsPrefetchIfNeeded(relAttribute, url, *document, networkHintsInterface, LinkCalledFromHeader); |
+ dnsPrefetchIfNeeded(relAttribute, url, *document, LinkCalledFromHeader); |
if (RuntimeEnabledFeatures::linkPreconnectEnabled()) |
- preconnectIfNeeded(relAttribute, url, *document, crossOriginAttributeValue(header.crossOrigin()), networkHintsInterface, LinkCalledFromHeader); |
+ preconnectIfNeeded(relAttribute, url, *document, crossOriginAttributeValue(header.crossOrigin()), LinkCalledFromHeader); |
} |
if (canLoadResources != DoNotLoadResources) { |
bool errorOccurred = false; |
@@ -332,15 +329,15 @@ void LinkLoader::loadLinksFromHeader(const String& headerValue, const KURL& base |
} |
bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, CrossOriginAttributeValue crossOrigin, const String& type, |
- const String& as, const String& media, const KURL& href, Document& document, const NetworkHintsInterface& networkHintsInterface) |
+ const String& as, const String& media, const KURL& href, Document& document) |
{ |
// TODO(yoav): Do all links need to load only after they're in document??? |
// TODO(yoav): Convert all uses of the CrossOriginAttribute to CrossOriginAttributeValue. crbug.com/486689 |
// FIXME(crbug.com/463266): We're ignoring type here, for everything but preload. Maybe we shouldn't. |
- dnsPrefetchIfNeeded(relAttribute, href, document, networkHintsInterface, LinkCalledFromMarkup); |
+ dnsPrefetchIfNeeded(relAttribute, href, document, LinkCalledFromMarkup); |
- preconnectIfNeeded(relAttribute, href, document, crossOrigin, networkHintsInterface, LinkCalledFromMarkup); |
+ preconnectIfNeeded(relAttribute, href, document, crossOrigin, LinkCalledFromMarkup); |
bool errorOccurred = false; |
if (m_client->shouldLoadLink()) |