Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM RTCStatsReport.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_RTCStatsReportBinding_h
4 : #define mozilla_dom_RTCStatsReportBinding_h
5 :
6 : #include "RTCStatsReportBinding.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/ToJSValue.h"
14 : #include "nsWeakReference.h"
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 : struct NativePropertyHooks;
20 : class ProtoAndIfaceCache;
21 : struct RTCCodecStats;
22 : struct RTCCodecStatsAtoms;
23 : struct RTCIceCandidatePairStats;
24 : struct RTCIceCandidatePairStatsAtoms;
25 : struct RTCIceCandidateStats;
26 : struct RTCIceCandidateStatsAtoms;
27 : struct RTCIceComponentStats;
28 : struct RTCIceComponentStatsAtoms;
29 : struct RTCInboundRTPStreamStats;
30 : struct RTCInboundRTPStreamStatsAtoms;
31 : struct RTCMediaStreamStats;
32 : struct RTCMediaStreamStatsAtoms;
33 : struct RTCMediaStreamTrackStats;
34 : struct RTCMediaStreamTrackStatsAtoms;
35 : struct RTCOutboundRTPStreamStats;
36 : struct RTCOutboundRTPStreamStatsAtoms;
37 : struct RTCRTPContributingSourceStats;
38 : struct RTCRTPContributingSourceStatsAtoms;
39 : struct RTCRTPStreamStatsAtoms;
40 : struct RTCStatsAtoms;
41 : class RTCStatsReport;
42 : struct RTCStatsReportAtoms;
43 : struct RTCStatsReportInternalAtoms;
44 : struct RTCTransportStats;
45 : struct RTCTransportStatsAtoms;
46 :
47 : } // namespace dom
48 : } // namespace mozilla
49 :
50 : namespace mozilla {
51 : namespace dom {
52 :
53 : enum class RTCStatsType : uint8_t {
54 : Inbound_rtp,
55 : Outbound_rtp,
56 : Csrc,
57 : Session,
58 : Track,
59 : Transport,
60 : Candidate_pair,
61 : Local_candidate,
62 : Remote_candidate,
63 : EndGuard_
64 : };
65 :
66 : namespace RTCStatsTypeValues {
67 : extern const EnumEntry strings[10];
68 : } // namespace RTCStatsTypeValues
69 :
70 : bool
71 : ToJSValue(JSContext* aCx, RTCStatsType aArgument, JS::MutableHandle<JS::Value> aValue);
72 :
73 :
74 : enum class RTCStatsIceCandidatePairState : uint8_t {
75 : Frozen,
76 : Waiting,
77 : Inprogress,
78 : Failed,
79 : Succeeded,
80 : Cancelled,
81 : EndGuard_
82 : };
83 :
84 : namespace RTCStatsIceCandidatePairStateValues {
85 : extern const EnumEntry strings[7];
86 : } // namespace RTCStatsIceCandidatePairStateValues
87 :
88 : bool
89 : ToJSValue(JSContext* aCx, RTCStatsIceCandidatePairState aArgument, JS::MutableHandle<JS::Value> aValue);
90 :
91 :
92 : enum class RTCStatsIceCandidateType : uint8_t {
93 : Host,
94 : Serverreflexive,
95 : Peerreflexive,
96 : Relayed,
97 : EndGuard_
98 : };
99 :
100 : namespace RTCStatsIceCandidateTypeValues {
101 : extern const EnumEntry strings[5];
102 : } // namespace RTCStatsIceCandidateTypeValues
103 :
104 : bool
105 : ToJSValue(JSContext* aCx, RTCStatsIceCandidateType aArgument, JS::MutableHandle<JS::Value> aValue);
106 :
107 :
108 0 : struct RTCStats : public DictionaryBase
109 : {
110 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mId;
111 : MOZ_INIT_OUTSIDE_CTOR Optional<double> mTimestamp;
112 : MOZ_INIT_OUTSIDE_CTOR Optional<RTCStatsType> mType;
113 :
114 : RTCStats();
115 :
116 0 : explicit inline RTCStats(const FastDictionaryInitializer& )
117 0 : {
118 : // Do nothing here; this is used by our "Fast" subclass
119 0 : }
120 :
121 : explicit inline RTCStats(const RTCStats& aOther)
122 : {
123 : *this = aOther;
124 : }
125 :
126 : bool
127 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
128 :
129 : bool
130 : Init(const nsAString& aJSON);
131 :
132 : bool
133 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
134 :
135 : bool
136 : ToJSON(nsAString& aJSON) const;
137 :
138 : void
139 : TraceDictionary(JSTracer* trc);
140 :
141 : RTCStats&
142 : operator=(const RTCStats& aOther);
143 :
144 : private:
145 : static bool
146 : InitIds(JSContext* cx, RTCStatsAtoms* atomsCache);
147 : };
148 :
149 : namespace binding_detail {
150 : struct FastRTCStats : public RTCStats
151 : {
152 : inline FastRTCStats()
153 : : RTCStats(FastDictionaryInitializer())
154 : {
155 : // Doesn't matter what int we pass to the parent constructor
156 : }
157 : };
158 : } // namespace binding_detail
159 :
160 :
161 0 : struct RTCCodecStats : public RTCStats
162 : {
163 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mChannels;
164 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mClockRate;
165 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mCodec;
166 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mParameters;
167 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mPayloadType;
168 :
169 : RTCCodecStats();
170 :
171 : explicit inline RTCCodecStats(const FastDictionaryInitializer& )
172 : : RTCStats(FastDictionaryInitializer())
173 : {
174 : // Do nothing here; this is used by our "Fast" subclass
175 : }
176 :
177 0 : explicit inline RTCCodecStats(const RTCCodecStats& aOther)
178 0 : {
179 0 : *this = aOther;
180 0 : }
181 :
182 : bool
183 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
184 :
185 : bool
186 : Init(const nsAString& aJSON);
187 :
188 : bool
189 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
190 :
191 : bool
192 : ToJSON(nsAString& aJSON) const;
193 :
194 : void
195 : TraceDictionary(JSTracer* trc);
196 :
197 : RTCCodecStats&
198 : operator=(const RTCCodecStats& aOther);
199 :
200 : private:
201 : static bool
202 : InitIds(JSContext* cx, RTCCodecStatsAtoms* atomsCache);
203 : };
204 :
205 : namespace binding_detail {
206 : struct FastRTCCodecStats : public RTCCodecStats
207 : {
208 : inline FastRTCCodecStats()
209 : : RTCCodecStats(FastDictionaryInitializer())
210 : {
211 : // Doesn't matter what int we pass to the parent constructor
212 : }
213 : };
214 : } // namespace binding_detail
215 :
216 :
217 0 : struct RTCIceCandidatePairStats : public RTCStats
218 : {
219 : MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBytesReceived;
220 : MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBytesSent;
221 : MOZ_INIT_OUTSIDE_CTOR Optional<double> mLastPacketReceivedTimestamp;
222 : MOZ_INIT_OUTSIDE_CTOR Optional<double> mLastPacketSentTimestamp;
223 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mLocalCandidateId;
224 : MOZ_INIT_OUTSIDE_CTOR Optional<bool> mNominated;
225 : MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mPriority;
226 : MOZ_INIT_OUTSIDE_CTOR Optional<bool> mReadable;
227 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mRemoteCandidateId;
228 : MOZ_INIT_OUTSIDE_CTOR Optional<bool> mSelected;
229 : MOZ_INIT_OUTSIDE_CTOR Optional<RTCStatsIceCandidatePairState> mState;
230 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mTransportId;
231 : MOZ_INIT_OUTSIDE_CTOR Optional<bool> mWritable;
232 :
233 : RTCIceCandidatePairStats();
234 :
235 : explicit inline RTCIceCandidatePairStats(const FastDictionaryInitializer& )
236 : : RTCStats(FastDictionaryInitializer())
237 : {
238 : // Do nothing here; this is used by our "Fast" subclass
239 : }
240 :
241 0 : explicit inline RTCIceCandidatePairStats(const RTCIceCandidatePairStats& aOther)
242 0 : {
243 0 : *this = aOther;
244 0 : }
245 :
246 : bool
247 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
248 :
249 : bool
250 : Init(const nsAString& aJSON);
251 :
252 : bool
253 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
254 :
255 : bool
256 : ToJSON(nsAString& aJSON) const;
257 :
258 : void
259 : TraceDictionary(JSTracer* trc);
260 :
261 : RTCIceCandidatePairStats&
262 : operator=(const RTCIceCandidatePairStats& aOther);
263 :
264 : private:
265 : static bool
266 : InitIds(JSContext* cx, RTCIceCandidatePairStatsAtoms* atomsCache);
267 : };
268 :
269 : namespace binding_detail {
270 : struct FastRTCIceCandidatePairStats : public RTCIceCandidatePairStats
271 : {
272 : inline FastRTCIceCandidatePairStats()
273 : : RTCIceCandidatePairStats(FastDictionaryInitializer())
274 : {
275 : // Doesn't matter what int we pass to the parent constructor
276 : }
277 : };
278 : } // namespace binding_detail
279 :
280 :
281 0 : struct RTCIceCandidateStats : public RTCStats
282 : {
283 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mCandidateId;
284 : MOZ_INIT_OUTSIDE_CTOR Optional<RTCStatsIceCandidateType> mCandidateType;
285 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mComponentId;
286 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mIpAddress;
287 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mMozLocalTransport;
288 : MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mPortNumber;
289 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mTransport;
290 :
291 : RTCIceCandidateStats();
292 :
293 : explicit inline RTCIceCandidateStats(const FastDictionaryInitializer& )
294 : : RTCStats(FastDictionaryInitializer())
295 : {
296 : // Do nothing here; this is used by our "Fast" subclass
297 : }
298 :
299 0 : explicit inline RTCIceCandidateStats(const RTCIceCandidateStats& aOther)
300 0 : {
301 0 : *this = aOther;
302 0 : }
303 :
304 : bool
305 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
306 :
307 : bool
308 : Init(const nsAString& aJSON);
309 :
310 : bool
311 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
312 :
313 : bool
314 : ToJSON(nsAString& aJSON) const;
315 :
316 : void
317 : TraceDictionary(JSTracer* trc);
318 :
319 : RTCIceCandidateStats&
320 : operator=(const RTCIceCandidateStats& aOther);
321 :
322 : private:
323 : static bool
324 : InitIds(JSContext* cx, RTCIceCandidateStatsAtoms* atomsCache);
325 : };
326 :
327 : namespace binding_detail {
328 : struct FastRTCIceCandidateStats : public RTCIceCandidateStats
329 : {
330 : inline FastRTCIceCandidateStats()
331 : : RTCIceCandidateStats(FastDictionaryInitializer())
332 : {
333 : // Doesn't matter what int we pass to the parent constructor
334 : }
335 : };
336 : } // namespace binding_detail
337 :
338 :
339 0 : struct RTCIceComponentStats : public RTCStats
340 : {
341 : MOZ_INIT_OUTSIDE_CTOR Optional<bool> mActiveConnection;
342 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mBytesReceived;
343 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mBytesSent;
344 : MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mComponent;
345 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mTransportId;
346 :
347 : RTCIceComponentStats();
348 :
349 : explicit inline RTCIceComponentStats(const FastDictionaryInitializer& )
350 : : RTCStats(FastDictionaryInitializer())
351 : {
352 : // Do nothing here; this is used by our "Fast" subclass
353 : }
354 :
355 0 : explicit inline RTCIceComponentStats(const RTCIceComponentStats& aOther)
356 0 : {
357 0 : *this = aOther;
358 0 : }
359 :
360 : bool
361 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
362 :
363 : bool
364 : Init(const nsAString& aJSON);
365 :
366 : bool
367 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
368 :
369 : bool
370 : ToJSON(nsAString& aJSON) const;
371 :
372 : void
373 : TraceDictionary(JSTracer* trc);
374 :
375 : RTCIceComponentStats&
376 : operator=(const RTCIceComponentStats& aOther);
377 :
378 : private:
379 : static bool
380 : InitIds(JSContext* cx, RTCIceComponentStatsAtoms* atomsCache);
381 : };
382 :
383 : namespace binding_detail {
384 : struct FastRTCIceComponentStats : public RTCIceComponentStats
385 : {
386 : inline FastRTCIceComponentStats()
387 : : RTCIceComponentStats(FastDictionaryInitializer())
388 : {
389 : // Doesn't matter what int we pass to the parent constructor
390 : }
391 : };
392 : } // namespace binding_detail
393 :
394 :
395 0 : struct RTCMediaStreamStats : public RTCStats
396 : {
397 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mStreamIdentifier;
398 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<nsString>> mTrackIds;
399 :
400 : RTCMediaStreamStats();
401 :
402 : explicit inline RTCMediaStreamStats(const FastDictionaryInitializer& )
403 : : RTCStats(FastDictionaryInitializer())
404 : {
405 : // Do nothing here; this is used by our "Fast" subclass
406 : }
407 :
408 0 : explicit inline RTCMediaStreamStats(const RTCMediaStreamStats& aOther)
409 0 : {
410 0 : *this = aOther;
411 0 : }
412 :
413 : bool
414 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
415 :
416 : bool
417 : Init(const nsAString& aJSON);
418 :
419 : bool
420 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
421 :
422 : bool
423 : ToJSON(nsAString& aJSON) const;
424 :
425 : void
426 : TraceDictionary(JSTracer* trc);
427 :
428 : RTCMediaStreamStats&
429 : operator=(const RTCMediaStreamStats& aOther);
430 :
431 : private:
432 : static bool
433 : InitIds(JSContext* cx, RTCMediaStreamStatsAtoms* atomsCache);
434 : };
435 :
436 : namespace binding_detail {
437 : struct FastRTCMediaStreamStats : public RTCMediaStreamStats
438 : {
439 : inline FastRTCMediaStreamStats()
440 : : RTCMediaStreamStats(FastDictionaryInitializer())
441 : {
442 : // Doesn't matter what int we pass to the parent constructor
443 : }
444 : };
445 : } // namespace binding_detail
446 :
447 :
448 0 : struct RTCMediaStreamTrackStats : public RTCStats
449 : {
450 : MOZ_INIT_OUTSIDE_CTOR Optional<double> mAudioLevel;
451 : MOZ_INIT_OUTSIDE_CTOR Optional<double> mEchoReturnLoss;
452 : MOZ_INIT_OUTSIDE_CTOR Optional<double> mEchoReturnLossEnhancement;
453 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFrameHeight;
454 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFrameWidth;
455 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFramesCorrupted;
456 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFramesDecoded;
457 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFramesDropped;
458 : MOZ_INIT_OUTSIDE_CTOR Optional<double> mFramesPerSecond;
459 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFramesReceived;
460 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFramesSent;
461 : MOZ_INIT_OUTSIDE_CTOR Optional<bool> mRemoteSource;
462 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<nsString>> mSsrcIds;
463 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mTrackIdentifier;
464 :
465 : RTCMediaStreamTrackStats();
466 :
467 : explicit inline RTCMediaStreamTrackStats(const FastDictionaryInitializer& )
468 : : RTCStats(FastDictionaryInitializer())
469 : {
470 : // Do nothing here; this is used by our "Fast" subclass
471 : }
472 :
473 0 : explicit inline RTCMediaStreamTrackStats(const RTCMediaStreamTrackStats& aOther)
474 0 : {
475 0 : *this = aOther;
476 0 : }
477 :
478 : bool
479 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
480 :
481 : bool
482 : Init(const nsAString& aJSON);
483 :
484 : bool
485 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
486 :
487 : bool
488 : ToJSON(nsAString& aJSON) const;
489 :
490 : void
491 : TraceDictionary(JSTracer* trc);
492 :
493 : RTCMediaStreamTrackStats&
494 : operator=(const RTCMediaStreamTrackStats& aOther);
495 :
496 : private:
497 : static bool
498 : InitIds(JSContext* cx, RTCMediaStreamTrackStatsAtoms* atomsCache);
499 : };
500 :
501 : namespace binding_detail {
502 : struct FastRTCMediaStreamTrackStats : public RTCMediaStreamTrackStats
503 : {
504 : inline FastRTCMediaStreamTrackStats()
505 : : RTCMediaStreamTrackStats(FastDictionaryInitializer())
506 : {
507 : // Doesn't matter what int we pass to the parent constructor
508 : }
509 : };
510 : } // namespace binding_detail
511 :
512 :
513 0 : struct RTCRTPContributingSourceStats : public RTCStats
514 : {
515 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mContributorSsrc;
516 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mInboundRtpStreamId;
517 :
518 : RTCRTPContributingSourceStats();
519 :
520 : explicit inline RTCRTPContributingSourceStats(const FastDictionaryInitializer& )
521 : : RTCStats(FastDictionaryInitializer())
522 : {
523 : // Do nothing here; this is used by our "Fast" subclass
524 : }
525 :
526 0 : explicit inline RTCRTPContributingSourceStats(const RTCRTPContributingSourceStats& aOther)
527 0 : {
528 0 : *this = aOther;
529 0 : }
530 :
531 : bool
532 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
533 :
534 : bool
535 : Init(const nsAString& aJSON);
536 :
537 : bool
538 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
539 :
540 : bool
541 : ToJSON(nsAString& aJSON) const;
542 :
543 : void
544 : TraceDictionary(JSTracer* trc);
545 :
546 : RTCRTPContributingSourceStats&
547 : operator=(const RTCRTPContributingSourceStats& aOther);
548 :
549 : private:
550 : static bool
551 : InitIds(JSContext* cx, RTCRTPContributingSourceStatsAtoms* atomsCache);
552 : };
553 :
554 : namespace binding_detail {
555 : struct FastRTCRTPContributingSourceStats : public RTCRTPContributingSourceStats
556 : {
557 : inline FastRTCRTPContributingSourceStats()
558 : : RTCRTPContributingSourceStats(FastDictionaryInitializer())
559 : {
560 : // Doesn't matter what int we pass to the parent constructor
561 : }
562 : };
563 : } // namespace binding_detail
564 :
565 :
566 0 : struct RTCRTPStreamStats : public RTCStats
567 : {
568 : MOZ_INIT_OUTSIDE_CTOR Optional<double> mBitrateMean;
569 : MOZ_INIT_OUTSIDE_CTOR Optional<double> mBitrateStdDev;
570 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mCodecId;
571 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFirCount;
572 : MOZ_INIT_OUTSIDE_CTOR Optional<double> mFramerateMean;
573 : MOZ_INIT_OUTSIDE_CTOR Optional<double> mFramerateStdDev;
574 : MOZ_INIT_OUTSIDE_CTOR bool mIsRemote;
575 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mMediaTrackId;
576 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mMediaType;
577 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mNackCount;
578 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mPliCount;
579 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mRemoteId;
580 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mSsrc;
581 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mTransportId;
582 :
583 : RTCRTPStreamStats();
584 :
585 0 : explicit inline RTCRTPStreamStats(const FastDictionaryInitializer& )
586 0 : : RTCStats(FastDictionaryInitializer())
587 : {
588 : // Do nothing here; this is used by our "Fast" subclass
589 0 : }
590 :
591 : explicit inline RTCRTPStreamStats(const RTCRTPStreamStats& aOther)
592 : {
593 : *this = aOther;
594 : }
595 :
596 : bool
597 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
598 :
599 : bool
600 : Init(const nsAString& aJSON);
601 :
602 : bool
603 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
604 :
605 : bool
606 : ToJSON(nsAString& aJSON) const;
607 :
608 : void
609 : TraceDictionary(JSTracer* trc);
610 :
611 : RTCRTPStreamStats&
612 : operator=(const RTCRTPStreamStats& aOther);
613 :
614 : private:
615 : static bool
616 : InitIds(JSContext* cx, RTCRTPStreamStatsAtoms* atomsCache);
617 : };
618 :
619 : namespace binding_detail {
620 : struct FastRTCRTPStreamStats : public RTCRTPStreamStats
621 : {
622 : inline FastRTCRTPStreamStats()
623 : : RTCRTPStreamStats(FastDictionaryInitializer())
624 : {
625 : // Doesn't matter what int we pass to the parent constructor
626 : }
627 : };
628 : } // namespace binding_detail
629 :
630 :
631 0 : struct RTCTransportStats : public RTCStats
632 : {
633 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mBytesReceived;
634 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mBytesSent;
635 :
636 : RTCTransportStats();
637 :
638 : explicit inline RTCTransportStats(const FastDictionaryInitializer& )
639 : : RTCStats(FastDictionaryInitializer())
640 : {
641 : // Do nothing here; this is used by our "Fast" subclass
642 : }
643 :
644 0 : explicit inline RTCTransportStats(const RTCTransportStats& aOther)
645 0 : {
646 0 : *this = aOther;
647 0 : }
648 :
649 : bool
650 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
651 :
652 : bool
653 : Init(const nsAString& aJSON);
654 :
655 : bool
656 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
657 :
658 : bool
659 : ToJSON(nsAString& aJSON) const;
660 :
661 : void
662 : TraceDictionary(JSTracer* trc);
663 :
664 : RTCTransportStats&
665 : operator=(const RTCTransportStats& aOther);
666 :
667 : private:
668 : static bool
669 : InitIds(JSContext* cx, RTCTransportStatsAtoms* atomsCache);
670 : };
671 :
672 : namespace binding_detail {
673 : struct FastRTCTransportStats : public RTCTransportStats
674 : {
675 : inline FastRTCTransportStats()
676 : : RTCTransportStats(FastDictionaryInitializer())
677 : {
678 : // Doesn't matter what int we pass to the parent constructor
679 : }
680 : };
681 : } // namespace binding_detail
682 :
683 :
684 0 : struct RTCInboundRTPStreamStats : public RTCRTPStreamStats
685 : {
686 : MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBytesReceived;
687 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mDiscardedPackets;
688 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFramesDecoded;
689 : MOZ_INIT_OUTSIDE_CTOR Optional<double> mJitter;
690 : MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mMozAvSyncDelay;
691 : MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mMozJitterBufferDelay;
692 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mPacketsLost;
693 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mPacketsReceived;
694 : MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mRoundTripTime;
695 :
696 : RTCInboundRTPStreamStats();
697 :
698 : explicit inline RTCInboundRTPStreamStats(const FastDictionaryInitializer& )
699 : : RTCRTPStreamStats(FastDictionaryInitializer())
700 : {
701 : // Do nothing here; this is used by our "Fast" subclass
702 : }
703 :
704 0 : explicit inline RTCInboundRTPStreamStats(const RTCInboundRTPStreamStats& aOther)
705 0 : {
706 0 : *this = aOther;
707 0 : }
708 :
709 : bool
710 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
711 :
712 : bool
713 : Init(const nsAString& aJSON);
714 :
715 : bool
716 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
717 :
718 : bool
719 : ToJSON(nsAString& aJSON) const;
720 :
721 : void
722 : TraceDictionary(JSTracer* trc);
723 :
724 : RTCInboundRTPStreamStats&
725 : operator=(const RTCInboundRTPStreamStats& aOther);
726 :
727 : private:
728 : static bool
729 : InitIds(JSContext* cx, RTCInboundRTPStreamStatsAtoms* atomsCache);
730 : };
731 :
732 : namespace binding_detail {
733 : struct FastRTCInboundRTPStreamStats : public RTCInboundRTPStreamStats
734 : {
735 : inline FastRTCInboundRTPStreamStats()
736 : : RTCInboundRTPStreamStats(FastDictionaryInitializer())
737 : {
738 : // Doesn't matter what int we pass to the parent constructor
739 : }
740 : };
741 : } // namespace binding_detail
742 :
743 :
744 0 : struct RTCOutboundRTPStreamStats : public RTCRTPStreamStats
745 : {
746 : MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBytesSent;
747 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mDroppedFrames;
748 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFramesEncoded;
749 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mPacketsSent;
750 : MOZ_INIT_OUTSIDE_CTOR Optional<double> mTargetBitrate;
751 :
752 : RTCOutboundRTPStreamStats();
753 :
754 : explicit inline RTCOutboundRTPStreamStats(const FastDictionaryInitializer& )
755 : : RTCRTPStreamStats(FastDictionaryInitializer())
756 : {
757 : // Do nothing here; this is used by our "Fast" subclass
758 : }
759 :
760 0 : explicit inline RTCOutboundRTPStreamStats(const RTCOutboundRTPStreamStats& aOther)
761 0 : {
762 0 : *this = aOther;
763 0 : }
764 :
765 : bool
766 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
767 :
768 : bool
769 : Init(const nsAString& aJSON);
770 :
771 : bool
772 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
773 :
774 : bool
775 : ToJSON(nsAString& aJSON) const;
776 :
777 : void
778 : TraceDictionary(JSTracer* trc);
779 :
780 : RTCOutboundRTPStreamStats&
781 : operator=(const RTCOutboundRTPStreamStats& aOther);
782 :
783 : private:
784 : static bool
785 : InitIds(JSContext* cx, RTCOutboundRTPStreamStatsAtoms* atomsCache);
786 : };
787 :
788 : namespace binding_detail {
789 : struct FastRTCOutboundRTPStreamStats : public RTCOutboundRTPStreamStats
790 : {
791 : inline FastRTCOutboundRTPStreamStats()
792 : : RTCOutboundRTPStreamStats(FastDictionaryInitializer())
793 : {
794 : // Doesn't matter what int we pass to the parent constructor
795 : }
796 : };
797 : } // namespace binding_detail
798 :
799 :
800 0 : struct RTCStatsReportInternal : public DictionaryBase
801 : {
802 : MOZ_INIT_OUTSIDE_CTOR Optional<bool> mClosed;
803 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCCodecStats>> mCodecStats;
804 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCIceCandidatePairStats>> mIceCandidatePairStats;
805 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCIceCandidateStats>> mIceCandidateStats;
806 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCIceComponentStats>> mIceComponentStats;
807 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mIceRestarts;
808 : MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mIceRollbacks;
809 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCInboundRTPStreamStats>> mInboundRTPStreamStats;
810 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mLocalSdp;
811 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCMediaStreamStats>> mMediaStreamStats;
812 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCMediaStreamTrackStats>> mMediaStreamTrackStats;
813 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCOutboundRTPStreamStats>> mOutboundRTPStreamStats;
814 : MOZ_INIT_OUTSIDE_CTOR nsString mPcid;
815 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mRemoteSdp;
816 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCRTPContributingSourceStats>> mRtpContributingSourceStats;
817 : MOZ_INIT_OUTSIDE_CTOR Optional<double> mTimestamp;
818 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCTransportStats>> mTransportStats;
819 :
820 : RTCStatsReportInternal();
821 :
822 0 : explicit inline RTCStatsReportInternal(const FastDictionaryInitializer& )
823 0 : {
824 : // Do nothing here; this is used by our "Fast" subclass
825 0 : }
826 :
827 0 : explicit inline RTCStatsReportInternal(const RTCStatsReportInternal& aOther)
828 0 : {
829 0 : *this = aOther;
830 0 : }
831 :
832 : bool
833 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
834 :
835 : bool
836 : Init(const nsAString& aJSON);
837 :
838 : bool
839 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
840 :
841 : bool
842 : ToJSON(nsAString& aJSON) const;
843 :
844 : void
845 : TraceDictionary(JSTracer* trc);
846 :
847 : RTCStatsReportInternal&
848 : operator=(const RTCStatsReportInternal& aOther);
849 :
850 : private:
851 : static bool
852 : InitIds(JSContext* cx, RTCStatsReportInternalAtoms* atomsCache);
853 : };
854 :
855 : namespace binding_detail {
856 0 : struct FastRTCStatsReportInternal : public RTCStatsReportInternal
857 : {
858 0 : inline FastRTCStatsReportInternal()
859 0 : : RTCStatsReportInternal(FastDictionaryInitializer())
860 : {
861 : // Doesn't matter what int we pass to the parent constructor
862 0 : }
863 : };
864 : } // namespace binding_detail
865 :
866 :
867 : namespace RTCStatsReportBinding {
868 :
869 : typedef mozilla::dom::RTCStatsReport NativeType;
870 :
871 : namespace MaplikeHelpers {
872 : void
873 : Clear(mozilla::dom::RTCStatsReport* self, ErrorResult& aRv);
874 : bool
875 : Delete(mozilla::dom::RTCStatsReport* self, const nsAString& aKey, ErrorResult& aRv);
876 : bool
877 : Has(mozilla::dom::RTCStatsReport* self, const nsAString& aKey, ErrorResult& aRv);
878 : void
879 : Set(mozilla::dom::RTCStatsReport* self, const nsAString& aKey, JS::Handle<JSObject*> aValue, ErrorResult& aRv);
880 : } // namespace MaplikeHelpers
881 :
882 : bool
883 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
884 :
885 : JSObject*
886 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
887 :
888 : const JSClass*
889 : GetJSClass();
890 :
891 : bool
892 : Wrap(JSContext* aCx, mozilla::dom::RTCStatsReport* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
893 :
894 : template <class T>
895 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
896 : {
897 0 : JS::Rooted<JSObject*> reflector(aCx);
898 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
899 : }
900 :
901 : // We declare this as an array so that retrieving a pointer to this
902 : // binding's property hooks only requires compile/link-time resolvable
903 : // address arithmetic. Declaring it as a pointer instead would require
904 : // doing a run-time load to fetch a pointer to this binding's property
905 : // hooks. And then structures which embedded a pointer to this structure
906 : // would require a run-time load for proper initialization, which would
907 : // then induce static constructors. Lots of static constructors.
908 : extern const NativePropertyHooks sNativePropertyHooks[];
909 :
910 : void
911 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
912 :
913 : JS::Handle<JSObject*>
914 : GetProtoObjectHandle(JSContext* aCx);
915 :
916 : JS::Handle<JSObject*>
917 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
918 :
919 : JSObject*
920 : GetConstructorObject(JSContext* aCx);
921 :
922 : } // namespace RTCStatsReportBinding
923 :
924 :
925 :
926 0 : class RTCStatsReportJSImpl : public CallbackInterface
927 : {
928 : public:
929 0 : explicit inline RTCStatsReportJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
930 0 : : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
931 : {
932 0 : }
933 :
934 : explicit inline RTCStatsReportJSImpl(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
935 : : CallbackInterface(aCallback, FastCallbackConstructor())
936 : {
937 : }
938 :
939 : explicit inline RTCStatsReportJSImpl(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
940 : : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
941 : {
942 : }
943 :
944 : void Entries(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
945 :
946 : void Keys(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
947 :
948 : void Values(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
949 :
950 : void ForEach(JS::Handle<JSObject*> callback, JS::Handle<JS::Value> thisArg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
951 :
952 : bool Has(const nsAString& key, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
953 :
954 : void __clear(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
955 :
956 : bool __delete(const nsAString& key, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
957 :
958 : void Get(const nsAString& key, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
959 :
960 : void __set(const nsAString& key, JS::Handle<JSObject*> value, JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
961 :
962 : inline bool
963 : operator==(const RTCStatsReportJSImpl& aOther) const
964 : {
965 : return CallbackInterface::operator==(aOther);
966 : }
967 :
968 : void GetMozPcid(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
969 :
970 : uint32_t GetSize(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
971 :
972 : private:
973 : static bool
974 : InitIds(JSContext* cx, RTCStatsReportAtoms* atomsCache);
975 : };
976 :
977 :
978 : class RTCStatsReport final : public nsSupportsWeakReference,
979 : public nsWrapperCache
980 : {
981 : public:
982 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
983 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(RTCStatsReport)
984 :
985 : private:
986 : RefPtr<RTCStatsReportJSImpl> mImpl;
987 : nsCOMPtr<nsISupports> mParent;
988 :
989 : public:
990 : RTCStatsReport(JS::Handle<JSObject*> aJSImplObject, nsIGlobalObject* aParent);
991 :
992 : private:
993 : ~RTCStatsReport();
994 :
995 : public:
996 : nsISupports* GetParentObject() const;
997 :
998 : virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
999 :
1000 : void GetMozPcid(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
1001 :
1002 : uint32_t GetSize(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
1003 :
1004 : void Entries(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
1005 :
1006 : void Keys(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
1007 :
1008 : void Values(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
1009 :
1010 : void ForEach(JS::Handle<JSObject*> callback, JS::Handle<JS::Value> thisArg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
1011 :
1012 : bool Has(const nsAString& key, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
1013 :
1014 : void __clear(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
1015 :
1016 : bool __delete(const nsAString& key, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
1017 :
1018 : void Get(const nsAString& key, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
1019 :
1020 : void __set(const nsAString& key, JS::Handle<JSObject*> value, JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
1021 :
1022 : static bool
1023 : _Create(JSContext* cx, unsigned argc, JS::Value* vp);
1024 : };
1025 :
1026 :
1027 : } // namespace dom
1028 : } // namespace mozilla
1029 :
1030 : #endif // mozilla_dom_RTCStatsReportBinding_h
|