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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 /* 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 class CSSFontFace; 51 class CSSFontFace;
52 class CSSFontFaceSource; 52 class CSSFontFaceSource;
53 class CSSFontSelector; 53 class CSSFontSelector;
54 class Dictionary; 54 class Dictionary;
55 class ExceptionState; 55 class ExceptionState;
56 class Font; 56 class Font;
57 class FontFaceCache; 57 class FontFaceCache;
58 class FontResource; 58 class FontResource;
59 class ExecutionContext; 59 class ExecutionContext;
60 60
61 using FontFaceSetIterable = PairIterable<RefPtrWillBeMember<FontFace>, RefPtrWil lBeMember<FontFace>>; 61 using FontFaceSetIterable = PairIterable<Member<FontFace>, Member<FontFace>>;
62 62
63 #if ENABLE(OILPAN) 63 #if ENABLE(OILPAN)
64 class FontFaceSet final : public EventTargetWithInlineData, public HeapSupplemen t<Document>, public ActiveDOMObject, public FontFaceSetIterable { 64 class FontFaceSet final : public EventTargetWithInlineData, public HeapSupplemen t<Document>, public ActiveDOMObject, public FontFaceSetIterable {
65 USING_GARBAGE_COLLECTED_MIXIN(FontFaceSet); 65 USING_GARBAGE_COLLECTED_MIXIN(FontFaceSet);
66 using SupplementType = HeapSupplement<Document>; 66 using SupplementType = HeapSupplement<Document>;
67 #else 67 #else
68 class FontFaceSet final : public EventTargetWithInlineData, public RefCountedSup plement<Document, FontFaceSet>, public ActiveDOMObject, public FontFaceSetIterab le { 68 class FontFaceSet final : public EventTargetWithInlineData, public RefCountedSup plement<Document, FontFaceSet>, public ActiveDOMObject, public FontFaceSetIterab le {
69 REFCOUNTED_EVENT_TARGET(FontFaceSet); 69 REFCOUNTED_EVENT_TARGET(FontFaceSet);
70 using SupplementType = RefCountedSupplement<Document, FontFaceSet>; 70 using SupplementType = RefCountedSupplement<Document, FontFaceSet>;
71 #endif 71 #endif
72 DEFINE_WRAPPERTYPEINFO(); 72 DEFINE_WRAPPERTYPEINFO();
73 public: 73 public:
74 ~FontFaceSet() override; 74 ~FontFaceSet() override;
75 75
76 DEFINE_ATTRIBUTE_EVENT_LISTENER(loading); 76 DEFINE_ATTRIBUTE_EVENT_LISTENER(loading);
77 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingdone); 77 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingdone);
78 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingerror); 78 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingerror);
79 79
80 bool check(const String& font, const String& text, ExceptionState&); 80 bool check(const String& font, const String& text, ExceptionState&);
81 ScriptPromise load(ScriptState*, const String& font, const String& text); 81 ScriptPromise load(ScriptState*, const String& font, const String& text);
82 ScriptPromise ready(ScriptState*); 82 ScriptPromise ready(ScriptState*);
83 83
84 PassRefPtrWillBeRawPtr<FontFaceSet> addForBinding(ScriptState*, FontFace*, E xceptionState&); 84 RawPtr<FontFaceSet> addForBinding(ScriptState*, FontFace*, ExceptionState&);
85 void clearForBinding(ScriptState*, ExceptionState&); 85 void clearForBinding(ScriptState*, ExceptionState&);
86 bool deleteForBinding(ScriptState*, FontFace*, ExceptionState&); 86 bool deleteForBinding(ScriptState*, FontFace*, ExceptionState&);
87 bool hasForBinding(ScriptState*, FontFace*, ExceptionState&) const; 87 bool hasForBinding(ScriptState*, FontFace*, ExceptionState&) const;
88 88
89 size_t size() const; 89 size_t size() const;
90 AtomicString status() const; 90 AtomicString status() const;
91 91
92 ExecutionContext* executionContext() const override; 92 ExecutionContext* executionContext() const override;
93 const AtomicString& interfaceName() const override; 93 const AtomicString& interfaceName() const override;
94 94
95 Document* document() const; 95 Document* document() const;
96 96
97 void didLayout(); 97 void didLayout();
98 void beginFontLoading(FontFace*); 98 void beginFontLoading(FontFace*);
99 void fontLoaded(FontFace*); 99 void fontLoaded(FontFace*);
100 void loadError(FontFace*); 100 void loadError(FontFace*);
101 101
102 // ActiveDOMObject 102 // ActiveDOMObject
103 void suspend() override; 103 void suspend() override;
104 void resume() override; 104 void resume() override;
105 void stop() override; 105 void stop() override;
106 106
107 static PassRefPtrWillBeRawPtr<FontFaceSet> from(Document&); 107 static RawPtr<FontFaceSet> from(Document&);
108 static void didLayout(Document&); 108 static void didLayout(Document&);
109 109
110 void addFontFacesToFontFaceCache(FontFaceCache*, CSSFontSelector*); 110 void addFontFacesToFontFaceCache(FontFaceCache*, CSSFontSelector*);
111 111
112 DECLARE_VIRTUAL_TRACE(); 112 DECLARE_VIRTUAL_TRACE();
113 113
114 private: 114 private:
115 static PassRefPtrWillBeRawPtr<FontFaceSet> create(Document& document) 115 static RawPtr<FontFaceSet> create(Document& document)
116 { 116 {
117 return adoptRefWillBeNoop(new FontFaceSet(document)); 117 return (new FontFaceSet(document));
118 } 118 }
119 119
120 FontFaceSetIterable::IterationSource* startIteration(ScriptState*, Exception State&) override; 120 FontFaceSetIterable::IterationSource* startIteration(ScriptState*, Exception State&) override;
121 121
122 class IterationSource final : public FontFaceSetIterable::IterationSource { 122 class IterationSource final : public FontFaceSetIterable::IterationSource {
123 public: 123 public:
124 explicit IterationSource(const WillBeHeapVector<RefPtrWillBeMember<FontF ace>>& fontFaces) 124 explicit IterationSource(const HeapVector<Member<FontFace>>& fontFaces)
125 : m_index(0) 125 : m_index(0)
126 , m_fontFaces(fontFaces) { } 126 , m_fontFaces(fontFaces) { }
127 bool next(ScriptState*, RefPtrWillBeMember<FontFace>&, RefPtrWillBeMembe r<FontFace>&, ExceptionState&) override; 127 bool next(ScriptState*, Member<FontFace>&, Member<FontFace>&, ExceptionS tate&) override;
128 128
129 DEFINE_INLINE_VIRTUAL_TRACE() 129 DEFINE_INLINE_VIRTUAL_TRACE()
130 { 130 {
131 visitor->trace(m_fontFaces); 131 visitor->trace(m_fontFaces);
132 FontFaceSetIterable::IterationSource::trace(visitor); 132 FontFaceSetIterable::IterationSource::trace(visitor);
133 } 133 }
134 134
135 private: 135 private:
136 size_t m_index; 136 size_t m_index;
137 WillBeHeapVector<RefPtrWillBeMember<FontFace>> m_fontFaces; 137 HeapVector<Member<FontFace>> m_fontFaces;
138 }; 138 };
139 139
140 class FontLoadHistogram { 140 class FontLoadHistogram {
141 DISALLOW_NEW(); 141 DISALLOW_NEW();
142 public: 142 public:
143 enum Status { NoWebFonts, HadBlankText, DidNotHaveBlankText, Reported }; 143 enum Status { NoWebFonts, HadBlankText, DidNotHaveBlankText, Reported };
144 FontLoadHistogram() : m_status(NoWebFonts), m_count(0), m_recorded(false ) { } 144 FontLoadHistogram() : m_status(NoWebFonts), m_count(0), m_recorded(false ) { }
145 void incrementCount() { m_count++; } 145 void incrementCount() { m_count++; }
146 void updateStatus(FontFace*); 146 void updateStatus(FontFace*);
147 void record(); 147 void record();
148 148
149 private: 149 private:
150 Status m_status; 150 Status m_status;
151 int m_count; 151 int m_count;
152 bool m_recorded; 152 bool m_recorded;
153 }; 153 };
154 154
155 FontFaceSet(Document&); 155 FontFaceSet(Document&);
156 156
157 bool inActiveDocumentContext() const; 157 bool inActiveDocumentContext() const;
158 void addToLoadingFonts(PassRefPtrWillBeRawPtr<FontFace>); 158 void addToLoadingFonts(RawPtr<FontFace>);
159 void removeFromLoadingFonts(PassRefPtrWillBeRawPtr<FontFace>); 159 void removeFromLoadingFonts(RawPtr<FontFace>);
160 void fireLoadingEvent(); 160 void fireLoadingEvent();
161 void fireDoneEventIfPossible(); 161 void fireDoneEventIfPossible();
162 bool resolveFontStyle(const String&, Font&); 162 bool resolveFontStyle(const String&, Font&);
163 void handlePendingEventsAndPromisesSoon(); 163 void handlePendingEventsAndPromisesSoon();
164 void handlePendingEventsAndPromises(); 164 void handlePendingEventsAndPromises();
165 const WillBeHeapListHashSet<RefPtrWillBeMember<FontFace>>& cssConnectedFontF aceList() const; 165 const HeapListHashSet<Member<FontFace>>& cssConnectedFontFaceList() const;
166 bool isCSSConnectedFontFace(FontFace*) const; 166 bool isCSSConnectedFontFace(FontFace*) const;
167 bool shouldSignalReady() const; 167 bool shouldSignalReady() const;
168 168
169 using ReadyProperty = ScriptPromiseProperty<RawPtrWillBeMember<FontFaceSet>, RawPtrWillBeMember<FontFaceSet>, Member<DOMException>>; 169 using ReadyProperty = ScriptPromiseProperty<Member<FontFaceSet>, Member<Font FaceSet>, Member<DOMException>>;
170 170
171 WillBeHeapHashSet<RefPtrWillBeMember<FontFace>> m_loadingFonts; 171 HeapHashSet<Member<FontFace>> m_loadingFonts;
172 bool m_shouldFireLoadingEvent; 172 bool m_shouldFireLoadingEvent;
173 bool m_isLoading; 173 bool m_isLoading;
174 PersistentWillBeMember<ReadyProperty> m_ready; 174 Member<ReadyProperty> m_ready;
175 FontFaceArray m_loadedFonts; 175 FontFaceArray m_loadedFonts;
176 FontFaceArray m_failedFonts; 176 FontFaceArray m_failedFonts;
177 WillBeHeapListHashSet<RefPtrWillBeMember<FontFace>> m_nonCSSConnectedFaces; 177 HeapListHashSet<Member<FontFace>> m_nonCSSConnectedFaces;
178 178
179 PersistentWillBeMember<AsyncMethodRunner<FontFaceSet>> m_asyncRunner; 179 Member<AsyncMethodRunner<FontFaceSet>> m_asyncRunner;
180 180
181 FontLoadHistogram m_histogram; 181 FontLoadHistogram m_histogram;
182 }; 182 };
183 183
184 } // namespace blink 184 } // namespace blink
185 185
186 #endif // FontFaceSet_h 186 #endif // FontFaceSet_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698