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

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

Issue 1170503003: Remove resource type-specific fetching logic from ResourceFetcher (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Null-check Document::loader() before calling startPreload() Created 5 years, 6 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 cc3dbcd75366c34545a48a7ff6df8331e135db44..997be6c72dadb9de0141443f261f0f71099daa5f 100644
--- a/Source/core/html/parser/HTMLResourcePreloader.cpp
+++ b/Source/core/html/parser/HTMLResourcePreloader.cpp
@@ -29,6 +29,7 @@
#include "core/dom/Document.h"
#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"
@@ -72,9 +73,14 @@ void HTMLResourcePreloader::preload(PassOwnPtr<PreloadRequest> preload)
preconnectHost(preload.get());
return;
}
+ if (!m_document->loader())
+ return;
FetchRequest request = preload->resourceRequest(m_document);
+ if (preload->resourceType() == Resource::Script || preload->resourceType() == Resource::CSSStyleSheet)
+ request.setCharset(preload->charset().isEmpty() ? m_document->charset().string() : preload->charset());
+ request.setForPreload(true);
Platform::current()->histogramCustomCounts("WebCore.PreloadDelayMs", static_cast<int>(1000 * (monotonicallyIncreasingTime() - preload->discoveryTime())), 0, 2000, 20);
- m_document->fetcher()->preload(preload->resourceType(), request, preload->charset());
+ m_document->loader()->startPreload(preload->resourceType(), request);
}
} // namespace blink
« no previous file with comments | « Source/core/html/imports/HTMLImportsController.cpp ('k') | Source/core/inspector/InspectorResourceContentLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698