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

Unified Diff: Source/core/css/CSSFontFaceSource.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: 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/CSSFontFaceSource.h ('k') | Source/core/css/FontFace.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSFontFaceSource.cpp
diff --git a/Source/core/css/CSSFontFaceSource.cpp b/Source/core/css/CSSFontFaceSource.cpp
index 62521dcb13e6822dfe634a2878b22dcb552ae913..da6241d914cbb6e8ac462b2b23d8bfdb6d0872c5 100644
--- a/Source/core/css/CSSFontFaceSource.cpp
+++ b/Source/core/css/CSSFontFaceSource.cpp
@@ -205,6 +205,8 @@ PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription&
if (!m_font->ensureCustomFontData())
return nullptr;
+ m_histograms.recordFallbackTime(m_font.get());
+
fontData = SimpleFontData::create(
m_font->platformDataFromCustomData(fontDescription.effectiveFontSize(),
fontDescription.isSyntheticBold(), fontDescription.isSyntheticItalic(),
@@ -285,6 +287,12 @@ void CSSFontFaceSource::FontLoadHistograms::loadStarted()
m_loadStartTime = currentTimeMS();
}
+void CSSFontFaceSource::FontLoadHistograms::fallbackFontPainted()
+{
+ if (!m_fallbackPaintTime)
+ m_fallbackPaintTime = currentTimeMS();
+}
+
void CSSFontFaceSource::FontLoadHistograms::recordLocalFont(bool loadSuccess)
{
if (!m_loadStartTime) {
@@ -293,6 +301,15 @@ void CSSFontFaceSource::FontLoadHistograms::recordLocalFont(bool loadSuccess)
}
}
+void CSSFontFaceSource::FontLoadHistograms::recordFallbackTime(const FontResource* font)
+{
+ if (m_fallbackPaintTime > 0) {
dglazkov 2014/03/04 17:24:08 Early return?
Kunihiko Sakamoto 2014/03/05 08:55:59 Done.
+ int duration = static_cast<int>(currentTimeMS() - m_fallbackPaintTime);
+ blink::Platform::current()->histogramCustomCounts("WebFont.BlankTextShownTime", duration, 0, 10000, 50);
+ m_fallbackPaintTime = -1;
+ }
+}
+
void CSSFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResource* font)
{
if (m_loadStartTime > 0 && font && !font->isLoading()) {
« no previous file with comments | « Source/core/css/CSSFontFaceSource.h ('k') | Source/core/css/FontFace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698