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

Unified Diff: Source/core/css/FontFaceSet.cpp

Issue 180273020: UMA histograms to measure whether / how long blank text is rendered for loading web fonts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: early return Created 6 years, 10 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 | « Source/core/css/FontFaceSet.h ('k') | Source/platform/fonts/CustomFontData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/FontFaceSet.cpp
diff --git a/Source/core/css/FontFaceSet.cpp b/Source/core/css/FontFaceSet.cpp
index 813df2a4d825f0016cf791f617e19b0c4d3f37a2..e3eaf26ca81f8f4ae44d2ec894ac425f50a97aaf 100644
--- a/Source/core/css/FontFaceSet.cpp
+++ b/Source/core/css/FontFaceSet.cpp
@@ -173,7 +173,7 @@ void FontFaceSet::handlePendingEventsAndPromisesSoon()
void FontFaceSet::didLayout()
{
- if (document()->frame()->isMainFrame())
+ if (document()->frame()->isMainFrame() && m_loadingFonts.isEmpty())
m_histogram.record();
if (!RuntimeEnabledFeatures::fontLoadEventsEnabled())
return;
@@ -219,6 +219,7 @@ void FontFaceSet::beginFontLoading(FontFace* fontFace)
void FontFaceSet::fontLoaded(FontFace* fontFace)
{
+ m_histogram.updateStatus(fontFace);
if (RuntimeEnabledFeatures::fontLoadEventsEnabled())
m_loadedFonts.append(fontFace);
removeFromLoadingFonts(fontFace);
@@ -226,6 +227,7 @@ void FontFaceSet::fontLoaded(FontFace* fontFace)
void FontFaceSet::loadError(FontFace* fontFace)
{
+ m_histogram.updateStatus(fontFace);
if (RuntimeEnabledFeatures::fontLoadEventsEnabled())
m_failedFonts.append(fontFace);
removeFromLoadingFonts(fontFace);
@@ -509,12 +511,26 @@ bool FontFaceSet::resolveFontStyle(const String& fontString, Font& font)
return true;
}
-void FontFaceSet::FontLoadHistogram::record()
+void FontFaceSet::FontLoadHistogram::updateStatus(FontFace* fontFace)
{
- if (m_recorded)
+ if (m_status == Reported)
return;
- m_recorded = true;
- blink::Platform::current()->histogramCustomCounts("WebFont.WebFontsInPage", m_count, 1, 100, 50);
+ if (fontFace->hadBlankText())
+ m_status = HadBlankText;
+ else if (m_status == NoWebFonts)
+ m_status = DidNotHaveBlankText;
+}
+
+void FontFaceSet::FontLoadHistogram::record()
+{
+ if (!m_recorded) {
+ m_recorded = true;
+ blink::Platform::current()->histogramCustomCounts("WebFont.WebFontsInPage", m_count, 1, 100, 50);
+ }
+ if (m_status == HadBlankText || m_status == DidNotHaveBlankText) {
+ blink::Platform::current()->histogramEnumeration("WebFont.HadBlankText", m_status == HadBlankText ? 1 : 0, 2);
+ m_status = Reported;
+ }
}
static const char* supplementName()
« no previous file with comments | « Source/core/css/FontFaceSet.h ('k') | Source/platform/fonts/CustomFontData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698