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

Unified Diff: third_party/WebKit/Source/platform/network/ResourceRequest.cpp

Issue 2390583002: [WIP] WebFonts cache-aware timeout adaption (Closed)
Patch Set: Created 4 years, 2 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: third_party/WebKit/Source/platform/network/ResourceRequest.cpp
diff --git a/third_party/WebKit/Source/platform/network/ResourceRequest.cpp b/third_party/WebKit/Source/platform/network/ResourceRequest.cpp
index dd9afd70463b65ca5578de5a29332df80b5968fd..4c6596d666b7ccee5ee559a0d36f0c5ebc2708d9 100644
--- a/third_party/WebKit/Source/platform/network/ResourceRequest.cpp
+++ b/third_party/WebKit/Source/platform/network/ResourceRequest.cpp
@@ -88,6 +88,9 @@ ResourceRequest::ResourceRequest(CrossThreadResourceRequestData* data)
m_uiStartTime = data->m_uiStartTime;
m_isExternalRequest = data->m_isExternalRequest;
m_inputPerfMetricReportPolicy = data->m_inputPerfMetricReportPolicy;
+ m_isCacheAwareLoadingEnabled = data->m_isCacheAwareLoadingEnabled;
+ m_isCacheAwareLoadingActivated = data->m_isCacheAwareLoadingActivated;
+ m_savedCachePolicy = data->m_savedCachePolicy;
m_redirectStatus = data->m_redirectStatus;
}
@@ -136,6 +139,9 @@ std::unique_ptr<CrossThreadResourceRequestData> ResourceRequest::copyData()
data->m_uiStartTime = m_uiStartTime;
data->m_isExternalRequest = m_isExternalRequest;
data->m_inputPerfMetricReportPolicy = m_inputPerfMetricReportPolicy;
+ data->m_isCacheAwareLoadingEnabled = m_isCacheAwareLoadingEnabled;
+ data->m_isCacheAwareLoadingActivated = m_isCacheAwareLoadingActivated;
+ data->m_savedCachePolicy = m_savedCachePolicy;
data->m_redirectStatus = m_redirectStatus;
return data;
}
@@ -387,6 +393,25 @@ bool ResourceRequest::hasCacheValidatorFields() const {
!m_httpHeaderFields.get(HTTPNames::ETag).isEmpty();
}
+void ResourceRequest::mayActivateCacheAwareLoading() {
+ if (!m_isCacheAwareLoadingEnabled)
+ return;
+
+ if (m_cachePolicy == WebCachePolicy::BypassingCache ||
Takashi Toyoshima 2016/10/03 09:06:35 Using switch is better to catch new cache policy b
Shao-Chuan Lee 2016/10/04 09:08:04 Done.
+ m_cachePolicy == WebCachePolicy::ReturnCacheDataDontLoad)
+ return;
+
+ m_savedCachePolicy = m_cachePolicy;
+ m_cachePolicy = WebCachePolicy::ReturnCacheDataDontLoad;
Takashi Toyoshima 2016/10/03 09:06:35 Should we have a TODO to use the right flag when /
Shao-Chuan Lee 2016/10/04 01:39:46 Do we already have a bug for this? Or we should fi
Takashi Toyoshima 2016/10/04 04:12:02 How about using crbug.com/570205 for this TODO.
Shao-Chuan Lee 2016/10/04 09:08:04 Done.
Shao-Chuan Lee 2016/10/05 10:16:09 Now crbug.com/652649 is available for tracking.
+ m_isCacheAwareLoadingActivated = true;
+}
+
+void ResourceRequest::deactivateCacheAwareLoading() {
+ DCHECK(m_isCacheAwareLoadingActivated);
+ m_cachePolicy = m_savedCachePolicy;
+ m_isCacheAwareLoadingActivated = false;
+}
+
void ResourceRequest::initialize(const KURL& url) {
m_url = url;
m_cachePolicy = WebCachePolicy::UseProtocolCachePolicy;
@@ -419,6 +444,9 @@ void ResourceRequest::initialize(const KURL& url) {
m_inputPerfMetricReportPolicy = InputToLoadPerfMetricReportPolicy::NoReport;
m_redirectStatus = RedirectStatus::NoRedirect;
m_requestorOrigin = SecurityOrigin::createUnique();
+ m_isCacheAwareLoadingEnabled = false;
+ m_isCacheAwareLoadingActivated = false;
+ m_savedCachePolicy = WebCachePolicy::UseProtocolCachePolicy;
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698