Commit e07469c8 authored by shaochuan's avatar shaochuan Committed by Commit bot

Refine FontLoadHistograms::recordRemoteFont() logic

1. Move cacheHitHistogram count out of if statement to include memory cache
hits, whose |m_loadStartTime| is 0.
2. Remove redundant checks in if statement. After previous refactoring,
recordRemoteFont() is now only called once from notifyFinished(), and |font|
here is always available and loaded.
3. Use DataSource to determine cases to record load time (data URL loads have
non-zero |m_loadStartTime| but should complete immediately).

Review-Url: https://codereview.chromium.org/2342273003
Cr-Commit-Position: refs/heads/master@{#419144}
parent 43fd1051
......@@ -265,13 +265,12 @@ void RemoteFontFaceSource::FontLoadHistograms::recordFallbackTime(const FontReso
void RemoteFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResource* font)
{
if (m_loadStartTime > 0 && font && !font->isLoading()) {
DEFINE_STATIC_LOCAL(EnumerationHistogram, cacheHitHistogram, ("WebFont.CacheHit", CacheHitEnumMax));
cacheHitHistogram.count(dataSourceMetricsValue());
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);
m_loadStartTime = -1;
enum { CORSFail, CORSSuccess, CORSEnumMax };
int corsValue = font->isCORSFailed() ? CORSFail : CORSSuccess;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment