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

Unified Diff: Source/core/html/parser/HTMLResourcePreloader.cpp

Issue 1112833004: Add HTMLResourcePreloader preconnect unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed crash Created 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/parser/HTMLResourcePreloader.cpp
diff --git a/Source/core/html/parser/HTMLResourcePreloader.cpp b/Source/core/html/parser/HTMLResourcePreloader.cpp
index 6813009b94ab34c93a1df8f9794658f24df168c8..683f9803e75ecd6c4d9c08d18b9fe5f9cde8cf9c 100644
--- a/Source/core/html/parser/HTMLResourcePreloader.cpp
+++ b/Source/core/html/parser/HTMLResourcePreloader.cpp
@@ -30,7 +30,6 @@
#include "core/fetch/FetchInitiatorInfo.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/loader/DocumentLoader.h"
-#include "platform/network/NetworkHints.h"
#include "public/platform/Platform.h"
namespace blink {
@@ -50,7 +49,7 @@ DEFINE_TRACE(HTMLResourcePreloader)
visitor->trace(m_document);
}
-static void preconnectHost(PreloadRequest* request)
+static void preconnectHost(PreloadRequest* request, const NetworkHintsInterface& networkHintsInterface)
{
ASSERT(request);
ASSERT(request->isPreconnect());
@@ -64,13 +63,13 @@ static void preconnectHost(PreloadRequest* request)
else
crossOrigin = CrossOriginAttributeAnonymous;
}
- preconnect(host, crossOrigin);
+ networkHintsInterface.preconnectHost(host, crossOrigin);
}
-void HTMLResourcePreloader::preload(PassOwnPtr<PreloadRequest> preload)
+void HTMLResourcePreloader::preload(PassOwnPtr<PreloadRequest> preload, const NetworkHintsInterface& networkHintsInterface)
{
if (preload->isPreconnect()) {
- preconnectHost(preload.get());
+ preconnectHost(preload.get(), networkHintsInterface);
return;
}
// TODO(yoichio): Should preload if document is imported.
« no previous file with comments | « Source/core/html/parser/HTMLResourcePreloader.h ('k') | Source/core/html/parser/HTMLResourcePreloaderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698