/* THIS FILE IS AUTOGENERATED FROM RTCStatsReport.webidl BY Codegen.py - DO NOT EDIT */

#ifndef mozilla_dom_RTCStatsReportBinding_h
#define mozilla_dom_RTCStatsReportBinding_h

#include "RTCStatsReportBinding.h"
#include "js/RootingAPI.h"
#include "jspubtd.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/CallbackInterface.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/ToJSValue.h"
#include "nsWeakReference.h"

namespace mozilla {
namespace dom {

struct NativePropertyHooks;
class ProtoAndIfaceCache;
struct RTCCodecStats;
struct RTCCodecStatsAtoms;
struct RTCIceCandidatePairStats;
struct RTCIceCandidatePairStatsAtoms;
struct RTCIceCandidateStats;
struct RTCIceCandidateStatsAtoms;
struct RTCIceComponentStats;
struct RTCIceComponentStatsAtoms;
struct RTCInboundRTPStreamStats;
struct RTCInboundRTPStreamStatsAtoms;
struct RTCMediaStreamStats;
struct RTCMediaStreamStatsAtoms;
struct RTCMediaStreamTrackStats;
struct RTCMediaStreamTrackStatsAtoms;
struct RTCOutboundRTPStreamStats;
struct RTCOutboundRTPStreamStatsAtoms;
struct RTCRTPStreamStatsAtoms;
struct RTCStatsAtoms;
class RTCStatsReport;
struct RTCStatsReportAtoms;
struct RTCStatsReportInternalAtoms;
struct RTCTransportStats;
struct RTCTransportStatsAtoms;

} // namespace dom
} // namespace mozilla

namespace mozilla {
namespace dom {

enum class RTCStatsType : uint32_t {
  Inbound_rtp,
  Outbound_rtp,
  Session,
  Track,
  Transport,
  Candidate_pair,
  Local_candidate,
  Remote_candidate,
  EndGuard_
};

namespace RTCStatsTypeValues {
extern const EnumEntry strings[9];
} // namespace RTCStatsTypeValues

bool
ToJSValue(JSContext* aCx, RTCStatsType aArgument, JS::MutableHandle<JS::Value> aValue);


enum class RTCStatsIceCandidatePairState : uint32_t {
  Frozen,
  Waiting,
  Inprogress,
  Failed,
  Succeeded,
  Cancelled,
  EndGuard_
};

namespace RTCStatsIceCandidatePairStateValues {
extern const EnumEntry strings[7];
} // namespace RTCStatsIceCandidatePairStateValues

bool
ToJSValue(JSContext* aCx, RTCStatsIceCandidatePairState aArgument, JS::MutableHandle<JS::Value> aValue);


enum class RTCStatsIceCandidateType : uint32_t {
  Host,
  Serverreflexive,
  Peerreflexive,
  Relayed,
  EndGuard_
};

namespace RTCStatsIceCandidateTypeValues {
extern const EnumEntry strings[5];
} // namespace RTCStatsIceCandidateTypeValues

bool
ToJSValue(JSContext* aCx, RTCStatsIceCandidateType aArgument, JS::MutableHandle<JS::Value> aValue);


struct RTCStats : public DictionaryBase
{
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mId;
  MOZ_INIT_OUTSIDE_CTOR Optional<double> mTimestamp;
  MOZ_INIT_OUTSIDE_CTOR Optional<RTCStatsType> mType;

  RTCStats();

  explicit inline RTCStats(const FastDictionaryInitializer& )
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline RTCStats(const RTCStats& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const RTCStats& aOther);

private:
  static bool
  InitIds(JSContext* cx, RTCStatsAtoms* atomsCache);
};

namespace binding_detail {
struct FastRTCStats : public RTCStats
{
  inline FastRTCStats()
    : RTCStats(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct RTCCodecStats : public RTCStats
{
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mChannels;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mClockRate;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mCodec;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mParameters;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mPayloadType;

  RTCCodecStats();

  explicit inline RTCCodecStats(const FastDictionaryInitializer& )
    : RTCStats(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline RTCCodecStats(const RTCCodecStats& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const RTCCodecStats& aOther);

private:
  static bool
  InitIds(JSContext* cx, RTCCodecStatsAtoms* atomsCache);
};

namespace binding_detail {
struct FastRTCCodecStats : public RTCCodecStats
{
  inline FastRTCCodecStats()
    : RTCCodecStats(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct RTCIceCandidatePairStats : public RTCStats
{
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mComponentId;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mLocalCandidateId;
  MOZ_INIT_OUTSIDE_CTOR Optional<bool> mNominated;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mPriority;
  MOZ_INIT_OUTSIDE_CTOR Optional<bool> mReadable;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mRemoteCandidateId;
  MOZ_INIT_OUTSIDE_CTOR Optional<bool> mSelected;
  MOZ_INIT_OUTSIDE_CTOR Optional<RTCStatsIceCandidatePairState> mState;

  RTCIceCandidatePairStats();

  explicit inline RTCIceCandidatePairStats(const FastDictionaryInitializer& )
    : RTCStats(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline RTCIceCandidatePairStats(const RTCIceCandidatePairStats& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const RTCIceCandidatePairStats& aOther);

private:
  static bool
  InitIds(JSContext* cx, RTCIceCandidatePairStatsAtoms* atomsCache);
};

namespace binding_detail {
struct FastRTCIceCandidatePairStats : public RTCIceCandidatePairStats
{
  inline FastRTCIceCandidatePairStats()
    : RTCIceCandidatePairStats(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct RTCIceCandidateStats : public RTCStats
{
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mCandidateId;
  MOZ_INIT_OUTSIDE_CTOR Optional<RTCStatsIceCandidateType> mCandidateType;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mComponentId;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mIpAddress;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mMozLocalTransport;
  MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mPortNumber;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mTransport;

  RTCIceCandidateStats();

  explicit inline RTCIceCandidateStats(const FastDictionaryInitializer& )
    : RTCStats(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline RTCIceCandidateStats(const RTCIceCandidateStats& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const RTCIceCandidateStats& aOther);

private:
  static bool
  InitIds(JSContext* cx, RTCIceCandidateStatsAtoms* atomsCache);
};

namespace binding_detail {
struct FastRTCIceCandidateStats : public RTCIceCandidateStats
{
  inline FastRTCIceCandidateStats()
    : RTCIceCandidateStats(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct RTCIceComponentStats : public RTCStats
{
  MOZ_INIT_OUTSIDE_CTOR Optional<bool> mActiveConnection;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mBytesReceived;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mBytesSent;
  MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mComponent;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mTransportId;

  RTCIceComponentStats();

  explicit inline RTCIceComponentStats(const FastDictionaryInitializer& )
    : RTCStats(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline RTCIceComponentStats(const RTCIceComponentStats& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const RTCIceComponentStats& aOther);

private:
  static bool
  InitIds(JSContext* cx, RTCIceComponentStatsAtoms* atomsCache);
};

namespace binding_detail {
struct FastRTCIceComponentStats : public RTCIceComponentStats
{
  inline FastRTCIceComponentStats()
    : RTCIceComponentStats(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct RTCMediaStreamStats : public RTCStats
{
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mStreamIdentifier;
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<nsString>> mTrackIds;

  RTCMediaStreamStats();

  explicit inline RTCMediaStreamStats(const FastDictionaryInitializer& )
    : RTCStats(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline RTCMediaStreamStats(const RTCMediaStreamStats& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const RTCMediaStreamStats& aOther);

private:
  static bool
  InitIds(JSContext* cx, RTCMediaStreamStatsAtoms* atomsCache);
};

namespace binding_detail {
struct FastRTCMediaStreamStats : public RTCMediaStreamStats
{
  inline FastRTCMediaStreamStats()
    : RTCMediaStreamStats(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct RTCMediaStreamTrackStats : public RTCStats
{
  MOZ_INIT_OUTSIDE_CTOR Optional<double> mAudioLevel;
  MOZ_INIT_OUTSIDE_CTOR Optional<double> mEchoReturnLoss;
  MOZ_INIT_OUTSIDE_CTOR Optional<double> mEchoReturnLossEnhancement;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFrameHeight;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFrameWidth;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFramesCorrupted;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFramesDecoded;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFramesDropped;
  MOZ_INIT_OUTSIDE_CTOR Optional<double> mFramesPerSecond;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFramesReceived;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFramesSent;
  MOZ_INIT_OUTSIDE_CTOR Optional<bool> mRemoteSource;
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<nsString>> mSsrcIds;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mTrackIdentifier;

  RTCMediaStreamTrackStats();

  explicit inline RTCMediaStreamTrackStats(const FastDictionaryInitializer& )
    : RTCStats(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline RTCMediaStreamTrackStats(const RTCMediaStreamTrackStats& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const RTCMediaStreamTrackStats& aOther);

private:
  static bool
  InitIds(JSContext* cx, RTCMediaStreamTrackStatsAtoms* atomsCache);
};

namespace binding_detail {
struct FastRTCMediaStreamTrackStats : public RTCMediaStreamTrackStats
{
  inline FastRTCMediaStreamTrackStats()
    : RTCMediaStreamTrackStats(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct RTCRTPStreamStats : public RTCStats
{
  MOZ_INIT_OUTSIDE_CTOR Optional<double> mBitrateMean;
  MOZ_INIT_OUTSIDE_CTOR Optional<double> mBitrateStdDev;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mCodecId;
  MOZ_INIT_OUTSIDE_CTOR Optional<double> mFramerateMean;
  MOZ_INIT_OUTSIDE_CTOR Optional<double> mFramerateStdDev;
  MOZ_INIT_OUTSIDE_CTOR bool mIsRemote;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mMediaTrackId;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mMediaType;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mRemoteId;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mSsrc;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mTransportId;

  RTCRTPStreamStats();

  explicit inline RTCRTPStreamStats(const FastDictionaryInitializer& )
    : RTCStats(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline RTCRTPStreamStats(const RTCRTPStreamStats& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const RTCRTPStreamStats& aOther);

private:
  static bool
  InitIds(JSContext* cx, RTCRTPStreamStatsAtoms* atomsCache);
};

namespace binding_detail {
struct FastRTCRTPStreamStats : public RTCRTPStreamStats
{
  inline FastRTCRTPStreamStats()
    : RTCRTPStreamStats(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct RTCTransportStats : public RTCStats
{
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mBytesReceived;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mBytesSent;

  RTCTransportStats();

  explicit inline RTCTransportStats(const FastDictionaryInitializer& )
    : RTCStats(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline RTCTransportStats(const RTCTransportStats& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const RTCTransportStats& aOther);

private:
  static bool
  InitIds(JSContext* cx, RTCTransportStatsAtoms* atomsCache);
};

namespace binding_detail {
struct FastRTCTransportStats : public RTCTransportStats
{
  inline FastRTCTransportStats()
    : RTCTransportStats(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct RTCInboundRTPStreamStats : public RTCRTPStreamStats
{
  MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBytesReceived;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mDiscardedPackets;
  MOZ_INIT_OUTSIDE_CTOR Optional<double> mJitter;
  MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mMozAvSyncDelay;
  MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mMozJitterBufferDelay;
  MOZ_INIT_OUTSIDE_CTOR Optional<int32_t> mMozRtt;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mPacketsLost;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mPacketsReceived;

  RTCInboundRTPStreamStats();

  explicit inline RTCInboundRTPStreamStats(const FastDictionaryInitializer& )
    : RTCRTPStreamStats(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline RTCInboundRTPStreamStats(const RTCInboundRTPStreamStats& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const RTCInboundRTPStreamStats& aOther);

private:
  static bool
  InitIds(JSContext* cx, RTCInboundRTPStreamStatsAtoms* atomsCache);
};

namespace binding_detail {
struct FastRTCInboundRTPStreamStats : public RTCInboundRTPStreamStats
{
  inline FastRTCInboundRTPStreamStats()
    : RTCInboundRTPStreamStats(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct RTCOutboundRTPStreamStats : public RTCRTPStreamStats
{
  MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBytesSent;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mDroppedFrames;
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mPacketsSent;
  MOZ_INIT_OUTSIDE_CTOR Optional<double> mTargetBitrate;

  RTCOutboundRTPStreamStats();

  explicit inline RTCOutboundRTPStreamStats(const FastDictionaryInitializer& )
    : RTCRTPStreamStats(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline RTCOutboundRTPStreamStats(const RTCOutboundRTPStreamStats& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const RTCOutboundRTPStreamStats& aOther);

private:
  static bool
  InitIds(JSContext* cx, RTCOutboundRTPStreamStatsAtoms* atomsCache);
};

namespace binding_detail {
struct FastRTCOutboundRTPStreamStats : public RTCOutboundRTPStreamStats
{
  inline FastRTCOutboundRTPStreamStats()
    : RTCOutboundRTPStreamStats(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct RTCStatsReportInternal : public DictionaryBase
{
  MOZ_INIT_OUTSIDE_CTOR Optional<bool> mClosed;
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCCodecStats>> mCodecStats;
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCIceCandidatePairStats>> mIceCandidatePairStats;
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCIceCandidateStats>> mIceCandidateStats;
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCIceComponentStats>> mIceComponentStats;
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCInboundRTPStreamStats>> mInboundRTPStreamStats;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mLocalSdp;
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCMediaStreamStats>> mMediaStreamStats;
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCMediaStreamTrackStats>> mMediaStreamTrackStats;
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCOutboundRTPStreamStats>> mOutboundRTPStreamStats;
  MOZ_INIT_OUTSIDE_CTOR nsString mPcid;
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mRemoteSdp;
  MOZ_INIT_OUTSIDE_CTOR Optional<double> mTimestamp;
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCTransportStats>> mTransportStats;

  RTCStatsReportInternal();

  explicit inline RTCStatsReportInternal(const FastDictionaryInitializer& )
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline RTCStatsReportInternal(const RTCStatsReportInternal& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const RTCStatsReportInternal& aOther);

private:
  static bool
  InitIds(JSContext* cx, RTCStatsReportInternalAtoms* atomsCache);
};

namespace binding_detail {
struct FastRTCStatsReportInternal : public RTCStatsReportInternal
{
  inline FastRTCStatsReportInternal()
    : RTCStatsReportInternal(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


namespace RTCStatsReportBinding {

  typedef mozilla::dom::RTCStatsReport NativeType;

  namespace MaplikeHelpers {
  void
  Clear(mozilla::dom::RTCStatsReport* self, ErrorResult& aRv);
  bool
  Delete(mozilla::dom::RTCStatsReport* self, const nsAString& aKey, ErrorResult& aRv);
  bool
  Has(mozilla::dom::RTCStatsReport* self, const nsAString& aKey, ErrorResult& aRv);
  void
  Set(mozilla::dom::RTCStatsReport* self, const nsAString& aKey, JS::Handle<JSObject*> aValue, ErrorResult& aRv);
  } // namespace MaplikeHelpers

  bool
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);

  JSObject*
  DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);

  const JSClass*
  GetJSClass();

  bool
  Wrap(JSContext* aCx, mozilla::dom::RTCStatsReport* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);

  template <class T>
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
  {
    JS::Rooted<JSObject*> reflector(aCx);
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
  }

  // We declare this as an array so that retrieving a pointer to this
  // binding's property hooks only requires compile/link-time resolvable
  // address arithmetic.  Declaring it as a pointer instead would require
  // doing a run-time load to fetch a pointer to this binding's property
  // hooks.  And then structures which embedded a pointer to this structure
  // would require a run-time load for proper initialization, which would
  // then induce static constructors.  Lots of static constructors.
  extern const NativePropertyHooks sNativePropertyHooks[];

  void
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);

  JS::Handle<JSObject*>
  GetProtoObjectHandle(JSContext* aCx);

  JS::Handle<JSObject*>
  GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);

  JSObject*
  GetConstructorObject(JSContext* aCx);

} // namespace RTCStatsReportBinding



class RTCStatsReportJSImpl : public CallbackInterface
{
public:
  explicit inline RTCStatsReportJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
    : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
  {
  }

  explicit inline RTCStatsReportJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal, const FastCallbackConstructor& )
    : CallbackInterface(aCx, aCallback, aIncumbentGlobal, FastCallbackConstructor())
  {
  }

  explicit inline RTCStatsReportJSImpl(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
    : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
  {
  }

  void Entries(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void Keys(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void Values(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void ForEach(JS::Handle<JSObject*> callback, JS::Handle<JS::Value> thisArg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  bool Has(const nsAString& key, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void __clear(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  bool __delete(const nsAString& key, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void Get(const nsAString& key, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void __set(const nsAString& key, JS::Handle<JSObject*> value, JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  inline bool
  operator==(const RTCStatsReportJSImpl& aOther) const
  {
    return CallbackInterface::operator==(aOther);
  }

  void GetMozPcid(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  uint32_t GetSize(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

private:
  static bool
  InitIds(JSContext* cx, RTCStatsReportAtoms* atomsCache);
};


class RTCStatsReport final : public nsSupportsWeakReference,
                             public nsWrapperCache
{
public:
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(RTCStatsReport)

private:
  RefPtr<RTCStatsReportJSImpl> mImpl;
  nsCOMPtr<nsIGlobalObject> mParent;

public:
  RTCStatsReport(JS::Handle<JSObject*> aJSImplObject, nsIGlobalObject* aParent);

private:
  ~RTCStatsReport();

public:
  nsISupports* GetParentObject() const;

  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;

  void GetMozPcid(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;

  uint32_t GetSize(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;

  void Entries(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void Keys(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void Values(JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void ForEach(JS::Handle<JSObject*> callback, JS::Handle<JS::Value> thisArg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  bool Has(const nsAString& key, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void __clear(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  bool __delete(const nsAString& key, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void Get(const nsAString& key, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void __set(const nsAString& key, JS::Handle<JSObject*> value, JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  static bool
  _Create(JSContext* cx, unsigned argc, JS::Value* vp);
};


} // namespace dom
} // namespace mozilla

#endif // mozilla_dom_RTCStatsReportBinding_h
