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

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: #20 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
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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 void RemoteFontFaceSource::FontLoadHistograms::fontLoaded(bool isInterventionTri ggered) 248 void RemoteFontFaceSource::FontLoadHistograms::fontLoaded(bool isInterventionTri ggered)
249 { 249 {
250 if (!m_isLongLimitExceeded) 250 if (!m_isLongLimitExceeded)
251 recordInterventionResult(isInterventionTriggered); 251 recordInterventionResult(isInterventionTriggered);
252 } 252 }
253 253
254 void RemoteFontFaceSource::FontLoadHistograms::longLimitExceeded(bool isInterven tionTriggered) 254 void RemoteFontFaceSource::FontLoadHistograms::longLimitExceeded(bool isInterven tionTriggered)
255 { 255 {
256 m_isLongLimitExceeded = true; 256 m_isLongLimitExceeded = true;
257 if (m_dataSource == FromUnknown) 257 maySetDataSource(FromNetwork);
258 m_dataSource = FromNetwork;
259 recordInterventionResult(isInterventionTriggered); 258 recordInterventionResult(isInterventionTriggered);
260 } 259 }
261 260
262 void RemoteFontFaceSource::FontLoadHistograms::recordFallbackTime(const FontReso urce* font) 261 void RemoteFontFaceSource::FontLoadHistograms::recordFallbackTime(const FontReso urce* font)
263 { 262 {
264 if (m_blankPaintTime <= 0) 263 if (m_blankPaintTime <= 0)
265 return; 264 return;
266 int duration = static_cast<int>(currentTimeMS() - m_blankPaintTime); 265 int duration = static_cast<int>(currentTimeMS() - m_blankPaintTime);
267 DEFINE_STATIC_LOCAL(CustomCountHistogram, blankTextShownTimeHistogram, ("Web Font.BlankTextShownTime", 0, 10000, 50)); 266 DEFINE_STATIC_LOCAL(CustomCountHistogram, blankTextShownTimeHistogram, ("Web Font.BlankTextShownTime", 0, 10000, 50));
268 blankTextShownTimeHistogram.count(duration); 267 blankTextShownTimeHistogram.count(duration);
269 m_blankPaintTime = -1; 268 m_blankPaintTime = -1;
270 } 269 }
271 270
272 void RemoteFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResour ce* font) 271 void RemoteFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResour ce* font)
273 { 272 {
274 DEFINE_STATIC_LOCAL(EnumerationHistogram, cacheHitHistogram, ("WebFont.Cache Hit", CacheHitEnumMax)); 273 DEFINE_STATIC_LOCAL(EnumerationHistogram, cacheHitHistogram, ("WebFont.Cache Hit", CacheHitEnumMax));
275 cacheHitHistogram.count(dataSourceMetricsValue()); 274 cacheHitHistogram.count(dataSourceMetricsValue());
276 275
277 if (m_dataSource == FromDiskCache || m_dataSource == FromNetwork) { 276 if (m_dataSource == FromDiskCache || m_dataSource == FromNetwork) {
277 DCHECK_NE(m_loadStartTime, 0);
278 int duration = static_cast<int>(currentTimeMS() - m_loadStartTime); 278 int duration = static_cast<int>(currentTimeMS() - m_loadStartTime);
279 recordLoadTimeHistogram(font, duration); 279 recordLoadTimeHistogram(font, duration);
280 280
281 enum { CORSFail, CORSSuccess, CORSEnumMax }; 281 enum { CORSFail, CORSSuccess, CORSEnumMax };
282 int corsValue = font->isCORSFailed() ? CORSFail : CORSSuccess; 282 int corsValue = font->isCORSFailed() ? CORSFail : CORSSuccess;
283 DEFINE_STATIC_LOCAL(EnumerationHistogram, corsHistogram, ("WebFont.CORSS uccess", CORSEnumMax)); 283 DEFINE_STATIC_LOCAL(EnumerationHistogram, corsHistogram, ("WebFont.CORSS uccess", CORSEnumMax));
284 corsHistogram.count(corsValue); 284 corsHistogram.count(corsValue);
285 } 285 }
286 } 286 }
287 287
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 return Miss; 370 return Miss;
371 case FromUnknown: 371 case FromUnknown:
372 // Fall through. 372 // Fall through.
373 default: 373 default:
374 NOTREACHED(); 374 NOTREACHED();
375 } 375 }
376 return Miss; 376 return Miss;
377 } 377 }
378 378
379 } // namespace blink 379 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698