| 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/FontLoader.h" | 9 #include "core/css/FontLoader.h" |
| 10 #include "core/page/NetworkStateNotifier.h" | 10 #include "core/page/NetworkStateNotifier.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 visitor->trace(m_fontLoader); | 192 visitor->trace(m_fontLoader); |
| 193 CSSFontFaceSource::trace(visitor); | 193 CSSFontFaceSource::trace(visitor); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void RemoteFontFaceSource::FontLoadHistograms::loadStarted() | 196 void RemoteFontFaceSource::FontLoadHistograms::loadStarted() |
| 197 { | 197 { |
| 198 if (!m_loadStartTime) | 198 if (!m_loadStartTime) |
| 199 m_loadStartTime = currentTimeMS(); | 199 m_loadStartTime = currentTimeMS(); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void RemoteFontFaceSource::FontLoadHistograms::fallbackFontPainted() | 202 void RemoteFontFaceSource::FontLoadHistograms::fallbackFontPainted(DisplayPeriod
period) |
| 203 { | 203 { |
| 204 if (!m_fallbackPaintTime) | 204 if (period == BlockPeriod && !m_blankPaintTime) |
| 205 m_fallbackPaintTime = currentTimeMS(); | 205 m_blankPaintTime = currentTimeMS(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void RemoteFontFaceSource::FontLoadHistograms::fontLoaded(bool isInterventionTri
ggered) | 208 void RemoteFontFaceSource::FontLoadHistograms::fontLoaded(bool isInterventionTri
ggered) |
| 209 { | 209 { |
| 210 if (!m_isLongLimitExceeded) | 210 if (!m_isLongLimitExceeded) |
| 211 recordInterventionResult(isInterventionTriggered); | 211 recordInterventionResult(isInterventionTriggered); |
| 212 } | 212 } |
| 213 | 213 |
| 214 void RemoteFontFaceSource::FontLoadHistograms::longLimitExceeded(bool isInterven
tionTriggered) | 214 void RemoteFontFaceSource::FontLoadHistograms::longLimitExceeded(bool isInterven
tionTriggered) |
| 215 { | 215 { |
| 216 m_isLongLimitExceeded = true; | 216 m_isLongLimitExceeded = true; |
| 217 recordInterventionResult(isInterventionTriggered); | 217 recordInterventionResult(isInterventionTriggered); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void RemoteFontFaceSource::FontLoadHistograms::recordFallbackTime(const FontReso
urce* font) | 220 void RemoteFontFaceSource::FontLoadHistograms::recordFallbackTime(const FontReso
urce* font) |
| 221 { | 221 { |
| 222 if (m_fallbackPaintTime <= 0) | 222 if (m_blankPaintTime <= 0) |
| 223 return; | 223 return; |
| 224 int duration = static_cast<int>(currentTimeMS() - m_fallbackPaintTime); | 224 int duration = static_cast<int>(currentTimeMS() - m_blankPaintTime); |
| 225 DEFINE_STATIC_LOCAL(CustomCountHistogram, blankTextShownTimeHistogram, ("Web
Font.BlankTextShownTime", 0, 10000, 50)); | 225 DEFINE_STATIC_LOCAL(CustomCountHistogram, blankTextShownTimeHistogram, ("Web
Font.BlankTextShownTime", 0, 10000, 50)); |
| 226 blankTextShownTimeHistogram.count(duration); | 226 blankTextShownTimeHistogram.count(duration); |
| 227 m_fallbackPaintTime = -1; | 227 m_blankPaintTime = -1; |
| 228 } | 228 } |
| 229 | 229 |
| 230 void RemoteFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResour
ce* font) | 230 void RemoteFontFaceSource::FontLoadHistograms::recordRemoteFont(const FontResour
ce* font) |
| 231 { | 231 { |
| 232 if (m_loadStartTime > 0 && font && !font->isLoading()) { | 232 if (m_loadStartTime > 0 && font && !font->isLoading()) { |
| 233 int duration = static_cast<int>(currentTimeMS() - m_loadStartTime); | 233 int duration = static_cast<int>(currentTimeMS() - m_loadStartTime); |
| 234 recordLoadTimeHistogram(font, duration); | 234 recordLoadTimeHistogram(font, duration); |
| 235 m_loadStartTime = -1; | 235 m_loadStartTime = -1; |
| 236 | 236 |
| 237 enum { Miss, Hit, DataUrl, CacheHitEnumMax }; | 237 enum { Miss, Hit, DataUrl, CacheHitEnumMax }; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 interventionResult |= 1 << 0; | 291 interventionResult |= 1 << 0; |
| 292 if (triggered) | 292 if (triggered) |
| 293 interventionResult |= 1 << 1; | 293 interventionResult |= 1 << 1; |
| 294 const int boundary = 1 << 2; | 294 const int boundary = 1 << 2; |
| 295 | 295 |
| 296 DEFINE_STATIC_LOCAL(EnumerationHistogram, interventionHistogram, ("WebFont.I
nterventionResult", boundary)); | 296 DEFINE_STATIC_LOCAL(EnumerationHistogram, interventionHistogram, ("WebFont.I
nterventionResult", boundary)); |
| 297 interventionHistogram.count(interventionResult); | 297 interventionHistogram.count(interventionResult); |
| 298 } | 298 } |
| 299 | 299 |
| 300 } // namespace blink | 300 } // namespace blink |
| OLD | NEW |