/work/obj-fuzz/dist/include/mozilla/dom/VTTCueBinding.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM VTTCue.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #ifndef mozilla_dom_VTTCueBinding_h |
4 | | #define mozilla_dom_VTTCueBinding_h |
5 | | |
6 | | #include "GeckoProfiler.h" |
7 | | #include "js/RootingAPI.h" |
8 | | #include "jspubtd.h" |
9 | | #include "mozilla/ErrorResult.h" |
10 | | #include "mozilla/dom/BindingDeclarations.h" |
11 | | #include "mozilla/dom/FakeString.h" |
12 | | #include "mozilla/dom/Nullable.h" |
13 | | #include "mozilla/dom/PrototypeList.h" |
14 | | #include "mozilla/dom/UnionMember.h" |
15 | | |
16 | | namespace mozilla { |
17 | | namespace dom { |
18 | | |
19 | | struct NativePropertyHooks; |
20 | | class ProtoAndIfaceCache; |
21 | | class TextTrackCue; |
22 | | struct TextTrackCueAtoms; |
23 | | |
24 | | } // namespace dom |
25 | | } // namespace mozilla |
26 | | |
27 | | namespace mozilla { |
28 | | namespace dom { |
29 | | |
30 | | enum class AutoKeyword : uint8_t { |
31 | | Auto, |
32 | | EndGuard_ |
33 | | }; |
34 | | |
35 | | namespace AutoKeywordValues { |
36 | | extern const EnumEntry strings[2]; |
37 | | } // namespace AutoKeywordValues |
38 | | |
39 | | bool |
40 | | ToJSValue(JSContext* aCx, AutoKeyword aArgument, JS::MutableHandle<JS::Value> aValue); |
41 | | |
42 | | |
43 | | enum class LineAlignSetting : uint8_t { |
44 | | Start, |
45 | | Center, |
46 | | End, |
47 | | EndGuard_ |
48 | | }; |
49 | | |
50 | | namespace LineAlignSettingValues { |
51 | | extern const EnumEntry strings[4]; |
52 | | } // namespace LineAlignSettingValues |
53 | | |
54 | | bool |
55 | | ToJSValue(JSContext* aCx, LineAlignSetting aArgument, JS::MutableHandle<JS::Value> aValue); |
56 | | |
57 | | |
58 | | enum class PositionAlignSetting : uint8_t { |
59 | | Line_left, |
60 | | Center, |
61 | | Line_right, |
62 | | Auto, |
63 | | EndGuard_ |
64 | | }; |
65 | | |
66 | | namespace PositionAlignSettingValues { |
67 | | extern const EnumEntry strings[5]; |
68 | | } // namespace PositionAlignSettingValues |
69 | | |
70 | | bool |
71 | | ToJSValue(JSContext* aCx, PositionAlignSetting aArgument, JS::MutableHandle<JS::Value> aValue); |
72 | | |
73 | | |
74 | | enum class AlignSetting : uint8_t { |
75 | | Start, |
76 | | Center, |
77 | | End, |
78 | | Left, |
79 | | Right, |
80 | | EndGuard_ |
81 | | }; |
82 | | |
83 | | namespace AlignSettingValues { |
84 | | extern const EnumEntry strings[6]; |
85 | | } // namespace AlignSettingValues |
86 | | |
87 | | bool |
88 | | ToJSValue(JSContext* aCx, AlignSetting aArgument, JS::MutableHandle<JS::Value> aValue); |
89 | | |
90 | | |
91 | | enum class DirectionSetting : uint8_t { |
92 | | _empty, |
93 | | Rl, |
94 | | Lr, |
95 | | EndGuard_ |
96 | | }; |
97 | | |
98 | | namespace DirectionSettingValues { |
99 | | extern const EnumEntry strings[4]; |
100 | | } // namespace DirectionSettingValues |
101 | | |
102 | | bool |
103 | | ToJSValue(JSContext* aCx, DirectionSetting aArgument, JS::MutableHandle<JS::Value> aValue); |
104 | | |
105 | | |
106 | | class DoubleOrAutoKeyword |
107 | | { |
108 | | friend class DoubleOrAutoKeywordArgument; |
109 | | enum Type |
110 | | { |
111 | | eUninitialized, |
112 | | eDouble, |
113 | | eAutoKeyword |
114 | | }; |
115 | | |
116 | | union Value |
117 | | { |
118 | | UnionMember<double > mDouble; |
119 | | UnionMember<AutoKeyword > mAutoKeyword; |
120 | | |
121 | | }; |
122 | | |
123 | | Type mType; |
124 | | Value mValue; |
125 | | |
126 | | DoubleOrAutoKeyword(const DoubleOrAutoKeyword&) = delete; |
127 | | DoubleOrAutoKeyword& operator=(const DoubleOrAutoKeyword&) = delete; |
128 | | public: |
129 | | explicit inline DoubleOrAutoKeyword() |
130 | | : mType(eUninitialized) |
131 | 0 | { |
132 | 0 | } |
133 | | |
134 | | inline ~DoubleOrAutoKeyword() |
135 | 0 | { |
136 | 0 | Uninit(); |
137 | 0 | } |
138 | | |
139 | | inline double& |
140 | | RawSetAsDouble() |
141 | 0 | { |
142 | 0 | if (mType == eDouble) { |
143 | 0 | return mValue.mDouble.Value(); |
144 | 0 | } |
145 | 0 | MOZ_ASSERT(mType == eUninitialized); |
146 | 0 | mType = eDouble; |
147 | 0 | return mValue.mDouble.SetValue(); |
148 | 0 | } |
149 | | |
150 | | inline double& |
151 | | SetAsDouble() |
152 | 0 | { |
153 | 0 | if (mType == eDouble) { |
154 | 0 | return mValue.mDouble.Value(); |
155 | 0 | } |
156 | 0 | Uninit(); |
157 | 0 | mType = eDouble; |
158 | 0 | return mValue.mDouble.SetValue(); |
159 | 0 | } |
160 | | |
161 | | inline bool |
162 | | IsDouble() const |
163 | 0 | { |
164 | 0 | return mType == eDouble; |
165 | 0 | } |
166 | | |
167 | | inline double& |
168 | | GetAsDouble() |
169 | 0 | { |
170 | 0 | MOZ_ASSERT(IsDouble(), "Wrong type!"); |
171 | 0 | return mValue.mDouble.Value(); |
172 | 0 | } |
173 | | |
174 | | inline double |
175 | | GetAsDouble() const |
176 | 0 | { |
177 | 0 | MOZ_ASSERT(IsDouble(), "Wrong type!"); |
178 | 0 | return mValue.mDouble.Value(); |
179 | 0 | } |
180 | | |
181 | | inline AutoKeyword& |
182 | | RawSetAsAutoKeyword() |
183 | 0 | { |
184 | 0 | if (mType == eAutoKeyword) { |
185 | 0 | return mValue.mAutoKeyword.Value(); |
186 | 0 | } |
187 | 0 | MOZ_ASSERT(mType == eUninitialized); |
188 | 0 | mType = eAutoKeyword; |
189 | 0 | return mValue.mAutoKeyword.SetValue(); |
190 | 0 | } |
191 | | |
192 | | inline AutoKeyword& |
193 | | SetAsAutoKeyword() |
194 | 0 | { |
195 | 0 | if (mType == eAutoKeyword) { |
196 | 0 | return mValue.mAutoKeyword.Value(); |
197 | 0 | } |
198 | 0 | Uninit(); |
199 | 0 | mType = eAutoKeyword; |
200 | 0 | return mValue.mAutoKeyword.SetValue(); |
201 | 0 | } |
202 | | |
203 | | inline bool |
204 | | IsAutoKeyword() const |
205 | 0 | { |
206 | 0 | return mType == eAutoKeyword; |
207 | 0 | } |
208 | | |
209 | | inline AutoKeyword& |
210 | | GetAsAutoKeyword() |
211 | 0 | { |
212 | 0 | MOZ_ASSERT(IsAutoKeyword(), "Wrong type!"); |
213 | 0 | return mValue.mAutoKeyword.Value(); |
214 | 0 | } |
215 | | |
216 | | inline AutoKeyword |
217 | | GetAsAutoKeyword() const |
218 | 0 | { |
219 | 0 | MOZ_ASSERT(IsAutoKeyword(), "Wrong type!"); |
220 | 0 | return mValue.mAutoKeyword.Value(); |
221 | 0 | } |
222 | | |
223 | | inline void |
224 | | Uninit() |
225 | | { |
226 | | switch (mType) { |
227 | | case eUninitialized: { |
228 | | break; |
229 | | } |
230 | | case eDouble: { |
231 | | DestroyDouble(); |
232 | | break; |
233 | | } |
234 | | case eAutoKeyword: { |
235 | | DestroyAutoKeyword(); |
236 | | break; |
237 | | } |
238 | | } |
239 | | } |
240 | | |
241 | | bool |
242 | | ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const; |
243 | | |
244 | | private: |
245 | | inline void |
246 | | DestroyDouble() |
247 | 0 | { |
248 | 0 | MOZ_ASSERT(IsDouble(), "Wrong type!"); |
249 | 0 | mValue.mDouble.Destroy(); |
250 | 0 | mType = eUninitialized; |
251 | 0 | } |
252 | | |
253 | | inline void |
254 | | DestroyAutoKeyword() |
255 | 0 | { |
256 | 0 | MOZ_ASSERT(IsAutoKeyword(), "Wrong type!"); |
257 | 0 | mValue.mAutoKeyword.Destroy(); |
258 | 0 | mType = eUninitialized; |
259 | 0 | } |
260 | | }; |
261 | | |
262 | | |
263 | | class OwningDoubleOrAutoKeyword : public AllOwningUnionBase |
264 | | { |
265 | | friend void ImplCycleCollectionUnlink(OwningDoubleOrAutoKeyword& aUnion); |
266 | | enum Type |
267 | | { |
268 | | eUninitialized, |
269 | | eDouble, |
270 | | eAutoKeyword |
271 | | }; |
272 | | |
273 | | union Value |
274 | | { |
275 | | UnionMember<double > mDouble; |
276 | | UnionMember<AutoKeyword > mAutoKeyword; |
277 | | |
278 | | }; |
279 | | |
280 | | Type mType; |
281 | | Value mValue; |
282 | | |
283 | | public: |
284 | | explicit inline OwningDoubleOrAutoKeyword() |
285 | | : mType(eUninitialized) |
286 | 0 | { |
287 | 0 | } |
288 | | |
289 | | explicit inline OwningDoubleOrAutoKeyword(const OwningDoubleOrAutoKeyword& aOther) |
290 | | : mType(eUninitialized) |
291 | 0 | { |
292 | 0 | *this = aOther; |
293 | 0 | } |
294 | | |
295 | | inline ~OwningDoubleOrAutoKeyword() |
296 | 0 | { |
297 | 0 | Uninit(); |
298 | 0 | } |
299 | | |
300 | | double& |
301 | | RawSetAsDouble(); |
302 | | |
303 | | double& |
304 | | SetAsDouble(); |
305 | | |
306 | | bool |
307 | | TrySetToDouble(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false); |
308 | | |
309 | | inline bool |
310 | | IsDouble() const |
311 | 0 | { |
312 | 0 | return mType == eDouble; |
313 | 0 | } |
314 | | |
315 | | inline double& |
316 | | GetAsDouble() |
317 | 0 | { |
318 | 0 | MOZ_ASSERT(IsDouble(), "Wrong type!"); |
319 | 0 | return mValue.mDouble.Value(); |
320 | 0 | } |
321 | | |
322 | | inline double const & |
323 | | GetAsDouble() const |
324 | 0 | { |
325 | 0 | MOZ_ASSERT(IsDouble(), "Wrong type!"); |
326 | 0 | return mValue.mDouble.Value(); |
327 | 0 | } |
328 | | |
329 | | AutoKeyword& |
330 | | RawSetAsAutoKeyword(); |
331 | | |
332 | | AutoKeyword& |
333 | | SetAsAutoKeyword(); |
334 | | |
335 | | bool |
336 | | TrySetToAutoKeyword(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false); |
337 | | |
338 | | inline bool |
339 | | IsAutoKeyword() const |
340 | 0 | { |
341 | 0 | return mType == eAutoKeyword; |
342 | 0 | } |
343 | | |
344 | | inline AutoKeyword& |
345 | | GetAsAutoKeyword() |
346 | 0 | { |
347 | 0 | MOZ_ASSERT(IsAutoKeyword(), "Wrong type!"); |
348 | 0 | return mValue.mAutoKeyword.Value(); |
349 | 0 | } |
350 | | |
351 | | inline AutoKeyword const & |
352 | | GetAsAutoKeyword() const |
353 | 0 | { |
354 | 0 | MOZ_ASSERT(IsAutoKeyword(), "Wrong type!"); |
355 | 0 | return mValue.mAutoKeyword.Value(); |
356 | 0 | } |
357 | | |
358 | | void |
359 | | Uninit(); |
360 | | |
361 | | bool |
362 | | ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const; |
363 | | |
364 | | void |
365 | | TraceUnion(JSTracer* trc); |
366 | | |
367 | | OwningDoubleOrAutoKeyword& |
368 | | operator=(const OwningDoubleOrAutoKeyword& aOther); |
369 | | |
370 | | private: |
371 | | void |
372 | | DestroyDouble(); |
373 | | |
374 | | void |
375 | | DestroyAutoKeyword(); |
376 | | }; |
377 | | |
378 | | |
379 | | namespace VTTCue_Binding { |
380 | | |
381 | | typedef mozilla::dom::TextTrackCue NativeType; |
382 | | |
383 | | const JSClass* |
384 | | GetJSClass(); |
385 | | |
386 | | bool |
387 | | Wrap(JSContext* aCx, mozilla::dom::TextTrackCue* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
388 | | |
389 | | template <class T> |
390 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
391 | 0 | { |
392 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
393 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
394 | 0 | } |
395 | | |
396 | | // We declare this as an array so that retrieving a pointer to this |
397 | | // binding's property hooks only requires compile/link-time resolvable |
398 | | // address arithmetic. Declaring it as a pointer instead would require |
399 | | // doing a run-time load to fetch a pointer to this binding's property |
400 | | // hooks. And then structures which embedded a pointer to this structure |
401 | | // would require a run-time load for proper initialization, which would |
402 | | // then induce static constructors. Lots of static constructors. |
403 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
404 | | |
405 | | void |
406 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
407 | | |
408 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
409 | 0 | { |
410 | 0 | /* Get the interface prototype object for this class. This will create the |
411 | 0 | object as needed. */ |
412 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::VTTCue, |
413 | 0 | &CreateInterfaceObjects, |
414 | 0 | /* aDefineOnGlobal = */ true); |
415 | 0 |
|
416 | 0 | } |
417 | | |
418 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
419 | 0 | { |
420 | 0 | /* Get the interface object for this class. This will create the object as |
421 | 0 | needed. */ |
422 | 0 |
|
423 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::VTTCue, |
424 | 0 | &CreateInterfaceObjects, |
425 | 0 | aDefineOnGlobal); |
426 | 0 | } |
427 | | |
428 | | JSObject* |
429 | | GetConstructorObject(JSContext* aCx); |
430 | | |
431 | | } // namespace VTTCue_Binding |
432 | | |
433 | | |
434 | | |
435 | | } // namespace dom |
436 | | } // namespace mozilla |
437 | | |
438 | | #endif // mozilla_dom_VTTCueBinding_h |