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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 | 54 |
55 protected: | 55 protected: |
56 PassRefPtr<SimpleFontData> createFontData(const FontDescription&) override; | 56 PassRefPtr<SimpleFontData> createFontData(const FontDescription&) override; |
57 PassRefPtr<SimpleFontData> createLoadingFallbackFontData(const FontDescripti on&); | 57 PassRefPtr<SimpleFontData> createLoadingFallbackFontData(const FontDescripti on&); |
58 void pruneTable(); | 58 void pruneTable(); |
59 | 59 |
60 private: | 60 private: |
61 class FontLoadHistograms { | 61 class FontLoadHistograms { |
62 DISALLOW_NEW(); | 62 DISALLOW_NEW(); |
63 public: | 63 public: |
64 FontLoadHistograms() : m_loadStartTime(0), m_blankPaintTime(0), m_isLong LimitExceeded(false) { } | 64 // Should not change following order in CacheHitMetrics to be used for m etrics values. |
65 enum CacheHitMetrics { Miss, DiskHit, DataUrl, MemoryHit, CacheHitEnumMa x }; | |
66 enum DataSource { FromUnknown, FromDataURL, FromMemoryCache, FromDiskCac he, FromNetwork }; | |
67 | |
68 FontLoadHistograms(DataSource) : m_loadStartTime(0), m_blankPaintTime(0) , m_isLongLimitExceeded(false) { } | |
Kunihiko Sakamoto
2016/09/07 16:25:42
m_dataSource isn't initialized?
Takashi Toyoshima
2016/09/09 06:25:24
oops, that's right.
| |
65 void loadStarted(); | 69 void loadStarted(); |
66 void fallbackFontPainted(DisplayPeriod); | 70 void fallbackFontPainted(DisplayPeriod); |
67 void fontLoaded(bool isInterventionTriggered, bool isLoadedFromNetwork); | 71 void fontLoaded(bool isInterventionTriggered); |
68 void longLimitExceeded(bool isInterventionTriggered); | 72 void longLimitExceeded(bool isInterventionTriggered); |
69 void recordFallbackTime(const FontResource*); | 73 void recordFallbackTime(const FontResource*); |
70 void recordRemoteFont(const FontResource*, bool isLoadedFromMemoryCache) ; | 74 void recordRemoteFont(const FontResource*); |
71 bool hadBlankText() { return m_blankPaintTime; } | 75 bool hadBlankText() { return m_blankPaintTime; } |
76 DataSource dataSource() { return m_dataSource; } | |
77 void maySetDataSource(DataSource dataSource) { m_dataSource = (m_dataSou rce != FromUnknown) ? m_dataSource : dataSource; } | |
72 private: | 78 private: |
73 void recordLoadTimeHistogram(const FontResource*, int duration); | 79 void recordLoadTimeHistogram(const FontResource*, int duration); |
74 void recordInterventionResult(bool isTriggered, bool isLoadedFromNetwork ); | 80 void recordInterventionResult(bool isTriggered); |
81 CacheHitMetrics dataSourceMetricsValue(); | |
75 double m_loadStartTime; | 82 double m_loadStartTime; |
76 double m_blankPaintTime; | 83 double m_blankPaintTime; |
77 bool m_isLongLimitExceeded; | 84 bool m_isLongLimitExceeded; |
85 DataSource m_dataSource; | |
78 }; | 86 }; |
79 | 87 |
80 void switchToSwapPeriod(); | 88 void switchToSwapPeriod(); |
81 void switchToFailurePeriod(); | 89 void switchToFailurePeriod(); |
90 bool shouldTriggerWebFontsIntervention(); | |
82 | 91 |
83 Member<FontResource> m_font; | 92 Member<FontResource> m_font; |
84 Member<CSSFontSelector> m_fontSelector; | 93 Member<CSSFontSelector> m_fontSelector; |
85 const FontDisplay m_display; | 94 const FontDisplay m_display; |
86 DisplayPeriod m_period; | 95 DisplayPeriod m_period; |
87 FontLoadHistograms m_histograms; | 96 FontLoadHistograms m_histograms; |
88 bool m_isInterventionTriggered; | 97 bool m_isInterventionTriggered; |
89 bool m_isLoadedFromMemoryCache; | |
90 }; | 98 }; |
91 | 99 |
92 } // namespace blink | 100 } // namespace blink |
93 | 101 |
94 #endif | 102 #endif |
OLD | NEW |