| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 FontLoadHistograms(DataSource dataSource) : m_loadStartTime(0), m_blankP
aintTime(0), m_isLongLimitExceeded(false), m_dataSource(dataSource) { } | 68 FontLoadHistograms(DataSource dataSource) : m_loadStartTime(0), m_blankP
aintTime(0), m_isLongLimitExceeded(false), m_dataSource(dataSource) { } |
| 69 void loadStarted(); | 69 void loadStarted(); |
| 70 void fallbackFontPainted(DisplayPeriod); | 70 void fallbackFontPainted(DisplayPeriod); |
| 71 void fontLoaded(bool isInterventionTriggered); | 71 void fontLoaded(bool isInterventionTriggered); |
| 72 void longLimitExceeded(bool isInterventionTriggered); | 72 void longLimitExceeded(bool isInterventionTriggered); |
| 73 void recordFallbackTime(const FontResource*); | 73 void recordFallbackTime(const FontResource*); |
| 74 void recordRemoteFont(const FontResource*); | 74 void recordRemoteFont(const FontResource*); |
| 75 bool hadBlankText() { return m_blankPaintTime; } | 75 bool hadBlankText() { return m_blankPaintTime; } |
| 76 DataSource dataSource() { return m_dataSource; } | 76 DataSource dataSource() { return m_dataSource; } |
| 77 // Classify as memory cache hit if |m_loadStartTime| is not set, i.e. | 77 void maySetDataSource(DataSource); |
| 78 // this RemoteFontFaceSource instance didn't trigger FontResource | |
| 79 // loading. | |
| 80 void maySetDataSource(DataSource dataSource) { m_dataSource = (m_dataSou
rce != FromUnknown) ? m_dataSource : (m_loadStartTime == 0) ? FromMemoryCache :
dataSource; } | |
| 81 private: | 78 private: |
| 82 void recordLoadTimeHistogram(const FontResource*, int duration); | 79 void recordLoadTimeHistogram(const FontResource*, int duration); |
| 83 void recordInterventionResult(bool isTriggered); | 80 void recordInterventionResult(bool isTriggered); |
| 84 CacheHitMetrics dataSourceMetricsValue(); | 81 CacheHitMetrics dataSourceMetricsValue(); |
| 85 double m_loadStartTime; | 82 double m_loadStartTime; |
| 86 double m_blankPaintTime; | 83 double m_blankPaintTime; |
| 87 bool m_isLongLimitExceeded; | 84 bool m_isLongLimitExceeded; |
| 88 DataSource m_dataSource; | 85 DataSource m_dataSource; |
| 89 }; | 86 }; |
| 90 | 87 |
| 91 void switchToSwapPeriod(); | 88 void switchToSwapPeriod(); |
| 92 void switchToFailurePeriod(); | 89 void switchToFailurePeriod(); |
| 93 bool shouldTriggerWebFontsIntervention(); | 90 bool shouldTriggerWebFontsIntervention(); |
| 94 | 91 |
| 95 Member<FontResource> m_font; | 92 Member<FontResource> m_font; |
| 96 Member<CSSFontSelector> m_fontSelector; | 93 Member<CSSFontSelector> m_fontSelector; |
| 97 const FontDisplay m_display; | 94 const FontDisplay m_display; |
| 98 DisplayPeriod m_period; | 95 DisplayPeriod m_period; |
| 99 FontLoadHistograms m_histograms; | 96 FontLoadHistograms m_histograms; |
| 100 bool m_isInterventionTriggered; | 97 bool m_isInterventionTriggered; |
| 101 }; | 98 }; |
| 102 | 99 |
| 103 } // namespace blink | 100 } // namespace blink |
| 104 | 101 |
| 105 #endif | 102 #endif |
| OLD | NEW |