Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp

Issue 2431503002: Log web fonts intervention result more accurately (Closed)
Patch Set: Addressed comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/RemoteFontFaceSource.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..45ce1f6e3951a4b4a73d4f48ebc429d701ad063e 100644
--- a/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp
+++ b/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp
@@ -60,7 +60,8 @@ RemoteFontFaceSource::RemoteFontFaceSource(FontResource* font,
m_histograms(font->url().protocolIsData()
? FontLoadHistograms::FromDataURL
: font->isLoaded() ? FontLoadHistograms::FromMemoryCache
- : FontLoadHistograms::FromUnknown),
+ : FontLoadHistograms::FromUnknown,
+ m_display),
m_isInterventionTriggered(false) {
ThreadState::current()->registerPreFinalizer(this);
m_font->addClient(this);
@@ -112,7 +113,9 @@ void RemoteFontFaceSource::notifyFinished(Resource*) {
? FontLoadHistograms::FromDiskCache
: FontLoadHistograms::FromNetwork);
m_histograms.recordRemoteFont(m_font.get());
- m_histograms.fontLoaded(m_isInterventionTriggered);
+ m_histograms.fontLoaded(m_font->isCORSFailed(),
+ m_font->getStatus() == Resource::LoadError,
kinuko 2016/10/21 17:07:11 nit: if these two are only used in &&'ed bool chec
tbansal1 2016/10/21 17:14:32 I thought about this, but concluded that it might
+ m_isInterventionTriggered);
m_font->ensureCustomFontData();
// FIXME: Provide more useful message such as OTS rejection reason.
@@ -263,16 +266,21 @@ void RemoteFontFaceSource::FontLoadHistograms::fallbackFontPainted(
}
void RemoteFontFaceSource::FontLoadHistograms::fontLoaded(
+ bool isCorsFailed,
+ bool loadError,
bool isInterventionTriggered) {
- if (!m_isLongLimitExceeded)
+ if (!m_isLongLimitExceeded && m_fontDisplay == FontDisplayAuto &&
+ !isCorsFailed && !loadError) {
recordInterventionResult(isInterventionTriggered);
+ }
}
void RemoteFontFaceSource::FontLoadHistograms::longLimitExceeded(
bool isInterventionTriggered) {
m_isLongLimitExceeded = true;
maySetDataSource(FromNetwork);
- recordInterventionResult(isInterventionTriggered);
+ if (m_fontDisplay == FontDisplayAuto)
+ recordInterventionResult(isInterventionTriggered);
}
void RemoteFontFaceSource::FontLoadHistograms::recordFallbackTime(
« no previous file with comments | « third_party/WebKit/Source/core/css/RemoteFontFaceSource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698