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

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

Issue 2390583002: [WIP] WebFonts cache-aware timeout adaption (Closed)
Patch Set: handle case in RemoteFontFaceSource if cache-aware deactivated in startLoad(), rebase 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 2de0a247cda364998c55aca696d0456f8f37c313..0d0dc3a7c9d0f559a08ff0dcb82f6a2b5d121f42 100644
--- a/third_party/WebKit/Source/core/fetch/FontResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/FontResource.cpp
@@ -39,6 +39,8 @@ namespace blink {
// Durations of font-display periods.
// https://tabatkins.github.io/specs/css-font-display/#font-display-desc
+// BUG(570205): Revisit short limit value once cache-aware font display is
kouhei (in TOK) 2016/10/20 10:43:07 TODO(shaochuan) Revisit ... crbug.com/570205.
Shao-Chuan Lee 2016/10/21 04:35:02 Done.
+// launched.
static const double fontLoadWaitShortLimitSec = 0.1;
static const double fontLoadWaitLongLimitSec = 3.0;
@@ -143,9 +145,28 @@ 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(isLoading());
+ DCHECK(!resourceRequest().isCacheAwareLoadingActivated());
+ // Both timers should have been started by calling startLoadLimitTimers() from
+ // RemoteFontFaceSource::beginLoadIfNeeded().
+ if (!m_fontLoadShortLimitTimer.isActive())
+ fontLoadShortLimitCallback(nullptr);
+ 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());
@@ -156,6 +177,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