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

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

Issue 2359493004: FontLoadHistograms: classify as memory cache hit if FontResource loading not triggered (Closed)
Patch Set: Created 4 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 | « no previous file | 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 638504edc43eb4d7de3a6f295989eb95929a4d1c..197c0999381f8ff83fd041380cb77989944de20c 100644
--- a/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp
+++ b/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp
@@ -218,6 +218,10 @@ void RemoteFontFaceSource::beginLoadIfNeeded()
if (m_fontSelector->document() && m_font->stillNeedsLoad()) {
m_fontSelector->document()->fetcher()->startLoad(m_font);
m_histograms.loadStarted();
+ } else {
+ // In this case the |m_font| loading is already started by another
+ // RemoteFontFaceSource instance, classify as memory cache hit.
+ m_histograms.maySetDataSource(FontLoadHistograms::FromMemoryCache);
}
m_font->startLoadLimitTimersIfNeeded();
@@ -275,6 +279,7 @@ void RemoteFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResour
cacheHitHistogram.count(dataSourceMetricsValue());
if (m_dataSource == FromDiskCache || m_dataSource == FromNetwork) {
+ DCHECK(m_loadStartTime);
kouhei (in TOK) 2016/09/23 01:33:59 using DCHECK on double scares me a bit. DCHECK_LT(
Shao-Chuan Lee 2016/09/23 01:47:19 Checking if non-zero should suffice here, maybe I
kouhei (in TOK) 2016/09/30 01:18:35 DCHECK_NE(m_loadStartTime, 0.0) is also OK.
int duration = static_cast<int>(currentTimeMS() - m_loadStartTime);
recordLoadTimeHistogram(font, duration);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698