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

Side by Side 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, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/RemoteFontFaceSource.h" 5 #include "core/css/RemoteFontFaceSource.h"
6 6
7 #include "core/css/CSSCustomFontData.h" 7 #include "core/css/CSSCustomFontData.h"
8 #include "core/css/CSSFontFace.h" 8 #include "core/css/CSSFontFace.h"
9 #include "core/css/CSSFontSelector.h" 9 #include "core/css/CSSFontSelector.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 if (m_blankPaintTime <= 0) 264 if (m_blankPaintTime <= 0)
265 return; 265 return;
266 int duration = static_cast<int>(currentTimeMS() - m_blankPaintTime); 266 int duration = static_cast<int>(currentTimeMS() - m_blankPaintTime);
267 DEFINE_STATIC_LOCAL(CustomCountHistogram, blankTextShownTimeHistogram, ("Web Font.BlankTextShownTime", 0, 10000, 50)); 267 DEFINE_STATIC_LOCAL(CustomCountHistogram, blankTextShownTimeHistogram, ("Web Font.BlankTextShownTime", 0, 10000, 50));
268 blankTextShownTimeHistogram.count(duration); 268 blankTextShownTimeHistogram.count(duration);
269 m_blankPaintTime = -1; 269 m_blankPaintTime = -1;
270 } 270 }
271 271
272 void RemoteFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResour ce* font) 272 void RemoteFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResour ce* font)
273 { 273 {
274 if (m_dataSource == FromDiskCache || m_dataSource == FromNetwork) {
275 // Collect load time only if |m_loadStartTime| was set, i.e. the owning
276 // RemoteFontFaceSource instance started the loading of |m_font|.
277 // Otherwise we classify as memory cache hit.
278 if (m_loadStartTime) {
279 int duration = static_cast<int>(currentTimeMS() - m_loadStartTime);
280 recordLoadTimeHistogram(font, duration);
281
282 enum { CORSFail, CORSSuccess, CORSEnumMax };
283 int corsValue = font->isCORSFailed() ? CORSFail : CORSSuccess;
284 DEFINE_STATIC_LOCAL(EnumerationHistogram, corsHistogram, ("WebFont.C ORSSuccess", CORSEnumMax));
285 corsHistogram.count(corsValue);
286 } else {
287 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.
288 }
289 }
290
274 DEFINE_STATIC_LOCAL(EnumerationHistogram, cacheHitHistogram, ("WebFont.Cache Hit", CacheHitEnumMax)); 291 DEFINE_STATIC_LOCAL(EnumerationHistogram, cacheHitHistogram, ("WebFont.Cache Hit", CacheHitEnumMax));
275 cacheHitHistogram.count(dataSourceMetricsValue()); 292 cacheHitHistogram.count(dataSourceMetricsValue());
276
277 if (m_dataSource == FromDiskCache || m_dataSource == FromNetwork) {
278 int duration = static_cast<int>(currentTimeMS() - m_loadStartTime);
279 recordLoadTimeHistogram(font, duration);
280
281 enum { CORSFail, CORSSuccess, CORSEnumMax };
282 int corsValue = font->isCORSFailed() ? CORSFail : CORSSuccess;
283 DEFINE_STATIC_LOCAL(EnumerationHistogram, corsHistogram, ("WebFont.CORSS uccess", CORSEnumMax));
284 corsHistogram.count(corsValue);
285 }
286 } 293 }
287 294
288 void RemoteFontFaceSource::FontLoadHistograms::recordLoadTimeHistogram(const Fon tResource* font, int duration) 295 void RemoteFontFaceSource::FontLoadHistograms::recordLoadTimeHistogram(const Fon tResource* font, int duration)
289 { 296 {
290 CHECK_NE(FromUnknown, m_dataSource); 297 CHECK_NE(FromUnknown, m_dataSource);
291 298
292 if (font->errorOccurred()) { 299 if (font->errorOccurred()) {
293 DEFINE_STATIC_LOCAL(CustomCountHistogram, loadErrorHistogram, ("WebFont. DownloadTime.LoadError", 0, 10000, 50)); 300 DEFINE_STATIC_LOCAL(CustomCountHistogram, loadErrorHistogram, ("WebFont. DownloadTime.LoadError", 0, 10000, 50));
294 DEFINE_STATIC_LOCAL(CustomCountHistogram, missedCacheLoadErrorHistogram, ("WebFont.MissedCache.DownloadTime.LoadError", 0, 10000, 50)); 301 DEFINE_STATIC_LOCAL(CustomCountHistogram, missedCacheLoadErrorHistogram, ("WebFont.MissedCache.DownloadTime.LoadError", 0, 10000, 50));
295 loadErrorHistogram.count(duration); 302 loadErrorHistogram.count(duration);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 return Miss; 377 return Miss;
371 case FromUnknown: 378 case FromUnknown:
372 // Fall through. 379 // Fall through.
373 default: 380 default:
374 NOTREACHED(); 381 NOTREACHED();
375 } 382 }
376 return Miss; 383 return Miss;
377 } 384 }
378 385
379 } // namespace blink 386 } // namespace blink
OLDNEW
« 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