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()); |