| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 FromNetwork | 76 FromNetwork |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 FontLoadHistograms(DataSource dataSource) | 79 FontLoadHistograms(DataSource dataSource) |
| 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 void loadStarted(); | 84 void loadStarted(); |
| 85 void fallbackFontPainted(DisplayPeriod); | 85 void fallbackFontPainted(DisplayPeriod); |
| 86 void fontLoaded(bool isInterventionTriggered); | 86 void fontLoaded(const FontResource*, |
| 87 void longLimitExceeded(bool isInterventionTriggered); | 87 const FontDisplay, |
| 88 bool isInterventionTriggered); |
| 89 void longLimitExceeded(const FontResource*, |
| 90 const FontDisplay, |
| 91 bool isInterventionTriggered); |
| 88 void recordFallbackTime(const FontResource*); | 92 void recordFallbackTime(const FontResource*); |
| 89 void recordRemoteFont(const FontResource*); | 93 void recordRemoteFont(const FontResource*); |
| 90 bool hadBlankText() { return m_blankPaintTime; } | 94 bool hadBlankText() { return m_blankPaintTime; } |
| 91 DataSource dataSource() { return m_dataSource; } | 95 DataSource dataSource() { return m_dataSource; } |
| 92 void maySetDataSource(DataSource); | 96 void maySetDataSource(DataSource); |
| 93 | 97 |
| 94 private: | 98 private: |
| 95 void recordLoadTimeHistogram(const FontResource*, int duration); | 99 void recordLoadTimeHistogram(const FontResource*, int duration); |
| 96 void recordInterventionResult(bool isTriggered); | 100 void recordInterventionResult(const FontResource*, |
| 101 const FontDisplay, |
| 102 bool isTriggered); |
| 97 CacheHitMetrics dataSourceMetricsValue(); | 103 CacheHitMetrics dataSourceMetricsValue(); |
| 98 double m_loadStartTime; | 104 double m_loadStartTime; |
| 99 double m_blankPaintTime; | 105 double m_blankPaintTime; |
| 100 bool m_isLongLimitExceeded; | 106 bool m_isLongLimitExceeded; |
| 101 DataSource m_dataSource; | 107 DataSource m_dataSource; |
| 102 }; | 108 }; |
| 103 | 109 |
| 104 void switchToSwapPeriod(); | 110 void switchToSwapPeriod(); |
| 105 void switchToFailurePeriod(); | 111 void switchToFailurePeriod(); |
| 106 bool shouldTriggerWebFontsIntervention(); | 112 bool shouldTriggerWebFontsIntervention(); |
| 107 | 113 |
| 108 Member<FontResource> m_font; | 114 Member<FontResource> m_font; |
| 109 Member<CSSFontSelector> m_fontSelector; | 115 Member<CSSFontSelector> m_fontSelector; |
| 110 const FontDisplay m_display; | 116 const FontDisplay m_display; |
| 111 DisplayPeriod m_period; | 117 DisplayPeriod m_period; |
| 112 FontLoadHistograms m_histograms; | 118 FontLoadHistograms m_histograms; |
| 113 bool m_isInterventionTriggered; | 119 bool m_isInterventionTriggered; |
| 114 }; | 120 }; |
| 115 | 121 |
| 116 } // namespace blink | 122 } // namespace blink |
| 117 | 123 |
| 118 #endif | 124 #endif |
| OLD | NEW |