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 "core/fetch/ResourcePtr.h" | 10 #include "core/fetch/ResourcePtr.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 void beginLoadIfNeeded() OVERRIDE; | 26 void beginLoadIfNeeded() OVERRIDE; |
27 virtual bool ensureFontData(); | 27 virtual bool ensureFontData(); |
28 | 28 |
29 #if ENABLE(SVG_FONTS) | 29 #if ENABLE(SVG_FONTS) |
30 virtual bool isSVGFontFaceSource() const { return false; } | 30 virtual bool isSVGFontFaceSource() const { return false; } |
31 #endif | 31 #endif |
32 | 32 |
33 virtual void didStartFontLoad(FontResource*) OVERRIDE; | 33 virtual void didStartFontLoad(FontResource*) OVERRIDE; |
34 virtual void fontLoaded(FontResource*) OVERRIDE; | 34 virtual void fontLoaded(FontResource*) OVERRIDE; |
35 virtual void fontLoadWaitLimitExceeded(FontResource*) OVERRIDE; | 35 virtual void fontLoadWaitLimitExceeded(FontResource*) OVERRIDE; |
36 virtual void corsFailed(FontResource*) OVERRIDE; | |
37 | 36 |
38 // For UMA reporting | 37 // For UMA reporting |
39 virtual bool hadBlankText() OVERRIDE { return m_histograms.hadBlankText(); } | 38 virtual bool hadBlankText() OVERRIDE { return m_histograms.hadBlankText(); } |
40 void paintRequested() { m_histograms.fallbackFontPainted(); } | 39 void paintRequested() { m_histograms.fallbackFontPainted(); } |
41 | 40 |
42 virtual void trace(Visitor*) OVERRIDE; | 41 virtual void trace(Visitor*) OVERRIDE; |
43 | 42 |
44 protected: | 43 protected: |
45 virtual PassRefPtr<SimpleFontData> createFontData(const FontDescription&) OV
ERRIDE; | 44 virtual PassRefPtr<SimpleFontData> createFontData(const FontDescription&) OV
ERRIDE; |
46 PassRefPtr<SimpleFontData> createLoadingFallbackFontData(const FontDescripti
on&); | 45 PassRefPtr<SimpleFontData> createLoadingFallbackFontData(const FontDescripti
on&); |
47 void pruneTable(); | 46 void pruneTable(); |
48 | 47 |
49 private: | 48 private: |
50 class FontLoadHistograms { | 49 class FontLoadHistograms { |
51 public: | 50 public: |
52 FontLoadHistograms() : m_loadStartTime(0), m_fallbackPaintTime(0), m_cor
sFailed(false) { } | 51 FontLoadHistograms() : m_loadStartTime(0), m_fallbackPaintTime(0) { } |
53 void loadStarted(); | 52 void loadStarted(); |
54 void fallbackFontPainted(); | 53 void fallbackFontPainted(); |
55 void recordRemoteFont(const FontResource*); | 54 void recordRemoteFont(const FontResource*); |
56 void recordFallbackTime(const FontResource*); | 55 void recordFallbackTime(const FontResource*); |
57 void corsFailed() { m_corsFailed = true; } | |
58 bool hadBlankText() { return m_fallbackPaintTime; } | 56 bool hadBlankText() { return m_fallbackPaintTime; } |
59 private: | 57 private: |
60 const char* histogramName(const FontResource*); | 58 const char* histogramName(const FontResource*); |
61 double m_loadStartTime; | 59 double m_loadStartTime; |
62 double m_fallbackPaintTime; | 60 double m_fallbackPaintTime; |
63 bool m_corsFailed; | |
64 }; | 61 }; |
65 | 62 |
66 ResourcePtr<FontResource> m_font; | 63 ResourcePtr<FontResource> m_font; |
67 RefPtrWillBeMember<FontLoader> m_fontLoader; | 64 RefPtrWillBeMember<FontLoader> m_fontLoader; |
68 FontLoadHistograms m_histograms; | 65 FontLoadHistograms m_histograms; |
69 }; | 66 }; |
70 | 67 |
71 } // namespace WebCore | 68 } // namespace WebCore |
72 | 69 |
73 #endif | 70 #endif |
OLD | NEW |