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

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

Issue 2431503002: Log web fonts intervention result more accurately (Closed)
Patch Set: Do not record result if there was a load error 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 9c3f564d0932a2bd7700a03c479c1a80b3f92954..b81b68a5d608ffae3470a873ccf418e8233b69b0 100644
--- a/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp
+++ b/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp
@@ -112,7 +112,7 @@ void RemoteFontFaceSource::notifyFinished(Resource*) {
? FontLoadHistograms::FromDiskCache
: FontLoadHistograms::FromNetwork);
m_histograms.recordRemoteFont(m_font.get());
- m_histograms.fontLoaded(m_isInterventionTriggered);
+ m_histograms.fontLoaded(m_font, m_display, m_isInterventionTriggered);
m_font->ensureCustomFontData();
// FIXME: Provide more useful message such as OTS rejection reason.
@@ -151,7 +151,7 @@ void RemoteFontFaceSource::fontLoadLongLimitExceeded(FontResource*) {
else if (m_display == FontDisplayFallback)
switchToFailurePeriod();
- m_histograms.longLimitExceeded(m_isInterventionTriggered);
+ m_histograms.longLimitExceeded(m_font, m_display, m_isInterventionTriggered);
}
void RemoteFontFaceSource::switchToSwapPeriod() {
@@ -259,16 +259,20 @@ void RemoteFontFaceSource::FontLoadHistograms::fallbackFontPainted(
}
void RemoteFontFaceSource::FontLoadHistograms::fontLoaded(
+ const FontResource* font,
+ const FontDisplay display,
bool isInterventionTriggered) {
if (!m_isLongLimitExceeded)
- recordInterventionResult(isInterventionTriggered);
+ recordInterventionResult(font, display, isInterventionTriggered);
}
void RemoteFontFaceSource::FontLoadHistograms::longLimitExceeded(
+ const FontResource* font,
+ const FontDisplay display,
bool isInterventionTriggered) {
m_isLongLimitExceeded = true;
maySetDataSource(FromNetwork);
- recordInterventionResult(isInterventionTriggered);
+ recordInterventionResult(font, display, isInterventionTriggered);
}
void RemoteFontFaceSource::FontLoadHistograms::recordFallbackTime(
@@ -387,6 +391,8 @@ void RemoteFontFaceSource::FontLoadHistograms::recordLoadTimeHistogram(
}
void RemoteFontFaceSource::FontLoadHistograms::recordInterventionResult(
+ const FontResource* font,
+ const FontDisplay display,
bool isTriggered) {
CHECK_NE(FromUnknown, m_dataSource);
@@ -403,8 +409,14 @@ void RemoteFontFaceSource::FontLoadHistograms::recordInterventionResult(
DEFINE_STATIC_LOCAL(EnumerationHistogram, missedCacheInterventionHistogram,
("WebFont.InterventionResult.MissedCache", boundary));
interventionHistogram.count(interventionResult);
- if (m_dataSource == FromNetwork)
+
Takashi Toyoshima 2016/10/19 06:36:52 As you changed, this method is called from two pla
tbansal1 2016/10/19 08:27:56 I need to check this to make sure, but when this m
Takashi Toyoshima 2016/10/19 10:16:28 That's true for the current implementation. But we
tbansal1 2016/10/20 00:10:58 Agreed. That;s why I am not checking for pending s
+ // Do not record the result if the font failed to load since the failure
+ // could have happened either due to slow connection or unavailability of the
+ // server.
+ if (m_dataSource == FromNetwork && !font->isCORSFailed() &&
+ display == FontDisplayAuto && font->getStatus() != Resource::LoadError) {
Takashi Toyoshima 2016/10/19 06:36:52 I slightly prefer to pass the |display| at m_histo
tbansal1 2016/10/20 00:10:58 Done.
Takashi Toyoshima 2016/10/20 10:12:44 Thanks!
missedCacheInterventionHistogram.count(interventionResult);
+ }
}
RemoteFontFaceSource::FontLoadHistograms::CacheHitMetrics
« 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