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

Unified Diff: Source/core/html/parser/PreloadRequest.h

Issue 1152043005: Add <link rel=preconnect> support to the HTMLPreloadScanner (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added HTTP family test Created 5 years, 7 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
« no previous file with comments | « Source/core/html/parser/HTMLResourcePreloader.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/parser/PreloadRequest.h
diff --git a/Source/core/html/parser/PreloadRequest.h b/Source/core/html/parser/PreloadRequest.h
index 8171d24121220768be66e7f1b06103249dfadd69..718c4feaaae0aaed89a1eacce9adc46252099355 100644
--- a/Source/core/html/parser/PreloadRequest.h
+++ b/Source/core/html/parser/PreloadRequest.h
@@ -16,9 +16,11 @@ class Document;
class PreloadRequest {
public:
- static PassOwnPtr<PreloadRequest> create(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceType, const FetchRequest::ResourceWidth& resourceWidth = FetchRequest::ResourceWidth(), const ClientHintsPreferences& clientHintsPreferences = ClientHintsPreferences())
+ enum RequestType { RequestTypePreload, RequestTypePreconnect };
+
+ static PassOwnPtr<PreloadRequest> create(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceType, const FetchRequest::ResourceWidth& resourceWidth = FetchRequest::ResourceWidth(), const ClientHintsPreferences& clientHintsPreferences = ClientHintsPreferences(), RequestType requestType = RequestTypePreload)
{
- return adoptPtr(new PreloadRequest(initiatorName, initiatorPosition, resourceURL, baseURL, resourceType, resourceWidth, clientHintsPreferences));
+ return adoptPtr(new PreloadRequest(initiatorName, initiatorPosition, resourceURL, baseURL, resourceType, resourceWidth, clientHintsPreferences, requestType));
}
bool isSafeToSendToAnotherThread() const;
@@ -39,7 +41,10 @@ public:
const String& resourceURL() const { return m_resourceURL; }
float resourceWidth() const { return m_resourceWidth.isSet ? m_resourceWidth.width : 0; }
- const String& baseURL() const { return m_baseURL.string(); }
+ const KURL& baseURL() const { return m_baseURL; }
+ bool isPreconnect() const { return m_requestType == RequestTypePreconnect; }
+ bool isCORS() const { return m_isCORSEnabled; }
+ bool isAllowCredentials() const { return m_allowCredentials == AllowStoredCredentials; }
private:
PreloadRequest(const String& initiatorName,
@@ -48,7 +53,8 @@ private:
const KURL& baseURL,
Resource::Type resourceType,
const FetchRequest::ResourceWidth& resourceWidth,
- const ClientHintsPreferences& clientHintsPreferences)
+ const ClientHintsPreferences& clientHintsPreferences,
+ RequestType requestType)
: m_initiatorName(initiatorName)
, m_initiatorPosition(initiatorPosition)
, m_resourceURL(resourceURL.isolatedCopy())
@@ -60,6 +66,7 @@ private:
, m_defer(FetchRequest::NoDefer)
, m_resourceWidth(resourceWidth)
, m_clientHintsPreferences(clientHintsPreferences)
+ , m_requestType(requestType)
{
}
@@ -77,6 +84,7 @@ private:
FetchRequest::DeferOption m_defer;
FetchRequest::ResourceWidth m_resourceWidth;
ClientHintsPreferences m_clientHintsPreferences;
+ RequestType m_requestType;
};
typedef Vector<OwnPtr<PreloadRequest>> PreloadRequestStream;
« no previous file with comments | « Source/core/html/parser/HTMLResourcePreloader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698