Chromium Code Reviews| 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 45ce1f6e3951a4b4a73d4f48ebc429d701ad063e..e5841e764286acfa187ca839928df0a17e98e98c 100644 |
| --- a/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp |
| +++ b/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp |
| @@ -112,7 +112,7 @@ void RemoteFontFaceSource::notifyFinished(Resource*) { |
| m_histograms.maySetDataSource(m_font->response().wasCached() |
| ? FontLoadHistograms::FromDiskCache |
| : FontLoadHistograms::FromNetwork); |
| - m_histograms.recordRemoteFont(m_font.get()); |
| + m_histograms.recordRemoteFont(m_font.get(), m_isInterventionTriggered); |
| m_histograms.fontLoaded(m_font->isCORSFailed(), |
| m_font->getStatus() == Resource::LoadError, |
| m_isInterventionTriggered); |
| @@ -295,7 +295,8 @@ void RemoteFontFaceSource::FontLoadHistograms::recordFallbackTime( |
| } |
| void RemoteFontFaceSource::FontLoadHistograms::recordRemoteFont( |
| - const FontResource* font) { |
| + const FontResource* font, |
| + bool isInterventionTriggered) { |
| DEFINE_STATIC_LOCAL(EnumerationHistogram, cacheHitHistogram, |
| ("WebFont.CacheHit", CacheHitEnumMax)); |
| cacheHitHistogram.count(dataSourceMetricsValue()); |
| @@ -303,7 +304,7 @@ void RemoteFontFaceSource::FontLoadHistograms::recordRemoteFont( |
| if (m_dataSource == FromDiskCache || m_dataSource == FromNetwork) { |
| DCHECK_NE(m_loadStartTime, 0); |
| int duration = static_cast<int>(currentTimeMS() - m_loadStartTime); |
| - recordLoadTimeHistogram(font, duration); |
| + recordLoadTimeHistogram(font, duration, isInterventionTriggered); |
| enum { CORSFail, CORSSuccess, CORSEnumMax }; |
| int corsValue = font->isCORSFailed() ? CORSFail : CORSSuccess; |
| @@ -328,7 +329,8 @@ void RemoteFontFaceSource::FontLoadHistograms::maySetDataSource( |
| void RemoteFontFaceSource::FontLoadHistograms::recordLoadTimeHistogram( |
| const FontResource* font, |
| - int duration) { |
| + int duration, |
| + bool isInterventionTriggered) { |
| CHECK_NE(FromUnknown, m_dataSource); |
| if (font->errorOccurred()) { |
| @@ -361,9 +363,28 @@ void RemoteFontFaceSource::FontLoadHistograms::recordLoadTimeHistogram( |
| DEFINE_STATIC_LOCAL( |
| CustomCountHistogram, missedCacheUnder50kHistogram, |
| ("WebFont.MissedCache.DownloadTime.1.10KBTo50KB", 0, 10000, 50)); |
| + // Breakdowns metrics to understand WebFonts intervention. |
| + // Now we only cover this 10KBto50KB range because 70% of requests are |
| + // covered in this range, and having metrics for all size cases cost. |
| + // TODO(toyoshim): edit histograms.xml. |
|
kinuko
2016/10/26 02:41:49
do we still need this TODO?
Takashi Toyoshima
2016/10/26 21:35:20
oops, thank you for catching this.
|
| + DEFINE_STATIC_LOCAL(CustomCountHistogram, |
| + missedCacheAndInterventionTriggeredUnder50kHistogram, |
| + ("WebFont.MissedCacheAndInterventionTriggered." |
| + "DownloadTime.1.10KBTo50KB", |
| + 0, 10000, 50)); |
| + DEFINE_STATIC_LOCAL(CustomCountHistogram, |
| + missedCacheAndInterventionNotTriggeredUnder50kHistogram, |
| + ("WebFont.MissedCacheAndInterventionNotTriggered." |
| + "DownloadTime.1.10KBTo50KB", |
| + 0, 10000, 50)); |
| under50kHistogram.count(duration); |
| - if (m_dataSource == FromNetwork) |
| + if (m_dataSource == FromNetwork) { |
| missedCacheUnder50kHistogram.count(duration); |
| + if (isInterventionTriggered) |
| + missedCacheAndInterventionTriggeredUnder50kHistogram.count(duration); |
| + else |
| + missedCacheAndInterventionNotTriggeredUnder50kHistogram.count(duration); |
| + } |
| return; |
| } |
| if (size < 100 * 1024) { |