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 #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 void maySetDataSource(DataSource dataSource) { m_dataSource = (m_dataSou rce != FromUnknown) ? m_dataSource : dataSource; } | 77 // Classify as memory cache hit if |m_loadStartTime| is not set, i.e. |
| 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; } | |
|
kouhei (in TOK)
2016/09/30 01:18:35
Please implement this in .cpp file, not nesting ?:
| |
| 78 private: | 81 private: |
| 79 void recordLoadTimeHistogram(const FontResource*, int duration); | 82 void recordLoadTimeHistogram(const FontResource*, int duration); |
| 80 void recordInterventionResult(bool isTriggered); | 83 void recordInterventionResult(bool isTriggered); |
| 81 CacheHitMetrics dataSourceMetricsValue(); | 84 CacheHitMetrics dataSourceMetricsValue(); |
| 82 double m_loadStartTime; | 85 double m_loadStartTime; |
| 83 double m_blankPaintTime; | 86 double m_blankPaintTime; |
| 84 bool m_isLongLimitExceeded; | 87 bool m_isLongLimitExceeded; |
| 85 DataSource m_dataSource; | 88 DataSource m_dataSource; |
| 86 }; | 89 }; |
| 87 | 90 |
| 88 void switchToSwapPeriod(); | 91 void switchToSwapPeriod(); |
| 89 void switchToFailurePeriod(); | 92 void switchToFailurePeriod(); |
| 90 bool shouldTriggerWebFontsIntervention(); | 93 bool shouldTriggerWebFontsIntervention(); |
| 91 | 94 |
| 92 Member<FontResource> m_font; | 95 Member<FontResource> m_font; |
| 93 Member<CSSFontSelector> m_fontSelector; | 96 Member<CSSFontSelector> m_fontSelector; |
| 94 const FontDisplay m_display; | 97 const FontDisplay m_display; |
| 95 DisplayPeriod m_period; | 98 DisplayPeriod m_period; |
| 96 FontLoadHistograms m_histograms; | 99 FontLoadHistograms m_histograms; |
| 97 bool m_isInterventionTriggered; | 100 bool m_isInterventionTriggered; |
| 98 }; | 101 }; |
| 99 | 102 |
| 100 } // namespace blink | 103 } // namespace blink |
| 101 | 104 |
| 102 #endif | 105 #endif |
| OLD | NEW |