Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/MediaCapabilitiesBinding.h
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM MediaCapabilities.webidl BY Codegen.py - DO NOT EDIT */
2
3
#ifndef mozilla_dom_MediaCapabilitiesBinding_h
4
#define mozilla_dom_MediaCapabilitiesBinding_h
5
6
#include "GeckoProfiler.h"
7
#include "MediaCapabilitiesBinding.h"
8
#include "js/RootingAPI.h"
9
#include "jspubtd.h"
10
#include "mozilla/ErrorResult.h"
11
#include "mozilla/dom/BindingDeclarations.h"
12
#include "mozilla/dom/Nullable.h"
13
#include "mozilla/dom/PrototypeList.h"
14
15
namespace mozilla {
16
namespace dom {
17
18
struct AudioConfiguration;
19
struct AudioConfigurationAtoms;
20
class MediaCapabilities;
21
struct MediaCapabilitiesAtoms;
22
class MediaCapabilitiesInfo;
23
struct MediaCapabilitiesInfoAtoms;
24
struct MediaConfigurationAtoms;
25
struct MediaDecodingConfigurationAtoms;
26
struct MediaEncodingConfigurationAtoms;
27
struct NativePropertyHooks;
28
class ProtoAndIfaceCache;
29
struct VideoConfiguration;
30
struct VideoConfigurationAtoms;
31
32
} // namespace dom
33
} // namespace mozilla
34
35
namespace mozilla {
36
namespace dom {
37
38
enum class MediaDecodingType : uint8_t {
39
  File,
40
  Media_source,
41
  EndGuard_
42
};
43
44
namespace MediaDecodingTypeValues {
45
extern const EnumEntry strings[3];
46
} // namespace MediaDecodingTypeValues
47
48
bool
49
ToJSValue(JSContext* aCx, MediaDecodingType aArgument, JS::MutableHandle<JS::Value> aValue);
50
51
52
enum class MediaEncodingType : uint8_t {
53
  Record,
54
  Transmission,
55
  EndGuard_
56
};
57
58
namespace MediaEncodingTypeValues {
59
extern const EnumEntry strings[3];
60
} // namespace MediaEncodingTypeValues
61
62
bool
63
ToJSValue(JSContext* aCx, MediaEncodingType aArgument, JS::MutableHandle<JS::Value> aValue);
64
65
66
struct AudioConfiguration : public DictionaryBase
67
{
68
  MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBitrate;
69
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mChannels;
70
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mContentType;
71
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mSamplerate;
72
73
  AudioConfiguration();
74
75
  explicit inline AudioConfiguration(const FastDictionaryInitializer& )
76
0
  {
77
0
    // Do nothing here; this is used by our "Fast" subclass
78
0
  }
79
80
  explicit inline AudioConfiguration(const AudioConfiguration& aOther)
81
0
  {
82
0
    *this = aOther;
83
0
  }
84
85
  bool
86
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
87
88
  bool
89
  Init(const nsAString& aJSON);
90
91
  bool
92
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
93
94
  bool
95
  ToJSON(nsAString& aJSON) const;
96
97
  void
98
  TraceDictionary(JSTracer* trc);
99
100
  AudioConfiguration&
101
  operator=(const AudioConfiguration& aOther);
102
103
private:
104
  static bool
105
  InitIds(JSContext* cx, AudioConfigurationAtoms* atomsCache);
106
};
107
108
namespace binding_detail {
109
struct FastAudioConfiguration : public AudioConfiguration
110
{
111
  inline FastAudioConfiguration()
112
    : AudioConfiguration(FastDictionaryInitializer())
113
0
  {
114
0
    // Doesn't matter what int we pass to the parent constructor
115
0
  }
116
};
117
} // namespace binding_detail
118
119
120
struct VideoConfiguration : public DictionaryBase
121
{
122
  MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBitrate;
123
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mContentType;
124
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mFramerate;
125
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mHeight;
126
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mWidth;
127
128
  VideoConfiguration();
129
130
  explicit inline VideoConfiguration(const FastDictionaryInitializer& )
131
0
  {
132
0
    // Do nothing here; this is used by our "Fast" subclass
133
0
  }
134
135
  explicit inline VideoConfiguration(const VideoConfiguration& aOther)
136
0
  {
137
0
    *this = aOther;
138
0
  }
139
140
  bool
141
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
142
143
  bool
144
  Init(const nsAString& aJSON);
145
146
  bool
147
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
148
149
  bool
150
  ToJSON(nsAString& aJSON) const;
151
152
  void
153
  TraceDictionary(JSTracer* trc);
154
155
  VideoConfiguration&
156
  operator=(const VideoConfiguration& aOther);
157
158
private:
159
  static bool
160
  InitIds(JSContext* cx, VideoConfigurationAtoms* atomsCache);
161
};
162
163
namespace binding_detail {
164
struct FastVideoConfiguration : public VideoConfiguration
165
{
166
  inline FastVideoConfiguration()
167
    : VideoConfiguration(FastDictionaryInitializer())
168
0
  {
169
0
    // Doesn't matter what int we pass to the parent constructor
170
0
  }
171
};
172
} // namespace binding_detail
173
174
175
struct MediaConfiguration : public DictionaryBase
176
{
177
  MOZ_INIT_OUTSIDE_CTOR AudioConfiguration mAudio;
178
  MOZ_INIT_OUTSIDE_CTOR VideoConfiguration mVideo;
179
180
  MediaConfiguration();
181
182
  explicit inline MediaConfiguration(const FastDictionaryInitializer& )
183
    : mAudio(FastDictionaryInitializer()),
184
      mVideo(FastDictionaryInitializer())
185
0
  {
186
0
    // Do nothing here; this is used by our "Fast" subclass
187
0
  }
188
189
  explicit inline MediaConfiguration(const MediaConfiguration& aOther)
190
    : mAudio(FastDictionaryInitializer()),
191
      mVideo(FastDictionaryInitializer())
192
0
  {
193
0
    *this = aOther;
194
0
  }
195
196
  bool
197
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
198
199
  bool
200
  Init(const nsAString& aJSON);
201
202
  bool
203
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
204
205
  bool
206
  ToJSON(nsAString& aJSON) const;
207
208
  void
209
  TraceDictionary(JSTracer* trc);
210
211
  MediaConfiguration&
212
  operator=(const MediaConfiguration& aOther);
213
214
private:
215
  static bool
216
  InitIds(JSContext* cx, MediaConfigurationAtoms* atomsCache);
217
};
218
219
namespace binding_detail {
220
struct FastMediaConfiguration : public MediaConfiguration
221
{
222
  inline FastMediaConfiguration()
223
    : MediaConfiguration(FastDictionaryInitializer())
224
0
  {
225
0
    // Doesn't matter what int we pass to the parent constructor
226
0
  }
227
};
228
} // namespace binding_detail
229
230
231
struct MediaDecodingConfiguration : public MediaConfiguration
232
{
233
  MOZ_INIT_OUTSIDE_CTOR MediaDecodingType mType;
234
235
  MediaDecodingConfiguration();
236
237
  explicit inline MediaDecodingConfiguration(const FastDictionaryInitializer& )
238
    : MediaConfiguration(FastDictionaryInitializer())
239
0
  {
240
0
    // Do nothing here; this is used by our "Fast" subclass
241
0
  }
242
243
  explicit inline MediaDecodingConfiguration(const MediaDecodingConfiguration& aOther)
244
0
  {
245
0
    *this = aOther;
246
0
  }
247
248
  bool
249
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
250
251
  bool
252
  Init(const nsAString& aJSON);
253
254
  bool
255
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
256
257
  bool
258
  ToJSON(nsAString& aJSON) const;
259
260
  void
261
  TraceDictionary(JSTracer* trc);
262
263
  MediaDecodingConfiguration&
264
  operator=(const MediaDecodingConfiguration& aOther);
265
266
private:
267
  static bool
268
  InitIds(JSContext* cx, MediaDecodingConfigurationAtoms* atomsCache);
269
};
270
271
namespace binding_detail {
272
struct FastMediaDecodingConfiguration : public MediaDecodingConfiguration
273
{
274
  inline FastMediaDecodingConfiguration()
275
    : MediaDecodingConfiguration(FastDictionaryInitializer())
276
0
  {
277
0
    // Doesn't matter what int we pass to the parent constructor
278
0
  }
279
};
280
} // namespace binding_detail
281
282
283
struct MediaEncodingConfiguration : public MediaConfiguration
284
{
285
  MOZ_INIT_OUTSIDE_CTOR MediaEncodingType mType;
286
287
  MediaEncodingConfiguration();
288
289
  explicit inline MediaEncodingConfiguration(const FastDictionaryInitializer& )
290
    : MediaConfiguration(FastDictionaryInitializer())
291
0
  {
292
0
    // Do nothing here; this is used by our "Fast" subclass
293
0
  }
294
295
  explicit inline MediaEncodingConfiguration(const MediaEncodingConfiguration& aOther)
296
0
  {
297
0
    *this = aOther;
298
0
  }
299
300
  bool
301
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
302
303
  bool
304
  Init(const nsAString& aJSON);
305
306
  bool
307
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
308
309
  bool
310
  ToJSON(nsAString& aJSON) const;
311
312
  void
313
  TraceDictionary(JSTracer* trc);
314
315
  MediaEncodingConfiguration&
316
  operator=(const MediaEncodingConfiguration& aOther);
317
318
private:
319
  static bool
320
  InitIds(JSContext* cx, MediaEncodingConfigurationAtoms* atomsCache);
321
};
322
323
namespace binding_detail {
324
struct FastMediaEncodingConfiguration : public MediaEncodingConfiguration
325
{
326
  inline FastMediaEncodingConfiguration()
327
    : MediaEncodingConfiguration(FastDictionaryInitializer())
328
0
  {
329
0
    // Doesn't matter what int we pass to the parent constructor
330
0
  }
331
};
332
} // namespace binding_detail
333
334
335
namespace MediaCapabilities_Binding {
336
337
  typedef mozilla::dom::MediaCapabilities NativeType;
338
339
  bool
340
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
341
342
  const JSClass*
343
  GetJSClass();
344
345
  bool
346
  Wrap(JSContext* aCx, mozilla::dom::MediaCapabilities* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
347
348
  template <class T>
349
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
350
0
  {
351
0
    JS::Rooted<JSObject*> reflector(aCx);
352
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
353
0
  }
354
355
  // We declare this as an array so that retrieving a pointer to this
356
  // binding's property hooks only requires compile/link-time resolvable
357
  // address arithmetic.  Declaring it as a pointer instead would require
358
  // doing a run-time load to fetch a pointer to this binding's property
359
  // hooks.  And then structures which embedded a pointer to this structure
360
  // would require a run-time load for proper initialization, which would
361
  // then induce static constructors.  Lots of static constructors.
362
  extern const NativePropertyHooks sNativePropertyHooks[];
363
364
  void
365
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
366
367
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
368
0
  {
369
0
    /* Get the interface prototype object for this class.  This will create the
370
0
       object as needed. */
371
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::MediaCapabilities,
372
0
                                       &CreateInterfaceObjects,
373
0
                                       /* aDefineOnGlobal = */ true);
374
0
375
0
  }
376
377
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
378
0
  {
379
0
    /* Get the interface object for this class.  This will create the object as
380
0
       needed. */
381
0
382
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::MediaCapabilities,
383
0
                                       &CreateInterfaceObjects,
384
0
                                       aDefineOnGlobal);
385
0
  }
386
387
  JSObject*
388
  GetConstructorObject(JSContext* aCx);
389
390
} // namespace MediaCapabilities_Binding
391
392
393
394
namespace MediaCapabilitiesInfo_Binding {
395
396
  typedef mozilla::dom::MediaCapabilitiesInfo NativeType;
397
398
  bool
399
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
400
401
  const JSClass*
402
  GetJSClass();
403
404
  bool
405
  Wrap(JSContext* aCx, mozilla::dom::MediaCapabilitiesInfo* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
406
407
  // We declare this as an array so that retrieving a pointer to this
408
  // binding's property hooks only requires compile/link-time resolvable
409
  // address arithmetic.  Declaring it as a pointer instead would require
410
  // doing a run-time load to fetch a pointer to this binding's property
411
  // hooks.  And then structures which embedded a pointer to this structure
412
  // would require a run-time load for proper initialization, which would
413
  // then induce static constructors.  Lots of static constructors.
414
  extern const NativePropertyHooks sNativePropertyHooks[];
415
416
  void
417
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
418
419
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
420
0
  {
421
0
    /* Get the interface prototype object for this class.  This will create the
422
0
       object as needed. */
423
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::MediaCapabilitiesInfo,
424
0
                                       &CreateInterfaceObjects,
425
0
                                       /* aDefineOnGlobal = */ true);
426
0
427
0
  }
428
429
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
430
0
  {
431
0
    /* Get the interface object for this class.  This will create the object as
432
0
       needed. */
433
0
434
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::MediaCapabilitiesInfo,
435
0
                                       &CreateInterfaceObjects,
436
0
                                       aDefineOnGlobal);
437
0
  }
438
439
  JSObject*
440
  GetConstructorObject(JSContext* aCx);
441
442
} // namespace MediaCapabilitiesInfo_Binding
443
444
445
446
} // namespace dom
447
} // namespace mozilla
448
449
#endif // mozilla_dom_MediaCapabilitiesBinding_h