Chromium Code Reviews| 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; | 274 m_loadStartTime = -1; |
|
Kunihiko Sakamoto
2016/09/16 09:03:15
We can remove this line, as this function is calle
Shao-Chuan Lee
2016/09/16 09:23:16
Done.
| |
| 275 | 275 |
| 276 enum { CORSFail, CORSSuccess, CORSEnumMax }; | 276 enum { CORSFail, CORSSuccess, CORSEnumMax }; |
| 277 int corsValue = font->isCORSFailed() ? CORSFail : CORSSuccess; | 277 int corsValue = font->isCORSFailed() ? CORSFail : CORSSuccess; |
| 278 DEFINE_STATIC_LOCAL(EnumerationHistogram, corsHistogram, ("WebFont.CORSS uccess", CORSEnumMax)); | 278 DEFINE_STATIC_LOCAL(EnumerationHistogram, corsHistogram, ("WebFont.CORSS uccess", CORSEnumMax)); |
| 279 corsHistogram.count(corsValue); | 279 corsHistogram.count(corsValue); |
| 280 } | 280 } |
| 281 } | 281 } |
| 282 | 282 |
| 283 void RemoteFontFaceSource::FontLoadHistograms::recordLoadTimeHistogram(const Fon tResource* font, int duration) | 283 void RemoteFontFaceSource::FontLoadHistograms::recordLoadTimeHistogram(const Fon tResource* font, int duration) |
| 284 { | 284 { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 return Miss; | 365 return Miss; |
| 366 case FromUnknown: | 366 case FromUnknown: |
| 367 // Fall through. | 367 // Fall through. |
| 368 default: | 368 default: |
| 369 NOTREACHED(); | 369 NOTREACHED(); |
| 370 } | 370 } |
| 371 return Miss; | 371 return Miss; |
| 372 } | 372 } |
| 373 | 373 |
| 374 } // namespace blink | 374 } // namespace blink |
| OLD | NEW |