/work/obj-fuzz/dist/include/mozilla/dom/RTCRtpSenderBinding.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM RTCRtpSender.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #ifndef mozilla_dom_RTCRtpSenderBinding_h |
4 | | #define mozilla_dom_RTCRtpSenderBinding_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/CallbackInterface.h" |
12 | | #include "mozilla/dom/Nullable.h" |
13 | | #include "mozilla/dom/PrototypeList.h" |
14 | | #include "mozilla/dom/ToJSValue.h" |
15 | | #include "nsWeakReference.h" |
16 | | |
17 | | namespace mozilla { |
18 | | |
19 | | class DOMMediaStream; |
20 | | |
21 | | namespace dom { |
22 | | |
23 | | class MediaStreamTrack; |
24 | | struct NativePropertyHooks; |
25 | | class Promise; |
26 | | class ProtoAndIfaceCache; |
27 | | class RTCDTMFSender; |
28 | | struct RTCFecParameters; |
29 | | struct RTCFecParametersAtoms; |
30 | | class RTCPeerConnection; |
31 | | struct RTCRtcpParameters; |
32 | | struct RTCRtcpParametersAtoms; |
33 | | struct RTCRtpCodecParameters; |
34 | | struct RTCRtpCodecParametersAtoms; |
35 | | struct RTCRtpEncodingParameters; |
36 | | struct RTCRtpEncodingParametersAtoms; |
37 | | struct RTCRtpHeaderExtensionParameters; |
38 | | struct RTCRtpHeaderExtensionParametersAtoms; |
39 | | struct RTCRtpParameters; |
40 | | struct RTCRtpParametersAtoms; |
41 | | class RTCRtpSender; |
42 | | struct RTCRtpSenderAtoms; |
43 | | struct RTCRtxParameters; |
44 | | struct RTCRtxParametersAtoms; |
45 | | |
46 | | } // namespace dom |
47 | | |
48 | | } // namespace mozilla |
49 | | |
50 | | namespace mozilla { |
51 | | namespace dom { |
52 | | |
53 | | enum class RTCPriorityType : uint8_t { |
54 | | Very_low, |
55 | | Low, |
56 | | Medium, |
57 | | High, |
58 | | EndGuard_ |
59 | | }; |
60 | | |
61 | | namespace RTCPriorityTypeValues { |
62 | | extern const EnumEntry strings[5]; |
63 | | } // namespace RTCPriorityTypeValues |
64 | | |
65 | | bool |
66 | | ToJSValue(JSContext* aCx, RTCPriorityType aArgument, JS::MutableHandle<JS::Value> aValue); |
67 | | |
68 | | |
69 | | enum class RTCDegradationPreference : uint8_t { |
70 | | Maintain_framerate, |
71 | | Maintain_resolution, |
72 | | Balanced, |
73 | | EndGuard_ |
74 | | }; |
75 | | |
76 | | namespace RTCDegradationPreferenceValues { |
77 | | extern const EnumEntry strings[4]; |
78 | | } // namespace RTCDegradationPreferenceValues |
79 | | |
80 | | bool |
81 | | ToJSValue(JSContext* aCx, RTCDegradationPreference aArgument, JS::MutableHandle<JS::Value> aValue); |
82 | | |
83 | | |
84 | | struct RTCFecParameters : public DictionaryBase |
85 | | { |
86 | | MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mSsrc; |
87 | | |
88 | | RTCFecParameters(); |
89 | | |
90 | | explicit inline RTCFecParameters(const FastDictionaryInitializer& ) |
91 | 0 | { |
92 | 0 | // Do nothing here; this is used by our "Fast" subclass |
93 | 0 | } |
94 | | |
95 | | explicit inline RTCFecParameters(const RTCFecParameters& aOther) |
96 | 0 | { |
97 | 0 | *this = aOther; |
98 | 0 | } |
99 | | |
100 | | bool |
101 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
102 | | |
103 | | bool |
104 | | Init(const nsAString& aJSON); |
105 | | |
106 | | bool |
107 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
108 | | |
109 | | bool |
110 | | ToJSON(nsAString& aJSON) const; |
111 | | |
112 | | void |
113 | | TraceDictionary(JSTracer* trc); |
114 | | |
115 | | RTCFecParameters& |
116 | | operator=(const RTCFecParameters& aOther); |
117 | | |
118 | | private: |
119 | | static bool |
120 | | InitIds(JSContext* cx, RTCFecParametersAtoms* atomsCache); |
121 | | }; |
122 | | |
123 | | namespace binding_detail { |
124 | | struct FastRTCFecParameters : public RTCFecParameters |
125 | | { |
126 | | inline FastRTCFecParameters() |
127 | | : RTCFecParameters(FastDictionaryInitializer()) |
128 | 0 | { |
129 | 0 | // Doesn't matter what int we pass to the parent constructor |
130 | 0 | } |
131 | | }; |
132 | | } // namespace binding_detail |
133 | | |
134 | | |
135 | | struct RTCRtcpParameters : public DictionaryBase |
136 | | { |
137 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mCname; |
138 | | MOZ_INIT_OUTSIDE_CTOR Optional<bool> mReducedSize; |
139 | | |
140 | | RTCRtcpParameters(); |
141 | | |
142 | | explicit inline RTCRtcpParameters(const FastDictionaryInitializer& ) |
143 | 0 | { |
144 | 0 | // Do nothing here; this is used by our "Fast" subclass |
145 | 0 | } |
146 | | |
147 | | explicit inline RTCRtcpParameters(const RTCRtcpParameters& aOther) |
148 | 0 | { |
149 | 0 | *this = aOther; |
150 | 0 | } |
151 | | |
152 | | bool |
153 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
154 | | |
155 | | bool |
156 | | Init(const nsAString& aJSON); |
157 | | |
158 | | bool |
159 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
160 | | |
161 | | bool |
162 | | ToJSON(nsAString& aJSON) const; |
163 | | |
164 | | void |
165 | | TraceDictionary(JSTracer* trc); |
166 | | |
167 | | RTCRtcpParameters& |
168 | | operator=(const RTCRtcpParameters& aOther); |
169 | | |
170 | | private: |
171 | | static bool |
172 | | InitIds(JSContext* cx, RTCRtcpParametersAtoms* atomsCache); |
173 | | }; |
174 | | |
175 | | namespace binding_detail { |
176 | | struct FastRTCRtcpParameters : public RTCRtcpParameters |
177 | | { |
178 | | inline FastRTCRtcpParameters() |
179 | | : RTCRtcpParameters(FastDictionaryInitializer()) |
180 | 0 | { |
181 | 0 | // Doesn't matter what int we pass to the parent constructor |
182 | 0 | } |
183 | | }; |
184 | | } // namespace binding_detail |
185 | | |
186 | | |
187 | | struct RTCRtpCodecParameters : public DictionaryBase |
188 | | { |
189 | | MOZ_INIT_OUTSIDE_CTOR uint16_t mChannels; |
190 | | MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mClockRate; |
191 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mMimeType; |
192 | | MOZ_INIT_OUTSIDE_CTOR Optional<uint16_t> mPayloadType; |
193 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mSdpFmtpLine; |
194 | | |
195 | | RTCRtpCodecParameters(); |
196 | | |
197 | | explicit inline RTCRtpCodecParameters(const FastDictionaryInitializer& ) |
198 | 0 | { |
199 | 0 | // Do nothing here; this is used by our "Fast" subclass |
200 | 0 | } |
201 | | |
202 | | explicit inline RTCRtpCodecParameters(const RTCRtpCodecParameters& aOther) |
203 | 0 | { |
204 | 0 | *this = aOther; |
205 | 0 | } |
206 | | |
207 | | bool |
208 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
209 | | |
210 | | bool |
211 | | Init(const nsAString& aJSON); |
212 | | |
213 | | bool |
214 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
215 | | |
216 | | bool |
217 | | ToJSON(nsAString& aJSON) const; |
218 | | |
219 | | void |
220 | | TraceDictionary(JSTracer* trc); |
221 | | |
222 | | RTCRtpCodecParameters& |
223 | | operator=(const RTCRtpCodecParameters& aOther); |
224 | | |
225 | | private: |
226 | | static bool |
227 | | InitIds(JSContext* cx, RTCRtpCodecParametersAtoms* atomsCache); |
228 | | }; |
229 | | |
230 | | namespace binding_detail { |
231 | | struct FastRTCRtpCodecParameters : public RTCRtpCodecParameters |
232 | | { |
233 | | inline FastRTCRtpCodecParameters() |
234 | | : RTCRtpCodecParameters(FastDictionaryInitializer()) |
235 | 0 | { |
236 | 0 | // Doesn't matter what int we pass to the parent constructor |
237 | 0 | } |
238 | | }; |
239 | | } // namespace binding_detail |
240 | | |
241 | | |
242 | | struct RTCRtpHeaderExtensionParameters : public DictionaryBase |
243 | | { |
244 | | MOZ_INIT_OUTSIDE_CTOR Optional<bool> mEncrypted; |
245 | | MOZ_INIT_OUTSIDE_CTOR Optional<uint16_t> mId; |
246 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mUri; |
247 | | |
248 | | RTCRtpHeaderExtensionParameters(); |
249 | | |
250 | | explicit inline RTCRtpHeaderExtensionParameters(const FastDictionaryInitializer& ) |
251 | 0 | { |
252 | 0 | // Do nothing here; this is used by our "Fast" subclass |
253 | 0 | } |
254 | | |
255 | | explicit inline RTCRtpHeaderExtensionParameters(const RTCRtpHeaderExtensionParameters& aOther) |
256 | 0 | { |
257 | 0 | *this = aOther; |
258 | 0 | } |
259 | | |
260 | | bool |
261 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
262 | | |
263 | | bool |
264 | | Init(const nsAString& aJSON); |
265 | | |
266 | | bool |
267 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
268 | | |
269 | | bool |
270 | | ToJSON(nsAString& aJSON) const; |
271 | | |
272 | | void |
273 | | TraceDictionary(JSTracer* trc); |
274 | | |
275 | | RTCRtpHeaderExtensionParameters& |
276 | | operator=(const RTCRtpHeaderExtensionParameters& aOther); |
277 | | |
278 | | private: |
279 | | static bool |
280 | | InitIds(JSContext* cx, RTCRtpHeaderExtensionParametersAtoms* atomsCache); |
281 | | }; |
282 | | |
283 | | namespace binding_detail { |
284 | | struct FastRTCRtpHeaderExtensionParameters : public RTCRtpHeaderExtensionParameters |
285 | | { |
286 | | inline FastRTCRtpHeaderExtensionParameters() |
287 | | : RTCRtpHeaderExtensionParameters(FastDictionaryInitializer()) |
288 | 0 | { |
289 | 0 | // Doesn't matter what int we pass to the parent constructor |
290 | 0 | } |
291 | | }; |
292 | | } // namespace binding_detail |
293 | | |
294 | | |
295 | | struct RTCRtxParameters : public DictionaryBase |
296 | | { |
297 | | MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mSsrc; |
298 | | |
299 | | RTCRtxParameters(); |
300 | | |
301 | | explicit inline RTCRtxParameters(const FastDictionaryInitializer& ) |
302 | 0 | { |
303 | 0 | // Do nothing here; this is used by our "Fast" subclass |
304 | 0 | } |
305 | | |
306 | | explicit inline RTCRtxParameters(const RTCRtxParameters& aOther) |
307 | 0 | { |
308 | 0 | *this = aOther; |
309 | 0 | } |
310 | | |
311 | | bool |
312 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
313 | | |
314 | | bool |
315 | | Init(const nsAString& aJSON); |
316 | | |
317 | | bool |
318 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
319 | | |
320 | | bool |
321 | | ToJSON(nsAString& aJSON) const; |
322 | | |
323 | | void |
324 | | TraceDictionary(JSTracer* trc); |
325 | | |
326 | | RTCRtxParameters& |
327 | | operator=(const RTCRtxParameters& aOther); |
328 | | |
329 | | private: |
330 | | static bool |
331 | | InitIds(JSContext* cx, RTCRtxParametersAtoms* atomsCache); |
332 | | }; |
333 | | |
334 | | namespace binding_detail { |
335 | | struct FastRTCRtxParameters : public RTCRtxParameters |
336 | | { |
337 | | inline FastRTCRtxParameters() |
338 | | : RTCRtxParameters(FastDictionaryInitializer()) |
339 | 0 | { |
340 | 0 | // Doesn't matter what int we pass to the parent constructor |
341 | 0 | } |
342 | | }; |
343 | | } // namespace binding_detail |
344 | | |
345 | | |
346 | | struct RTCRtpEncodingParameters : public DictionaryBase |
347 | | { |
348 | | MOZ_INIT_OUTSIDE_CTOR Optional<bool> mActive; |
349 | | MOZ_INIT_OUTSIDE_CTOR RTCDegradationPreference mDegradationPreference; |
350 | | MOZ_INIT_OUTSIDE_CTOR RTCFecParameters mFec; |
351 | | MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mMaxBitrate; |
352 | | MOZ_INIT_OUTSIDE_CTOR Optional<RTCPriorityType> mPriority; |
353 | | MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mRid; |
354 | | MOZ_INIT_OUTSIDE_CTOR RTCRtxParameters mRtx; |
355 | | MOZ_INIT_OUTSIDE_CTOR float mScaleResolutionDownBy; |
356 | | MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mSsrc; |
357 | | |
358 | | RTCRtpEncodingParameters(); |
359 | | |
360 | | explicit inline RTCRtpEncodingParameters(const FastDictionaryInitializer& ) |
361 | | : mFec(FastDictionaryInitializer()), |
362 | | mRtx(FastDictionaryInitializer()) |
363 | 0 | { |
364 | 0 | // Do nothing here; this is used by our "Fast" subclass |
365 | 0 | } |
366 | | |
367 | | explicit inline RTCRtpEncodingParameters(const RTCRtpEncodingParameters& aOther) |
368 | | : mFec(FastDictionaryInitializer()), |
369 | | mRtx(FastDictionaryInitializer()) |
370 | 0 | { |
371 | 0 | *this = aOther; |
372 | 0 | } |
373 | | |
374 | | bool |
375 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
376 | | |
377 | | bool |
378 | | Init(const nsAString& aJSON); |
379 | | |
380 | | bool |
381 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
382 | | |
383 | | bool |
384 | | ToJSON(nsAString& aJSON) const; |
385 | | |
386 | | void |
387 | | TraceDictionary(JSTracer* trc); |
388 | | |
389 | | RTCRtpEncodingParameters& |
390 | | operator=(const RTCRtpEncodingParameters& aOther); |
391 | | |
392 | | private: |
393 | | static bool |
394 | | InitIds(JSContext* cx, RTCRtpEncodingParametersAtoms* atomsCache); |
395 | | }; |
396 | | |
397 | | namespace binding_detail { |
398 | | struct FastRTCRtpEncodingParameters : public RTCRtpEncodingParameters |
399 | | { |
400 | | inline FastRTCRtpEncodingParameters() |
401 | | : RTCRtpEncodingParameters(FastDictionaryInitializer()) |
402 | 0 | { |
403 | 0 | // Doesn't matter what int we pass to the parent constructor |
404 | 0 | } |
405 | | }; |
406 | | } // namespace binding_detail |
407 | | |
408 | | |
409 | | struct RTCRtpParameters : public DictionaryBase |
410 | | { |
411 | | MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCRtpCodecParameters>> mCodecs; |
412 | | MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCRtpEncodingParameters>> mEncodings; |
413 | | MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCRtpHeaderExtensionParameters>> mHeaderExtensions; |
414 | | MOZ_INIT_OUTSIDE_CTOR RTCRtcpParameters mRtcp; |
415 | | |
416 | | RTCRtpParameters(); |
417 | | |
418 | | explicit inline RTCRtpParameters(const FastDictionaryInitializer& ) |
419 | | : mRtcp(FastDictionaryInitializer()) |
420 | 0 | { |
421 | 0 | // Do nothing here; this is used by our "Fast" subclass |
422 | 0 | } |
423 | | |
424 | | explicit inline RTCRtpParameters(const RTCRtpParameters& aOther) |
425 | | : mRtcp(FastDictionaryInitializer()) |
426 | 0 | { |
427 | 0 | *this = aOther; |
428 | 0 | } |
429 | | |
430 | | bool |
431 | | Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false); |
432 | | |
433 | | bool |
434 | | Init(const nsAString& aJSON); |
435 | | |
436 | | bool |
437 | | ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const; |
438 | | |
439 | | bool |
440 | | ToJSON(nsAString& aJSON) const; |
441 | | |
442 | | void |
443 | | TraceDictionary(JSTracer* trc); |
444 | | |
445 | | RTCRtpParameters& |
446 | | operator=(const RTCRtpParameters& aOther); |
447 | | |
448 | | private: |
449 | | static bool |
450 | | InitIds(JSContext* cx, RTCRtpParametersAtoms* atomsCache); |
451 | | }; |
452 | | |
453 | | namespace binding_detail { |
454 | | struct FastRTCRtpParameters : public RTCRtpParameters |
455 | | { |
456 | | inline FastRTCRtpParameters() |
457 | | : RTCRtpParameters(FastDictionaryInitializer()) |
458 | 0 | { |
459 | 0 | // Doesn't matter what int we pass to the parent constructor |
460 | 0 | } |
461 | | }; |
462 | | } // namespace binding_detail |
463 | | |
464 | | |
465 | | namespace RTCRtpSender_Binding { |
466 | | |
467 | | typedef mozilla::dom::RTCRtpSender NativeType; |
468 | | |
469 | | bool |
470 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj); |
471 | | |
472 | | const JSClass* |
473 | | GetJSClass(); |
474 | | |
475 | | bool |
476 | | Wrap(JSContext* aCx, mozilla::dom::RTCRtpSender* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector); |
477 | | |
478 | | template <class T> |
479 | | inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto) |
480 | 0 | { |
481 | 0 | JS::Rooted<JSObject*> reflector(aCx); |
482 | 0 | return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr; |
483 | 0 | } |
484 | | |
485 | | // We declare this as an array so that retrieving a pointer to this |
486 | | // binding's property hooks only requires compile/link-time resolvable |
487 | | // address arithmetic. Declaring it as a pointer instead would require |
488 | | // doing a run-time load to fetch a pointer to this binding's property |
489 | | // hooks. And then structures which embedded a pointer to this structure |
490 | | // would require a run-time load for proper initialization, which would |
491 | | // then induce static constructors. Lots of static constructors. |
492 | | extern const NativePropertyHooks sNativePropertyHooks[]; |
493 | | |
494 | | void |
495 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal); |
496 | | |
497 | | inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx) |
498 | 0 | { |
499 | 0 | /* Get the interface prototype object for this class. This will create the |
500 | 0 | object as needed. */ |
501 | 0 | return GetPerInterfaceObjectHandle(aCx, prototypes::id::RTCRtpSender, |
502 | 0 | &CreateInterfaceObjects, |
503 | 0 | /* aDefineOnGlobal = */ true); |
504 | 0 |
|
505 | 0 | } |
506 | | |
507 | | inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true) |
508 | 0 | { |
509 | 0 | /* Get the interface object for this class. This will create the object as |
510 | 0 | needed. */ |
511 | 0 |
|
512 | 0 | return GetPerInterfaceObjectHandle(aCx, constructors::id::RTCRtpSender, |
513 | 0 | &CreateInterfaceObjects, |
514 | 0 | aDefineOnGlobal); |
515 | 0 | } |
516 | | |
517 | | JSObject* |
518 | | GetConstructorObject(JSContext* aCx); |
519 | | |
520 | | } // namespace RTCRtpSender_Binding |
521 | | |
522 | | |
523 | | |
524 | | class RTCRtpSenderJSImpl : public CallbackInterface |
525 | | { |
526 | | public: |
527 | | explicit inline RTCRtpSenderJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal) |
528 | | : CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) |
529 | 0 | { |
530 | 0 | } |
531 | | |
532 | | explicit inline RTCRtpSenderJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& ) |
533 | | : CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
534 | 0 | { |
535 | 0 | } |
536 | | |
537 | | explicit inline RTCRtpSenderJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal) |
538 | | : CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal) |
539 | 0 | { |
540 | 0 | } |
541 | | |
542 | | already_AddRefed<Promise> SetParameters(const RTCRtpParameters& parameters, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
543 | | |
544 | | void GetParameters(RTCRtpParameters& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
545 | | |
546 | | already_AddRefed<Promise> ReplaceTrack(MediaStreamTrack* withTrack, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
547 | | |
548 | | already_AddRefed<Promise> GetStats(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
549 | | |
550 | | void GetStreams(nsTArray<RefPtr<DOMMediaStream>>& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
551 | | |
552 | | void SetStreams(const Sequence<OwningNonNull<DOMMediaStream>>& streams, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
553 | | |
554 | | void SetTrack(MediaStreamTrack* track, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
555 | | |
556 | | void CheckWasCreatedByPc(RTCPeerConnection& pc, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
557 | | |
558 | | inline bool |
559 | | operator==(const RTCRtpSenderJSImpl& aOther) const |
560 | 0 | { |
561 | 0 | return CallbackInterface::operator==(aOther); |
562 | 0 | } |
563 | | |
564 | | already_AddRefed<MediaStreamTrack> GetTrack(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
565 | | |
566 | | already_AddRefed<RTCDTMFSender> GetDtmf(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
567 | | |
568 | | private: |
569 | | static bool |
570 | | InitIds(JSContext* cx, RTCRtpSenderAtoms* atomsCache); |
571 | | }; |
572 | | |
573 | | |
574 | | class RTCRtpSender final : public nsSupportsWeakReference, |
575 | | public nsWrapperCache |
576 | | { |
577 | | public: |
578 | | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
579 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(RTCRtpSender) |
580 | | |
581 | | private: |
582 | | RefPtr<RTCRtpSenderJSImpl> mImpl; |
583 | | nsCOMPtr<nsIGlobalObject> mParent; |
584 | | |
585 | | public: |
586 | | RTCRtpSender(JS::Handle<JSObject*> aJSImplObject, JS::Handle<JSObject*> aJSImplGlobal, nsIGlobalObject* aParent); |
587 | | |
588 | | private: |
589 | | ~RTCRtpSender(); |
590 | | |
591 | | public: |
592 | | nsISupports* GetParentObject() const; |
593 | | |
594 | | virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
595 | | |
596 | | // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee). |
597 | | already_AddRefed<MediaStreamTrack> GetTrack(ErrorResult& aRv, JS::Realm* aRealm = nullptr) const; |
598 | | |
599 | | // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee). |
600 | | already_AddRefed<Promise> SetParameters(const RTCRtpParameters& parameters, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
601 | | |
602 | | void GetParameters(RTCRtpParameters& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
603 | | |
604 | | // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee). |
605 | | already_AddRefed<Promise> ReplaceTrack(MediaStreamTrack* withTrack, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
606 | | |
607 | | // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee). |
608 | | already_AddRefed<Promise> GetStats(ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
609 | | |
610 | | // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee). |
611 | | already_AddRefed<RTCDTMFSender> GetDtmf(ErrorResult& aRv, JS::Realm* aRealm = nullptr) const; |
612 | | |
613 | | void GetStreams(nsTArray<RefPtr<DOMMediaStream>>& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
614 | | |
615 | | void SetStreams(const Sequence<OwningNonNull<DOMMediaStream>>& streams, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
616 | | |
617 | | void SetTrack(MediaStreamTrack* track, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
618 | | |
619 | | void CheckWasCreatedByPc(RTCPeerConnection& pc, ErrorResult& aRv, JS::Realm* aRealm = nullptr); |
620 | | |
621 | | static bool |
622 | | _Create(JSContext* cx, unsigned argc, JS::Value* vp); |
623 | | }; |
624 | | |
625 | | |
626 | | } // namespace dom |
627 | | } // namespace mozilla |
628 | | |
629 | | #endif // mozilla_dom_RTCRtpSenderBinding_h |