| Index: third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp b/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp
|
| index 0d5f323799f2cf30939d9da36dda534df5e8b7d5..542a7ca228693b50f6dc2c873f0d56ee8af16203 100644
|
| --- a/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp
|
| +++ b/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp
|
| @@ -56,7 +56,7 @@ RemoteFontFaceSource::RemoteFontFaceSource(FontResource* font,
|
| : m_font(font),
|
| m_fontSelector(fontSelector),
|
| m_display(display),
|
| - m_period(display == FontDisplaySwap ? SwapPeriod : BlockPeriod),
|
| + m_period(BlockPeriod),
|
| m_histograms(font->url().protocolIsData()
|
| ? FontLoadHistograms::FromDataURL
|
| : font->isLoaded() ? FontLoadHistograms::FromMemoryCache
|
| @@ -73,6 +73,10 @@ RemoteFontFaceSource::RemoteFontFaceSource(FontResource* font,
|
| "Slow network is detected. Fallback font will be used while loading: " +
|
| m_font->url().elidedString()));
|
| }
|
| +
|
| + if (m_display == FontDisplaySwap &&
|
| + !m_font->resourceRequest().isCacheAwareLoadingActivated())
|
| + m_period = SwapPeriod;
|
| }
|
|
|
| RemoteFontFaceSource::~RemoteFontFaceSource() {}
|
| @@ -158,6 +162,11 @@ void RemoteFontFaceSource::fontLoadLongLimitExceeded(FontResource*) {
|
| m_histograms.longLimitExceeded(m_isInterventionTriggered);
|
| }
|
|
|
| +void RemoteFontFaceSource::willReloadAfterDiskCacheMiss(const FontResource*) {
|
| + if (m_display == FontDisplaySwap)
|
| + switchToSwapPeriod();
|
| +}
|
| +
|
| void RemoteFontFaceSource::switchToSwapPeriod() {
|
| ASSERT(m_period == BlockPeriod);
|
| m_period = SwapPeriod;
|
| @@ -234,7 +243,15 @@ PassRefPtr<SimpleFontData> RemoteFontFaceSource::createLoadingFallbackFontData(
|
|
|
| void RemoteFontFaceSource::beginLoadIfNeeded() {
|
| if (m_fontSelector->document() && m_font->stillNeedsLoad()) {
|
| + // TODO(shaochuan): Cache-aware loading may be deactivated in startLoad(),
|
| + // set |m_period| to correct value if deactivated. crbug.com/632580
|
| + bool wasCacheAwareLoadingActivated =
|
| + m_font->resourceRequest().isCacheAwareLoadingActivated();
|
| m_fontSelector->document()->fetcher()->startLoad(m_font);
|
| + if (m_display == FontDisplaySwap && wasCacheAwareLoadingActivated &&
|
| + !m_font->resourceRequest().isCacheAwareLoadingActivated())
|
| + switchToSwapPeriod();
|
| +
|
| if (!m_font->isLoaded())
|
| m_font->startLoadLimitTimers();
|
| m_histograms.loadStarted();
|
|
|