| 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 #ifndef RemoteFontFaceSource_h | 5 #ifndef RemoteFontFaceSource_h |
| 6 #define RemoteFontFaceSource_h | 6 #define RemoteFontFaceSource_h |
| 7 | 7 |
| 8 #include "core/css/CSSFontFaceSource.h" | 8 #include "core/css/CSSFontFaceSource.h" |
| 9 #include "core/fetch/FontResource.h" | 9 #include "core/fetch/FontResource.h" |
| 10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // metrics values. | 69 // metrics values. |
| 70 enum CacheHitMetrics { Miss, DiskHit, DataUrl, MemoryHit, CacheHitEnumMax }; | 70 enum CacheHitMetrics { Miss, DiskHit, DataUrl, MemoryHit, CacheHitEnumMax }; |
| 71 enum DataSource { | 71 enum DataSource { |
| 72 FromUnknown, | 72 FromUnknown, |
| 73 FromDataURL, | 73 FromDataURL, |
| 74 FromMemoryCache, | 74 FromMemoryCache, |
| 75 FromDiskCache, | 75 FromDiskCache, |
| 76 FromNetwork | 76 FromNetwork |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 FontLoadHistograms(DataSource dataSource) | 79 FontLoadHistograms(DataSource dataSource, FontDisplay fontDisplay) |
| 80 : m_loadStartTime(0), | 80 : m_loadStartTime(0), |
| 81 m_blankPaintTime(0), | 81 m_blankPaintTime(0), |
| 82 m_isLongLimitExceeded(false), | 82 m_isLongLimitExceeded(false), |
| 83 m_dataSource(dataSource) {} | 83 m_dataSource(dataSource), |
| 84 m_fontDisplay(fontDisplay) {} |
| 84 void loadStarted(); | 85 void loadStarted(); |
| 85 void fallbackFontPainted(DisplayPeriod); | 86 void fallbackFontPainted(DisplayPeriod); |
| 86 void fontLoaded(bool isInterventionTriggered); | 87 void fontLoaded(bool isCorsFailed, |
| 87 void longLimitExceeded(bool isInterventionTriggered); | 88 bool loadError, |
| 89 bool isInterventionTriggered); |
| 90 void longLimitExceeded(bool isCorsFailed, |
| 91 bool loadError, |
| 92 bool isInterventionTriggered); |
| 88 void recordFallbackTime(const FontResource*); | 93 void recordFallbackTime(const FontResource*); |
| 89 void recordRemoteFont(const FontResource*); | 94 void recordRemoteFont(const FontResource*); |
| 90 bool hadBlankText() { return m_blankPaintTime; } | 95 bool hadBlankText() { return m_blankPaintTime; } |
| 91 DataSource dataSource() { return m_dataSource; } | 96 DataSource dataSource() { return m_dataSource; } |
| 92 void maySetDataSource(DataSource); | 97 void maySetDataSource(DataSource); |
| 93 | 98 |
| 94 private: | 99 private: |
| 95 void recordLoadTimeHistogram(const FontResource*, int duration); | 100 void recordLoadTimeHistogram(const FontResource*, int duration); |
| 96 void recordInterventionResult(bool isTriggered); | 101 void recordInterventionResult(bool isCorsFailed, |
| 102 bool loadError, |
| 103 bool isTriggered); |
| 97 CacheHitMetrics dataSourceMetricsValue(); | 104 CacheHitMetrics dataSourceMetricsValue(); |
| 98 double m_loadStartTime; | 105 double m_loadStartTime; |
| 99 double m_blankPaintTime; | 106 double m_blankPaintTime; |
| 100 bool m_isLongLimitExceeded; | 107 bool m_isLongLimitExceeded; |
| 101 DataSource m_dataSource; | 108 DataSource m_dataSource; |
| 109 FontDisplay m_fontDisplay; |
| 102 }; | 110 }; |
| 103 | 111 |
| 104 void switchToSwapPeriod(); | 112 void switchToSwapPeriod(); |
| 105 void switchToFailurePeriod(); | 113 void switchToFailurePeriod(); |
| 106 bool shouldTriggerWebFontsIntervention(); | 114 bool shouldTriggerWebFontsIntervention(); |
| 107 | 115 |
| 108 Member<FontResource> m_font; | 116 Member<FontResource> m_font; |
| 109 Member<CSSFontSelector> m_fontSelector; | 117 Member<CSSFontSelector> m_fontSelector; |
| 110 const FontDisplay m_display; | 118 const FontDisplay m_display; |
| 111 DisplayPeriod m_period; | 119 DisplayPeriod m_period; |
| 112 FontLoadHistograms m_histograms; | 120 FontLoadHistograms m_histograms; |
| 113 bool m_isInterventionTriggered; | 121 bool m_isInterventionTriggered; |
| 114 }; | 122 }; |
| 115 | 123 |
| 116 } // namespace blink | 124 } // namespace blink |
| 117 | 125 |
| 118 #endif | 126 #endif |
| OLD | NEW |