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

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: fix cases when beginLoadIfNeeded() is not called 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..94d4ea9725e08e08d81be7b68078bafc3558a19d 100644
--- a/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp
+++ b/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp
@@ -271,18 +271,25 @@ void RemoteFontFaceSource::FontLoadHistograms::recordFallbackTime(const FontReso
void RemoteFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResource* font)
{
- DEFINE_STATIC_LOCAL(EnumerationHistogram, cacheHitHistogram, ("WebFont.CacheHit", CacheHitEnumMax));
- cacheHitHistogram.count(dataSourceMetricsValue());
-
if (m_dataSource == FromDiskCache || m_dataSource == FromNetwork) {
- int duration = static_cast<int>(currentTimeMS() - m_loadStartTime);
- recordLoadTimeHistogram(font, duration);
-
- enum { CORSFail, CORSSuccess, CORSEnumMax };
- int corsValue = font->isCORSFailed() ? CORSFail : CORSSuccess;
- DEFINE_STATIC_LOCAL(EnumerationHistogram, corsHistogram, ("WebFont.CORSSuccess", CORSEnumMax));
- corsHistogram.count(corsValue);
+ // Collect load time only if |m_loadStartTime| was set, i.e. the owning
+ // RemoteFontFaceSource instance started the loading of |m_font|.
+ // Otherwise we classify as memory cache hit.
+ if (m_loadStartTime) {
+ int duration = static_cast<int>(currentTimeMS() - m_loadStartTime);
+ recordLoadTimeHistogram(font, duration);
+
+ enum { CORSFail, CORSSuccess, CORSEnumMax };
+ int corsValue = font->isCORSFailed() ? CORSFail : CORSSuccess;
+ DEFINE_STATIC_LOCAL(EnumerationHistogram, corsHistogram, ("WebFont.CORSSuccess", CORSEnumMax));
+ corsHistogram.count(corsValue);
+ } else {
+ m_dataSource = FromMemoryCache;
Kunihiko Sakamoto 2016/09/23 07:39:18 Before this patch, we only had transitions from Fr
Shao-Chuan Lee 2016/09/23 08:41:06 Done.
+ }
}
+
+ DEFINE_STATIC_LOCAL(EnumerationHistogram, cacheHitHistogram, ("WebFont.CacheHit", CacheHitEnumMax));
+ cacheHitHistogram.count(dataSourceMetricsValue());
}
void RemoteFontFaceSource::FontLoadHistograms::recordLoadTimeHistogram(const FontResource* font, int 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