Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: third_party/WebKit/Source/core/css/RemoteFontFaceSource.h

Issue 2431503002: Log web fonts intervention result more accurately (Closed)
Patch Set: Addressed comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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,
88 bool loadError,
89 bool isInterventionTriggered);
87 void longLimitExceeded(bool isInterventionTriggered); 90 void longLimitExceeded(bool isInterventionTriggered);
88 void recordFallbackTime(const FontResource*); 91 void recordFallbackTime(const FontResource*);
89 void recordRemoteFont(const FontResource*); 92 void recordRemoteFont(const FontResource*);
90 bool hadBlankText() { return m_blankPaintTime; } 93 bool hadBlankText() { return m_blankPaintTime; }
91 DataSource dataSource() { return m_dataSource; } 94 DataSource dataSource() { return m_dataSource; }
92 void maySetDataSource(DataSource); 95 void maySetDataSource(DataSource);
93 96
94 private: 97 private:
95 void recordLoadTimeHistogram(const FontResource*, int duration); 98 void recordLoadTimeHistogram(const FontResource*, int duration);
96 void recordInterventionResult(bool isTriggered); 99 void recordInterventionResult(bool isTriggered);
97 CacheHitMetrics dataSourceMetricsValue(); 100 CacheHitMetrics dataSourceMetricsValue();
98 double m_loadStartTime; 101 double m_loadStartTime;
99 double m_blankPaintTime; 102 double m_blankPaintTime;
100 bool m_isLongLimitExceeded; 103 bool m_isLongLimitExceeded;
101 DataSource m_dataSource; 104 DataSource m_dataSource;
105 FontDisplay m_fontDisplay;
102 }; 106 };
103 107
104 void switchToSwapPeriod(); 108 void switchToSwapPeriod();
105 void switchToFailurePeriod(); 109 void switchToFailurePeriod();
106 bool shouldTriggerWebFontsIntervention(); 110 bool shouldTriggerWebFontsIntervention();
107 111
108 Member<FontResource> m_font; 112 Member<FontResource> m_font;
109 Member<CSSFontSelector> m_fontSelector; 113 Member<CSSFontSelector> m_fontSelector;
110 const FontDisplay m_display; 114 const FontDisplay m_display;
111 DisplayPeriod m_period; 115 DisplayPeriod m_period;
112 FontLoadHistograms m_histograms; 116 FontLoadHistograms m_histograms;
113 bool m_isInterventionTriggered; 117 bool m_isInterventionTriggered;
114 }; 118 };
115 119
116 } // namespace blink 120 } // namespace blink
117 121
118 #endif 122 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698