| OLD | NEW |
| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 if (m_blankPaintTime <= 0) | 258 if (m_blankPaintTime <= 0) |
| 259 return; | 259 return; |
| 260 int duration = static_cast<int>(currentTimeMS() - m_blankPaintTime); | 260 int duration = static_cast<int>(currentTimeMS() - m_blankPaintTime); |
| 261 DEFINE_STATIC_LOCAL(CustomCountHistogram, blankTextShownTimeHistogram, ("Web
Font.BlankTextShownTime", 0, 10000, 50)); | 261 DEFINE_STATIC_LOCAL(CustomCountHistogram, blankTextShownTimeHistogram, ("Web
Font.BlankTextShownTime", 0, 10000, 50)); |
| 262 blankTextShownTimeHistogram.count(duration); | 262 blankTextShownTimeHistogram.count(duration); |
| 263 m_blankPaintTime = -1; | 263 m_blankPaintTime = -1; |
| 264 } | 264 } |
| 265 | 265 |
| 266 void RemoteFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResour
ce* font) | 266 void RemoteFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResour
ce* font) |
| 267 { | 267 { |
| 268 if (m_loadStartTime > 0 && font && !font->isLoading()) { | 268 DEFINE_STATIC_LOCAL(EnumerationHistogram, cacheHitHistogram, ("WebFont.Cache
Hit", CacheHitEnumMax)); |
| 269 DEFINE_STATIC_LOCAL(EnumerationHistogram, cacheHitHistogram, ("WebFont.C
acheHit", CacheHitEnumMax)); | 269 cacheHitHistogram.count(dataSourceMetricsValue()); |
| 270 cacheHitHistogram.count(dataSourceMetricsValue()); | |
| 271 | 270 |
| 271 if (m_dataSource == FromDiskCache || m_dataSource == FromNetwork) { |
| 272 int duration = static_cast<int>(currentTimeMS() - m_loadStartTime); | 272 int duration = static_cast<int>(currentTimeMS() - m_loadStartTime); |
| 273 recordLoadTimeHistogram(font, duration); | 273 recordLoadTimeHistogram(font, duration); |
| 274 m_loadStartTime = -1; | |
| 275 | 274 |
| 276 enum { CORSFail, CORSSuccess, CORSEnumMax }; | 275 enum { CORSFail, CORSSuccess, CORSEnumMax }; |
| 277 int corsValue = font->isCORSFailed() ? CORSFail : CORSSuccess; | 276 int corsValue = font->isCORSFailed() ? CORSFail : CORSSuccess; |
| 278 DEFINE_STATIC_LOCAL(EnumerationHistogram, corsHistogram, ("WebFont.CORSS
uccess", CORSEnumMax)); | 277 DEFINE_STATIC_LOCAL(EnumerationHistogram, corsHistogram, ("WebFont.CORSS
uccess", CORSEnumMax)); |
| 279 corsHistogram.count(corsValue); | 278 corsHistogram.count(corsValue); |
| 280 } | 279 } |
| 281 } | 280 } |
| 282 | 281 |
| 283 void RemoteFontFaceSource::FontLoadHistograms::recordLoadTimeHistogram(const Fon
tResource* font, int duration) | 282 void RemoteFontFaceSource::FontLoadHistograms::recordLoadTimeHistogram(const Fon
tResource* font, int duration) |
| 284 { | 283 { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 return Miss; | 364 return Miss; |
| 366 case FromUnknown: | 365 case FromUnknown: |
| 367 // Fall through. | 366 // Fall through. |
| 368 default: | 367 default: |
| 369 NOTREACHED(); | 368 NOTREACHED(); |
| 370 } | 369 } |
| 371 return Miss; | 370 return Miss; |
| 372 } | 371 } |
| 373 | 372 |
| 374 } // namespace blink | 373 } // namespace blink |
| OLD | NEW |