| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are met: | 5 * modification, are permitted provided that the following conditions are met: |
| 6 * | 6 * |
| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 private: | 104 private: |
| 105 typedef RefCountedSupplement<Document, FontFaceSet> SupplementType; | 105 typedef RefCountedSupplement<Document, FontFaceSet> SupplementType; |
| 106 | 106 |
| 107 static PassRefPtr<FontFaceSet> create(Document& document) | 107 static PassRefPtr<FontFaceSet> create(Document& document) |
| 108 { | 108 { |
| 109 return adoptRef<FontFaceSet>(new FontFaceSet(document)); | 109 return adoptRef<FontFaceSet>(new FontFaceSet(document)); |
| 110 } | 110 } |
| 111 | 111 |
| 112 class FontLoadHistogram { | 112 class FontLoadHistogram { |
| 113 public: | 113 public: |
| 114 FontLoadHistogram() : m_count(0), m_recorded(false) { } | 114 enum Status { NoWebFonts, HadBlankText, DidNotHaveBlankText, Reported }; |
| 115 FontLoadHistogram() : m_status(NoWebFonts), m_count(0), m_recorded(false
) { } |
| 115 void incrementCount() { m_count++; } | 116 void incrementCount() { m_count++; } |
| 117 void updateStatus(FontFace*); |
| 116 void record(); | 118 void record(); |
| 117 | 119 |
| 118 private: | 120 private: |
| 121 Status m_status; |
| 119 int m_count; | 122 int m_count; |
| 120 bool m_recorded; | 123 bool m_recorded; |
| 121 }; | 124 }; |
| 122 | 125 |
| 123 FontFaceSet(Document&); | 126 FontFaceSet(Document&); |
| 124 | 127 |
| 125 bool hasLoadedFonts() const { return !m_loadedFonts.isEmpty() || !m_failedFo
nts.isEmpty(); } | 128 bool hasLoadedFonts() const { return !m_loadedFonts.isEmpty() || !m_failedFo
nts.isEmpty(); } |
| 126 | 129 |
| 127 bool inActiveDocumentContext() const; | 130 bool inActiveDocumentContext() const; |
| 128 void forEachInternal(PassOwnPtr<FontFaceSetForEachCallback>, ScriptValue* th
isArg) const; | 131 void forEachInternal(PassOwnPtr<FontFaceSetForEachCallback>, ScriptValue* th
isArg) const; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 144 ListHashSet<RefPtr<FontFace> > m_nonCSSConnectedFaces; | 147 ListHashSet<RefPtr<FontFace> > m_nonCSSConnectedFaces; |
| 145 | 148 |
| 146 AsyncMethodRunner<FontFaceSet> m_asyncRunner; | 149 AsyncMethodRunner<FontFaceSet> m_asyncRunner; |
| 147 | 150 |
| 148 FontLoadHistogram m_histogram; | 151 FontLoadHistogram m_histogram; |
| 149 }; | 152 }; |
| 150 | 153 |
| 151 } // namespace WebCore | 154 } // namespace WebCore |
| 152 | 155 |
| 153 #endif // FontFaceSet_h | 156 #endif // FontFaceSet_h |
| OLD | NEW |