Chromium Code Reviews| Index: Source/core/css/RemoteFontFaceSource.cpp |
| diff --git a/Source/core/css/RemoteFontFaceSource.cpp b/Source/core/css/RemoteFontFaceSource.cpp |
| index 9b15954c7a9aa06f6e7b13d21cf7c3732c9a05b7..565d1158e3eb8fd5299b5d44dbeddd7ccc68ad87 100644 |
| --- a/Source/core/css/RemoteFontFaceSource.cpp |
| +++ b/Source/core/css/RemoteFontFaceSource.cpp |
| @@ -5,8 +5,11 @@ |
| #include "config.h" |
| #include "core/css/RemoteFontFaceSource.h" |
| +#include "FetchInitiatorTypeNames.h" |
| #include "core/css/CSSCustomFontData.h" |
| #include "core/css/CSSFontFace.h" |
| +#include "core/css/CSSFontSelector.h" |
| +#include "core/fetch/ResourceFetcher.h" |
| #include "platform/fonts/FontCache.h" |
| #include "platform/fonts/FontDescription.h" |
| #include "platform/fonts/SimpleFontData.h" |
| @@ -82,6 +85,24 @@ void RemoteFontFaceSource::fontLoadWaitLimitExceeded(FontResource*) |
| m_histograms.recordFallbackTime(m_font.get()); |
| } |
| +void RemoteFontFaceSource::corsFailed(FontResource*) |
| +{ |
| + pruneTable(); |
| + |
| + if (m_face) { |
| + Document* document = m_face->fontSelector() ? m_face->fontSelector()->document() : 0; |
| + if (document) { |
| + FetchRequest request(ResourceRequest(m_font->url()), FetchInitiatorTypeNames::css); |
| + m_font->removeClient(this); |
|
Kunihiko Sakamoto
2014/04/09 10:24:18
CSSFontFaceSrcValue have a reference to this FontR
bashi
2014/04/10 03:40:56
Thank you for pointing this out. But it's difficul
|
| + m_font = document->fetcher()->fetchFont(request); |
| + m_font->addClient(this); |
| + m_face->fontSelector()->beginLoadingFontSoon(m_font.get()); |
| + } else { |
| + m_face->fontLoaded(this); |
| + } |
| + } |
| +} |
| + |
| PassRefPtr<SimpleFontData> RemoteFontFaceSource::createFontData(const FontDescription& fontDescription) |
| { |
| if (!isLoaded()) |
| @@ -156,6 +177,12 @@ void RemoteFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResour |
| : font->response().wasCached() ? Hit |
| : Miss; |
| blink::Platform::current()->histogramEnumeration("WebFont.CacheHit", histogramValue, CacheHitEnumMax); |
| + |
| + if (!font->errorOccurred()) { |
| + enum { CORSSuccess, CORSFail, CORSEnumMax }; |
| + int corsValue = font->options().corsEnabled == IsCORSEnabled ? CORSSuccess : CORSFail; |
| + blink::Platform::current()->histogramEnumeration("WebFont.CORSSuccess", corsValue, CORSEnumMax); |
| + } |
| } |
| } |