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

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

Issue 1314843009: Add DocumentTiming metrics for "time to first text paint" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Paint time metrics Created 5 years, 3 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
Index: Source/core/css/CSSFontSelector.cpp
diff --git a/Source/core/css/CSSFontSelector.cpp b/Source/core/css/CSSFontSelector.cpp
index d984785f0638362ca88bdce4deb68553a3cea4a3..473f6faf2f06a4de941ca68333f0dd867d024959 100644
--- a/Source/core/css/CSSFontSelector.cpp
+++ b/Source/core/css/CSSFontSelector.cpp
@@ -47,6 +47,8 @@ CSSFontSelector::CSSFontSelector(Document* document)
: m_document(document)
, m_fontLoader(FontLoader::create(this, document))
, m_genericFontFamilySettings(document->frame()->settings()->genericFontFamilySettings())
+ , m_firstNonBlankTextReported(false)
+ , m_firstCustomFontTextReported(false)
{
// FIXME: An old comment used to say there was no need to hold a reference to m_document
// because "we are guaranteed to be destroyed before the document". But there does not
@@ -128,6 +130,20 @@ static AtomicString familyNameFromSettings(const GenericFontFamilySettings& sett
return emptyAtom;
}
+void CSSFontSelector::reportFirstNonBlankText(bool isCustomFont)
+{
+ if (isCustomFont) {
+ if (m_firstCustomFontTextReported)
kinuko 2015/09/14 14:14:33 Looks like common pattern is doing something like
Kunihiko Sakamoto 2015/09/15 05:11:01 Done.
+ return;
+ m_document->mutableTiming().markFirstCustomFontText();
+ m_firstCustomFontTextReported = true;
+ }
+ if (m_firstNonBlankTextReported)
+ return;
+ m_document->mutableTiming().markFirstNonBlankText();
+ m_firstNonBlankTextReported = true;
+}
+
PassRefPtr<FontData> CSSFontSelector::getFontData(const FontDescription& fontDescription, const AtomicString& familyName)
{
if (CSSSegmentedFontFace* face = m_fontFaceCache.get(fontDescription, familyName))

Powered by Google App Engine
This is Rietveld 408576698