Index: Source/core/css/RemoteFontFaceSource.cpp |
diff --git a/Source/core/css/RemoteFontFaceSource.cpp b/Source/core/css/RemoteFontFaceSource.cpp |
index 9b15954c7a9aa06f6e7b13d21cf7c3732c9a05b7..23fdfc5df02217cb6a491077f748d4a818271074 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); |
+ 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 { CORSFail, CORSSuccess, CORSEnumMax }; |
+ int corsValue = font->options().corsEnabled == IsCORSEnabled ? CORSSuccess : CORSFail; |
+ blink::Platform::current()->histogramEnumeration("WebFont.CORSSuccess", corsValue, CORSEnumMax); |
+ } |
} |
} |