OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 SVGFontFaceElement* svgFontFaceElement() const; | 67 SVGFontFaceElement* svgFontFaceElement() const; |
68 void setSVGFontFaceElement(PassRefPtr<SVGFontFaceElement>); | 68 void setSVGFontFaceElement(PassRefPtr<SVGFontFaceElement>); |
69 bool isSVGFontFaceSource() const; | 69 bool isSVGFontFaceSource() const; |
70 void setHasExternalSVGFont(bool value) { m_hasExternalSVGFont = value; } | 70 void setHasExternalSVGFont(bool value) { m_hasExternalSVGFont = value; } |
71 #endif | 71 #endif |
72 | 72 |
73 bool ensureFontData(); | 73 bool ensureFontData(); |
74 bool isLocalFontAvailable(const FontDescription&); | 74 bool isLocalFontAvailable(const FontDescription&); |
75 void beginLoadIfNeeded(); | 75 void beginLoadIfNeeded(); |
76 | 76 |
| 77 // For UMA reporting |
| 78 void paintRequested() { m_histograms.fallbackFontPainted(); } |
| 79 bool hadBlankText() { return m_histograms.hadBlankText(); } |
| 80 |
77 private: | 81 private: |
78 typedef HashMap<unsigned, RefPtr<SimpleFontData> > FontDataTable; // The has
h key is composed of size synthetic styles. | 82 typedef HashMap<unsigned, RefPtr<SimpleFontData> > FontDataTable; // The has
h key is composed of size synthetic styles. |
79 | 83 |
80 class FontLoadHistograms { | 84 class FontLoadHistograms { |
81 public: | 85 public: |
82 FontLoadHistograms() : m_loadStartTime(0) { } | 86 FontLoadHistograms() : m_loadStartTime(0), m_fallbackPaintTime(0) { } |
83 void loadStarted(); | 87 void loadStarted(); |
| 88 void fallbackFontPainted(); |
84 void recordLocalFont(bool loadSuccess); | 89 void recordLocalFont(bool loadSuccess); |
85 void recordRemoteFont(const FontResource*); | 90 void recordRemoteFont(const FontResource*); |
| 91 void recordFallbackTime(const FontResource*); |
| 92 bool hadBlankText() { return m_fallbackPaintTime; } |
86 private: | 93 private: |
87 const char* histogramName(const FontResource*); | 94 const char* histogramName(const FontResource*); |
88 double m_loadStartTime; | 95 double m_loadStartTime; |
| 96 double m_fallbackPaintTime; |
89 }; | 97 }; |
90 | 98 |
91 void pruneTable(); | 99 void pruneTable(); |
92 void startLoadingTimerFired(Timer<CSSFontFaceSource>*); | 100 void startLoadingTimerFired(Timer<CSSFontFaceSource>*); |
93 | 101 |
94 AtomicString m_string; // URI for remote, built-in font name for local. | 102 AtomicString m_string; // URI for remote, built-in font name for local. |
95 ResourcePtr<FontResource> m_font; // For remote fonts, a pointer to our cach
ed resource. | 103 ResourcePtr<FontResource> m_font; // For remote fonts, a pointer to our cach
ed resource. |
96 CSSFontFace* m_face; // Our owning font face. | 104 CSSFontFace* m_face; // Our owning font face. |
97 FontDataTable m_fontDataTable; | 105 FontDataTable m_fontDataTable; |
98 FontLoadHistograms m_histograms; | 106 FontLoadHistograms m_histograms; |
99 | 107 |
100 #if ENABLE(SVG_FONTS) | 108 #if ENABLE(SVG_FONTS) |
101 RefPtr<SVGFontFaceElement> m_svgFontFaceElement; | 109 RefPtr<SVGFontFaceElement> m_svgFontFaceElement; |
102 RefPtr<SVGFontElement> m_externalSVGFontElement; | 110 RefPtr<SVGFontElement> m_externalSVGFontElement; |
103 bool m_hasExternalSVGFont; | 111 bool m_hasExternalSVGFont; |
104 #endif | 112 #endif |
105 }; | 113 }; |
106 | 114 |
107 } | 115 } |
108 | 116 |
109 #endif | 117 #endif |
OLD | NEW |