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

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

Issue 44453002: Remove HistogramSupport abstraction layer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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/core.gypi ('k') | Source/core/css/FontFaceSet.cpp » ('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 12 matching lines...) Expand all
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "core/css/CSSFontFaceSource.h" 27 #include "core/css/CSSFontFaceSource.h"
28 28
29 #include "RuntimeEnabledFeatures.h" 29 #include "RuntimeEnabledFeatures.h"
30 #include "core/css/CSSFontFace.h" 30 #include "core/css/CSSFontFace.h"
31 #include "core/css/CSSFontSelector.h" 31 #include "core/css/CSSFontSelector.h"
32 #include "core/fetch/FontResource.h" 32 #include "core/fetch/FontResource.h"
33 #include "core/platform/HistogramSupport.h"
34 #include "core/platform/graphics/FontCache.h" 33 #include "core/platform/graphics/FontCache.h"
35 #include "core/platform/graphics/FontDescription.h" 34 #include "core/platform/graphics/FontDescription.h"
36 #include "core/platform/graphics/SimpleFontData.h" 35 #include "core/platform/graphics/SimpleFontData.h"
36 #include "public/platform/Platform.h"
37 #include "wtf/CurrentTime.h" 37 #include "wtf/CurrentTime.h"
38 38
39 #if ENABLE(SVG_FONTS) 39 #if ENABLE(SVG_FONTS)
40 #include "SVGNames.h" 40 #include "SVGNames.h"
41 #include "core/svg/SVGFontData.h" 41 #include "core/svg/SVGFontData.h"
42 #include "core/svg/SVGFontElement.h" 42 #include "core/svg/SVGFontElement.h"
43 #include "core/svg/SVGFontFaceElement.h" 43 #include "core/svg/SVGFontFaceElement.h"
44 #endif 44 #endif
45 45
46 namespace WebCore { 46 namespace WebCore {
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 273
274 void CSSFontFaceSource::FontLoadHistograms::loadStarted() 274 void CSSFontFaceSource::FontLoadHistograms::loadStarted()
275 { 275 {
276 if (!m_loadStartTime) 276 if (!m_loadStartTime)
277 m_loadStartTime = currentTimeMS(); 277 m_loadStartTime = currentTimeMS();
278 } 278 }
279 279
280 void CSSFontFaceSource::FontLoadHistograms::recordLocalFont(bool loadSuccess) 280 void CSSFontFaceSource::FontLoadHistograms::recordLocalFont(bool loadSuccess)
281 { 281 {
282 if (!m_loadStartTime) { 282 if (!m_loadStartTime) {
283 HistogramSupport::histogramEnumeration("WebFont.LocalFontUsed", loadSucc ess ? 1 : 0, 2); 283 WebKit::Platform::current()->histogramEnumeration("WebFont.LocalFontUsed ", loadSuccess ? 1 : 0, 2);
284 m_loadStartTime = -1; // Do not count this font again. 284 m_loadStartTime = -1; // Do not count this font again.
285 } 285 }
286 } 286 }
287 287
288 void CSSFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResource* font) 288 void CSSFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResource* font)
289 { 289 {
290 if (m_loadStartTime > 0 && font && !font->isLoading()) { 290 if (m_loadStartTime > 0 && font && !font->isLoading()) {
291 int duration = static_cast<int>(currentTimeMS() - m_loadStartTime); 291 int duration = static_cast<int>(currentTimeMS() - m_loadStartTime);
292 HistogramSupport::histogramCustomCounts(histogramName(font), duration, 0 , 10000, 50); 292 WebKit::Platform::current()->histogramCustomCounts(histogramName(font), duration, 0, 10000, 50);
293 m_loadStartTime = -1; 293 m_loadStartTime = -1;
294 294
295 enum { Miss, Hit, DataUrl, CacheHitEnumMax }; 295 enum { Miss, Hit, DataUrl, CacheHitEnumMax };
296 int histogramValue = font->url().protocolIsData() ? DataUrl 296 int histogramValue = font->url().protocolIsData() ? DataUrl
297 : font->response().wasCached() ? Hit 297 : font->response().wasCached() ? Hit
298 : Miss; 298 : Miss;
299 HistogramSupport::histogramEnumeration("WebFont.CacheHit", histogramValu e, CacheHitEnumMax); 299 WebKit::Platform::current()->histogramEnumeration("WebFont.CacheHit", hi stogramValue, CacheHitEnumMax);
300 } 300 }
301 } 301 }
302 302
303 const char* CSSFontFaceSource::FontLoadHistograms::histogramName(const FontResou rce* font) 303 const char* CSSFontFaceSource::FontLoadHistograms::histogramName(const FontResou rce* font)
304 { 304 {
305 if (font->errorOccurred()) 305 if (font->errorOccurred())
306 return "WebFont.DownloadTime.LoadError"; 306 return "WebFont.DownloadTime.LoadError";
307 307
308 unsigned size = font->encodedSize(); 308 unsigned size = font->encodedSize();
309 if (size < 10 * 1024) 309 if (size < 10 * 1024)
310 return "WebFont.DownloadTime.0.Under10KB"; 310 return "WebFont.DownloadTime.0.Under10KB";
311 if (size < 50 * 1024) 311 if (size < 50 * 1024)
312 return "WebFont.DownloadTime.1.10KBTo50KB"; 312 return "WebFont.DownloadTime.1.10KBTo50KB";
313 if (size < 100 * 1024) 313 if (size < 100 * 1024)
314 return "WebFont.DownloadTime.2.50KBTo100KB"; 314 return "WebFont.DownloadTime.2.50KBTo100KB";
315 if (size < 1024 * 1024) 315 if (size < 1024 * 1024)
316 return "WebFont.DownloadTime.3.100KBTo1MB"; 316 return "WebFont.DownloadTime.3.100KBTo1MB";
317 return "WebFont.DownloadTime.4.Over1MB"; 317 return "WebFont.DownloadTime.4.Over1MB";
318 } 318 }
319 319
320 } 320 }
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/FontFaceSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698