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

Side by Side Diff: Source/core/css/CSSFontFaceSource.cpp

Issue 180273020: UMA histograms to measure whether / how long blank text is rendered for loading web fonts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSFontFaceSource.h ('k') | Source/core/css/FontFace.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 fontDescription.isSyntheticBold(), 198 fontDescription.isSyntheticBold(),
199 fontDescription.isSyntheticItalic()); 199 fontDescription.isSyntheticItalic());
200 } 200 }
201 } else 201 } else
202 #endif 202 #endif
203 { 203 {
204 // Create new FontPlatformData from our CGFontRef, point size an d ATSFontRef. 204 // Create new FontPlatformData from our CGFontRef, point size an d ATSFontRef.
205 if (!m_font->ensureCustomFontData()) 205 if (!m_font->ensureCustomFontData())
206 return nullptr; 206 return nullptr;
207 207
208 m_histograms.recordFallbackTime(m_font.get());
209
208 fontData = SimpleFontData::create( 210 fontData = SimpleFontData::create(
209 m_font->platformDataFromCustomData(fontDescription.effective FontSize(), 211 m_font->platformDataFromCustomData(fontDescription.effective FontSize(),
210 fontDescription.isSyntheticBold(), fontDescription.isSyn theticItalic(), 212 fontDescription.isSyntheticBold(), fontDescription.isSyn theticItalic(),
211 fontDescription.orientation(), fontDescription.widthVari ant()), CustomFontData::create(false)); 213 fontDescription.orientation(), fontDescription.widthVari ant()), CustomFontData::create(false));
212 } 214 }
213 } else { 215 } else {
214 #if ENABLE(SVG_FONTS) 216 #if ENABLE(SVG_FONTS)
215 // In-Document SVG Fonts 217 // In-Document SVG Fonts
216 if (m_svgFontFaceElement) { 218 if (m_svgFontFaceElement) {
217 fontData = SimpleFontData::create( 219 fontData = SimpleFontData::create(
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 if (m_face && m_font) 280 if (m_face && m_font)
279 m_face->beginLoadIfNeeded(this); 281 m_face->beginLoadIfNeeded(this);
280 } 282 }
281 283
282 void CSSFontFaceSource::FontLoadHistograms::loadStarted() 284 void CSSFontFaceSource::FontLoadHistograms::loadStarted()
283 { 285 {
284 if (!m_loadStartTime) 286 if (!m_loadStartTime)
285 m_loadStartTime = currentTimeMS(); 287 m_loadStartTime = currentTimeMS();
286 } 288 }
287 289
290 void CSSFontFaceSource::FontLoadHistograms::fallbackFontPainted()
291 {
292 if (!m_fallbackPaintTime)
293 m_fallbackPaintTime = currentTimeMS();
294 }
295
288 void CSSFontFaceSource::FontLoadHistograms::recordLocalFont(bool loadSuccess) 296 void CSSFontFaceSource::FontLoadHistograms::recordLocalFont(bool loadSuccess)
289 { 297 {
290 if (!m_loadStartTime) { 298 if (!m_loadStartTime) {
291 blink::Platform::current()->histogramEnumeration("WebFont.LocalFontUsed" , loadSuccess ? 1 : 0, 2); 299 blink::Platform::current()->histogramEnumeration("WebFont.LocalFontUsed" , loadSuccess ? 1 : 0, 2);
292 m_loadStartTime = -1; // Do not count this font again. 300 m_loadStartTime = -1; // Do not count this font again.
293 } 301 }
294 } 302 }
295 303
304 void CSSFontFaceSource::FontLoadHistograms::recordFallbackTime(const FontResourc e* font)
305 {
306 if (m_fallbackPaintTime > 0) {
dglazkov 2014/03/04 17:24:08 Early return?
Kunihiko Sakamoto 2014/03/05 08:55:59 Done.
307 int duration = static_cast<int>(currentTimeMS() - m_fallbackPaintTime);
308 blink::Platform::current()->histogramCustomCounts("WebFont.BlankTextShow nTime", duration, 0, 10000, 50);
309 m_fallbackPaintTime = -1;
310 }
311 }
312
296 void CSSFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResource* font) 313 void CSSFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResource* font)
297 { 314 {
298 if (m_loadStartTime > 0 && font && !font->isLoading()) { 315 if (m_loadStartTime > 0 && font && !font->isLoading()) {
299 int duration = static_cast<int>(currentTimeMS() - m_loadStartTime); 316 int duration = static_cast<int>(currentTimeMS() - m_loadStartTime);
300 blink::Platform::current()->histogramCustomCounts(histogramName(font), d uration, 0, 10000, 50); 317 blink::Platform::current()->histogramCustomCounts(histogramName(font), d uration, 0, 10000, 50);
301 m_loadStartTime = -1; 318 m_loadStartTime = -1;
302 319
303 enum { Miss, Hit, DataUrl, CacheHitEnumMax }; 320 enum { Miss, Hit, DataUrl, CacheHitEnumMax };
304 int histogramValue = font->url().protocolIsData() ? DataUrl 321 int histogramValue = font->url().protocolIsData() ? DataUrl
305 : font->response().wasCached() ? Hit 322 : font->response().wasCached() ? Hit
(...skipping 13 matching lines...) Expand all
319 if (size < 50 * 1024) 336 if (size < 50 * 1024)
320 return "WebFont.DownloadTime.1.10KBTo50KB"; 337 return "WebFont.DownloadTime.1.10KBTo50KB";
321 if (size < 100 * 1024) 338 if (size < 100 * 1024)
322 return "WebFont.DownloadTime.2.50KBTo100KB"; 339 return "WebFont.DownloadTime.2.50KBTo100KB";
323 if (size < 1024 * 1024) 340 if (size < 1024 * 1024)
324 return "WebFont.DownloadTime.3.100KBTo1MB"; 341 return "WebFont.DownloadTime.3.100KBTo1MB";
325 return "WebFont.DownloadTime.4.Over1MB"; 342 return "WebFont.DownloadTime.4.Over1MB";
326 } 343 }
327 344
328 } 345 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSFontFaceSource.h ('k') | Source/core/css/FontFace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698