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

Unified Diff: third_party/WebKit/Source/core/fetch/FontResource.cpp

Issue 2390583002: [WIP] WebFonts cache-aware timeout adaption (Closed)
Patch Set: handle font-display: swap 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/FontResource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/FontResource.cpp b/third_party/WebKit/Source/core/fetch/FontResource.cpp
index a5314e845fb10fa6267466f8558e4ad47ea417ab..3ad02e893a5a6bb2580da0416ea1ea27fa2136b7 100644
--- a/third_party/WebKit/Source/core/fetch/FontResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/FontResource.cpp
@@ -144,9 +144,25 @@ FontPlatformData FontResource::platformDataFromCustomData(
return m_fontData->fontPlatformData(size, bold, italic, orientation);
}
+void FontResource::willReloadAfterDiskCacheMiss() {
+ ProhibitAddRemoveClientInScope prohibitAddRemoveClient(this);
+
+ ResourceClientWalker<FontResourceClient> walker(clients());
+ while (FontResourceClient* client = walker.next())
+ client->willReloadAfterDiskCacheMiss(this);
+
+ DCHECK(!resourceRequest().isCacheAwareLoadingActivated());
+ if (!m_fontLoadShortLimitTimer.isActive())
+ fontLoadShortLimitCallback(nullptr);
yhirano 2016/10/12 06:30:38 This code assumes that startLoadLimitTimersIfNeede
Shao-Chuan Lee 2016/10/13 05:20:45 Load limit timers are always started after FontRes
Shao-Chuan Lee 2016/10/17 03:45:59 Added comments.
+ if (!m_fontLoadLongLimitTimer.isActive())
+ fontLoadLongLimitCallback(nullptr);
+}
+
void FontResource::fontLoadShortLimitCallback(TimerBase*) {
if (!isLoading())
return;
+ if (resourceRequest().isCacheAwareLoadingActivated())
+ return;
DCHECK_EQ(m_loadLimitState, UnderLimit);
m_loadLimitState = ShortLimitExceeded;
ResourceClientWalker<FontResourceClient> walker(clients());
@@ -157,6 +173,8 @@ void FontResource::fontLoadShortLimitCallback(TimerBase*) {
void FontResource::fontLoadLongLimitCallback(TimerBase*) {
if (!isLoading())
return;
+ if (resourceRequest().isCacheAwareLoadingActivated())
+ return;
DCHECK_EQ(m_loadLimitState, ShortLimitExceeded);
m_loadLimitState = LongLimitExceeded;
ResourceClientWalker<FontResourceClient> walker(clients());

Powered by Google App Engine
This is Rietveld 408576698