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

Side by Side Diff: third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp

Issue 1652983005: Remove Enumeration Histograms from the Blink Platform API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_blink_histograms_5a
Patch Set: Rebase two new histograms were added today Created 4 years, 10 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
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/FontLoader.h" 9 #include "core/css/FontLoader.h"
10 #include "core/page/NetworkStateNotifier.h" 10 #include "core/page/NetworkStateNotifier.h"
11 #include "platform/Histogram.h" 11 #include "platform/Histogram.h"
12 #include "platform/RuntimeEnabledFeatures.h" 12 #include "platform/RuntimeEnabledFeatures.h"
13 #include "platform/fonts/FontCache.h" 13 #include "platform/fonts/FontCache.h"
14 #include "platform/fonts/FontDescription.h" 14 #include "platform/fonts/FontDescription.h"
15 #include "platform/fonts/SimpleFontData.h" 15 #include "platform/fonts/SimpleFontData.h"
16 #include "public/platform/Platform.h"
17 #include "wtf/CurrentTime.h" 16 #include "wtf/CurrentTime.h"
18 17
19 namespace blink { 18 namespace blink {
20 19
21 RemoteFontFaceSource::RemoteFontFaceSource(FontResource* font, PassRefPtrWillBeR awPtr<FontLoader> fontLoader, FontDisplay display) 20 RemoteFontFaceSource::RemoteFontFaceSource(FontResource* font, PassRefPtrWillBeR awPtr<FontLoader> fontLoader, FontDisplay display)
22 : m_font(font) 21 : m_font(font)
23 , m_fontLoader(fontLoader) 22 , m_fontLoader(fontLoader)
24 , m_display(display) 23 , m_display(display)
25 , m_period(display == FontDisplaySwap ? SwapPeriod : BlockPeriod) 24 , m_period(display == FontDisplaySwap ? SwapPeriod : BlockPeriod)
26 , m_isInterventionTriggered(false) 25 , m_isInterventionTriggered(false)
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 { 228 {
230 if (m_loadStartTime > 0 && font && !font->isLoading()) { 229 if (m_loadStartTime > 0 && font && !font->isLoading()) {
231 int duration = static_cast<int>(currentTimeMS() - m_loadStartTime); 230 int duration = static_cast<int>(currentTimeMS() - m_loadStartTime);
232 recordLoadTimeHistogram(font, duration); 231 recordLoadTimeHistogram(font, duration);
233 m_loadStartTime = -1; 232 m_loadStartTime = -1;
234 233
235 enum { Miss, Hit, DataUrl, CacheHitEnumMax }; 234 enum { Miss, Hit, DataUrl, CacheHitEnumMax };
236 int histogramValue = font->url().protocolIsData() ? DataUrl 235 int histogramValue = font->url().protocolIsData() ? DataUrl
237 : font->response().wasCached() ? Hit 236 : font->response().wasCached() ? Hit
238 : Miss; 237 : Miss;
239 Platform::current()->histogramEnumeration("WebFont.CacheHit", histogramV alue, CacheHitEnumMax); 238 DEFINE_STATIC_LOCAL(EnumerationHistogram, cacheHitHistogram, ("WebFont.C acheHit", CacheHitEnumMax));
239 cacheHitHistogram.count(histogramValue);
240 240
241 enum { CORSFail, CORSSuccess, CORSEnumMax }; 241 enum { CORSFail, CORSSuccess, CORSEnumMax };
242 int corsValue = font->isCORSFailed() ? CORSFail : CORSSuccess; 242 int corsValue = font->isCORSFailed() ? CORSFail : CORSSuccess;
243 Platform::current()->histogramEnumeration("WebFont.CORSSuccess", corsVal ue, CORSEnumMax); 243 DEFINE_STATIC_LOCAL(EnumerationHistogram, corsHistogram, ("WebFont.CORSS uccess", CORSEnumMax));
244 corsHistogram.count(corsValue);
244 } 245 }
245 } 246 }
246 247
247 void RemoteFontFaceSource::FontLoadHistograms::recordLoadTimeHistogram(const Fon tResource* font, int duration) 248 void RemoteFontFaceSource::FontLoadHistograms::recordLoadTimeHistogram(const Fon tResource* font, int duration)
248 { 249 {
249 if (font->errorOccurred()) { 250 if (font->errorOccurred()) {
250 DEFINE_STATIC_LOCAL(CustomCountHistogram, loadErrorHistogram, ("WebFont. DownloadTime.LoadError", 0, 10000, 50)); 251 DEFINE_STATIC_LOCAL(CustomCountHistogram, loadErrorHistogram, ("WebFont. DownloadTime.LoadError", 0, 10000, 50));
251 loadErrorHistogram.count(duration); 252 loadErrorHistogram.count(duration);
252 return; 253 return;
253 } 254 }
(...skipping 27 matching lines...) Expand all
281 { 282 {
282 if (!RuntimeEnabledFeatures::webFontsInterventionEnabled()) 283 if (!RuntimeEnabledFeatures::webFontsInterventionEnabled())
283 return; 284 return;
284 // interventionResult takes 0-3 values. 285 // interventionResult takes 0-3 values.
285 int interventionResult = 0; 286 int interventionResult = 0;
286 if (m_isLongLimitExceeded) 287 if (m_isLongLimitExceeded)
287 interventionResult |= 1 << 0; 288 interventionResult |= 1 << 0;
288 if (triggered) 289 if (triggered)
289 interventionResult |= 1 << 1; 290 interventionResult |= 1 << 1;
290 const int boundary = 1 << 2; 291 const int boundary = 1 << 2;
291 Platform::current()->histogramEnumeration("WebFont.InterventionResult", inte rventionResult, boundary); 292
293 DEFINE_STATIC_LOCAL(EnumerationHistogram, interventionHistogram, ("WebFont.I nterventionResult", boundary));
294 interventionHistogram.count(interventionResult);
292 } 295 }
293 296
294 } // namespace blink 297 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698