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..5caa0690dbebfef78e71202d4a48ada498835cba 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 |
+// TODO(shaochuan): Revisit short limit value once cache-aware font display is |
+// launched. crbug.com/570205 |
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()); |