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

Unified Diff: third_party/WebKit/Source/core/fetch/Resource.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/core/fetch/Resource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp
index 9d88d0191a75c2bba0f1e63d567acc4874e14f93..b31394ae2d01f01a881bf94082a09743a43f30d2 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -312,6 +312,7 @@ Resource::Resource(const ResourceRequest& request,
m_linkPreload(false),
m_isRevalidating(false),
m_isAlive(false),
+ m_isAddClientProhibited(false),
m_options(options),
m_responseTimestamp(currentTime()),
m_cancelTimer(this, &Resource::cancelTimerFired),
@@ -686,6 +687,8 @@ void Resource::willAddClientOrObserver(PreloadReferencePolicy policy) {
void Resource::addClient(ResourceClient* client,
PreloadReferencePolicy policy) {
+ DCHECK(!m_isAddClientProhibited);
+
willAddClientOrObserver(policy);
if (m_isRevalidating) {
@@ -1074,4 +1077,15 @@ bool Resource::isLoadEventBlockingResourceType() const {
return false;
}
+void Resource::willReloadAfterDiskCacheMiss() {
+ m_resourceRequest.deactivateCacheAwareLoading();
yhirano 2016/10/04 05:27:10 DCHECK(!m_isAddClientProhibited);
Shao-Chuan Lee 2016/10/04 09:08:04 Done.
+
+ m_isAddClientProhibited = true;
kouhei (in TOK) 2016/10/03 08:11:47 AutoReset https://cs.chromium.org/chromium/src/thi
Shao-Chuan Lee 2016/10/04 01:39:46 I made this a bit-field like other fields in Resou
hiroshige 2016/10/05 08:27:10 Probably we can make a normal bool and use AutoRes
Shao-Chuan Lee 2016/10/07 08:10:06 Now we have ProhibitAddRemoveClientInScope.
kouhei (in TOK) 2016/10/20 10:43:07 You are right. You may want to introduce your own
+ ResourceClientWalker<ResourceClient> w(m_clients);
+ while (ResourceClient* c = w.next()) {
+ c->willReloadAfterDiskCacheMiss(this);
+ }
+ m_isAddClientProhibited = false;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698