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

Unified Diff: Source/platform/fonts/Font.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: 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
« no previous file with comments | « Source/platform/fonts/Font.h ('k') | Source/platform/fonts/FontFallbackList.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/Font.cpp
diff --git a/Source/platform/fonts/Font.cpp b/Source/platform/fonts/Font.cpp
index aa087069dcd1202865b9e157dacb175a2be0e576..7c19b34c86a0a57a12b43038013548d1eddc9bcf 100644
--- a/Source/platform/fonts/Font.cpp
+++ b/Source/platform/fonts/Font.cpp
@@ -62,6 +62,7 @@ Font::Font(const FontDescription& fd)
: m_fontDescription(fd)
, m_canShapeWordByWord(0)
, m_shapeWordByWordComputed(0)
+ , m_firstPaintReported(0)
{
}
@@ -70,6 +71,7 @@ Font::Font(const Font& other)
, m_fontFallbackList(other.m_fontFallbackList)
, m_canShapeWordByWord(0)
, m_shapeWordByWordComputed(0)
+ , m_firstPaintReported(0)
{
}
@@ -79,6 +81,7 @@ Font& Font::operator=(const Font& other)
m_fontFallbackList = other.m_fontFallbackList;
m_canShapeWordByWord = other.m_canShapeWordByWord;
m_shapeWordByWordComputed = other.m_shapeWordByWordComputed;
+ m_firstPaintReported = other.m_firstPaintReported;
return *this;
}
@@ -143,6 +146,8 @@ void Font::drawText(SkCanvas* canvas, const TextRunPaintInfo& runInfo,
if (shouldSkipDrawing())
return;
+ reportFirstTextPaint();
+
if (runInfo.cachedTextBlob && runInfo.cachedTextBlob->get()) {
// we have a pre-cached blob -- happy joy!
drawTextBlob(canvas, paint, runInfo.cachedTextBlob->get(), point.data());
@@ -163,6 +168,8 @@ void Font::drawBidiText(SkCanvas* canvas, const TextRunPaintInfo& runInfo, const
if (shouldSkipDrawing() && customFontNotReadyAction == DoNotPaintIfFontNotReady)
return;
+ reportFirstTextPaint();
+
// sub-run painting is not supported for Bidi text.
const TextRun& run = runInfo.run;
ASSERT((runInfo.from == 0) && (runInfo.to == run.length()));
@@ -201,6 +208,17 @@ void Font::drawBidiText(SkCanvas* canvas, const TextRunPaintInfo& runInfo, const
bidiRuns.deleteRuns();
}
+void Font::reportFirstTextPaint() const
+{
+ if (m_firstPaintReported || !fontSelector())
+ return;
+ m_firstPaintReported = true;
+
+ if (m_fontFallbackList->hasCustomFont())
+ fontSelector()->reportFirstCustomFontText();
+ fontSelector()->reportFirstNonBlankText();
+}
+
void Font::drawEmphasisMarks(SkCanvas* canvas, const TextRunPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point, float deviceScaleFactor, const SkPaint& paint) const
{
if (shouldSkipDrawing())
« no previous file with comments | « Source/platform/fonts/Font.h ('k') | Source/platform/fonts/FontFallbackList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698