/* THIS FILE IS AUTOGENERATED FROM WebTransport.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_WEBTRANSPORTBINDING_H_
#define DOM_WEBTRANSPORTBINDING_H_
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/EnumTypeTraits.h"
#include "mozilla/Span.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrototypeList.h"
#include "mozilla/dom/RootedDictionary.h"
#include "mozilla/dom/UnionTypes.h"
#include "mozilla/dom/WebTransportSendGroup.h"
#include "nsCycleCollectionParticipant.h"
namespace mozilla {
namespace dom {
class ArrayBufferViewOrArrayBuffer;
struct NativePropertyHooks;
class OwningArrayBufferViewOrArrayBuffer;
class ProtoAndIfaceCache;
class WebTransport;
struct WebTransportCloseInfoAtoms;
struct WebTransportConnectionStatsAtoms;
struct WebTransportDatagramStats;
struct WebTransportDatagramStatsAtoms;
struct WebTransportHash;
struct WebTransportHashAtoms;
struct WebTransportOptionsAtoms;
class WebTransportSendGroup;
struct WebTransportSendOptionsAtoms;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
enum class WebTransportCongestionControl : uint8_t {
Default,
Throughput,
Low_latency,
};
namespace binding_detail {
template <> struct EnumStrings<WebTransportCongestionControl> {
static constexpr nsLiteralCString Values[3] {
"default"_ns,
"throughput"_ns,
"low-latency"_ns,
};
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, WebTransportCongestionControl aArgument, JS::MutableHandle<JS::Value> aValue);
enum class WebTransportReliabilityMode : uint8_t {
Pending,
Reliable_only,
Supports_unreliable,
};
namespace binding_detail {
template <> struct EnumStrings<WebTransportReliabilityMode> {
static constexpr nsLiteralCString Values[3] {
"pending"_ns,
"reliable-only"_ns,
"supports-unreliable"_ns,
};
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, WebTransportReliabilityMode aArgument, JS::MutableHandle<JS::Value> aValue);
struct MOZ_EMPTY_BASES WebTransportCloseInfo : public MaybeEmptyDictionaryBase
{
uint32_t mCloseCode = 0U;
MOZ_INIT_OUTSIDE_CTOR nsCString mReason;
WebTransportCloseInfo();
explicit inline WebTransportCloseInfo(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
WebTransportCloseInfo(WebTransportCloseInfo&& aOther) = default;
explicit inline WebTransportCloseInfo(const WebTransportCloseInfo& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
WebTransportCloseInfo&
operator=(const WebTransportCloseInfo& aOther);
private:
static bool
InitIds(JSContext* cx, WebTransportCloseInfoAtoms* atomsCache);
};
namespace binding_detail {
struct MOZ_EMPTY_BASES FastWebTransportCloseInfo : public WebTransportCloseInfo
{
inline FastWebTransportCloseInfo()
: WebTransportCloseInfo(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MOZ_EMPTY_BASES WebTransportDatagramStats : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mDroppedIncoming;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mExpiredIncoming;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mExpiredOutgoing;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mLostOutgoing;
WebTransportDatagramStats();
explicit inline WebTransportDatagramStats(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
WebTransportDatagramStats(WebTransportDatagramStats&& aOther) = default;
explicit inline WebTransportDatagramStats(const WebTransportDatagramStats& aOther)
{
*this = aOther;
}
bool
Init(const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
WebTransportDatagramStats&
operator=(const WebTransportDatagramStats& aOther);
private:
static bool
InitIds(JSContext* cx, WebTransportDatagramStatsAtoms* atomsCache);
};
namespace binding_detail {
struct MOZ_EMPTY_BASES FastWebTransportDatagramStats : public WebTransportDatagramStats
{
inline FastWebTransportDatagramStats()
: WebTransportDatagramStats(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MOZ_EMPTY_BASES WebTransportHash : public MaybeEmptyDictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR nsString mAlgorithm;
MOZ_INIT_OUTSIDE_CTOR OwningArrayBufferViewOrArrayBuffer mValue;
WebTransportHash();
explicit inline WebTransportHash(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
WebTransportHash(WebTransportHash&& aOther) = default;
private:
WebTransportHash(const WebTransportHash&) = delete;
WebTransportHash& operator=(const WebTransportHash&) = delete;
static bool
InitIds(JSContext* cx, WebTransportHashAtoms* atomsCache);
public:
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
TraceDictionary(JSTracer* trc);
};
namespace binding_detail {
struct MOZ_EMPTY_BASES FastWebTransportHash : public WebTransportHash
{
inline FastWebTransportHash()
: WebTransportHash(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MOZ_EMPTY_BASES WebTransportSendOptions : public MaybeEmptyDictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR RefPtr<mozilla::dom::WebTransportSendGroup> mSendGroup;
int64_t mSendOrder = 0LL;
WebTransportSendOptions();
explicit inline WebTransportSendOptions(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
WebTransportSendOptions(WebTransportSendOptions&& aOther) = default;
explicit inline WebTransportSendOptions(const WebTransportSendOptions& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
TraceDictionary(JSTracer* trc);
inline void
TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
{
ImplCycleCollectionTraverse(aCallback, mSendGroup, "mSendGroup", aFlags);
}
inline void
UnlinkForCC()
{
ImplCycleCollectionUnlink(mSendGroup);
}
WebTransportSendOptions&
operator=(const WebTransportSendOptions& aOther);
private:
static bool
InitIds(JSContext* cx, WebTransportSendOptionsAtoms* atomsCache);
};
namespace binding_detail {
struct MOZ_EMPTY_BASES FastWebTransportSendOptions : public WebTransportSendOptions
{
inline FastWebTransportSendOptions()
: WebTransportSendOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MOZ_EMPTY_BASES WebTransportConnectionStats : public DictionaryBase
{
bool mAtSendCapacity = false;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBytesAcknowledged;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBytesLost;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBytesReceived;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBytesSent;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBytesSentOverhead;
MOZ_INIT_OUTSIDE_CTOR WebTransportDatagramStats mDatagrams;
MOZ_INIT_OUTSIDE_CTOR Nullable<uint64_t> mEstimatedSendRate;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mMinRtt;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mPacketsLost;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mPacketsReceived;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mPacketsSent;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mRttVariation;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mSmoothedRtt;
WebTransportConnectionStats();
explicit inline WebTransportConnectionStats(const FastDictionaryInitializer& )
: mDatagrams(FastDictionaryInitializer())
{
// Do nothing here; this is used by our "Fast" subclass
}
WebTransportConnectionStats(WebTransportConnectionStats&& aOther) = default;
explicit inline WebTransportConnectionStats(const WebTransportConnectionStats& aOther)
: mDatagrams(FastDictionaryInitializer())
{
*this = aOther;
}
bool
Init(const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
WebTransportConnectionStats&
operator=(const WebTransportConnectionStats& aOther);
private:
static bool
InitIds(JSContext* cx, WebTransportConnectionStatsAtoms* atomsCache);
};
namespace binding_detail {
struct MOZ_EMPTY_BASES FastWebTransportConnectionStats : public WebTransportConnectionStats
{
inline FastWebTransportConnectionStats()
: WebTransportConnectionStats(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MOZ_EMPTY_BASES WebTransportOptions : public MaybeEmptyDictionaryBase
{
bool mAllowPooling = false;
WebTransportCongestionControl mCongestionControl = {};
MOZ_INIT_OUTSIDE_CTOR Sequence<nsString> mProtocols;
bool mRequireUnreliable = false;
MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<WebTransportHash>> mServerCertificateHashes;
WebTransportOptions();
explicit inline WebTransportOptions(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
WebTransportOptions(WebTransportOptions&& aOther) = default;
private:
WebTransportOptions(const WebTransportOptions&) = delete;
WebTransportOptions& operator=(const WebTransportOptions&) = delete;
static bool
InitIds(JSContext* cx, WebTransportOptionsAtoms* atomsCache);
public:
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
TraceDictionary(JSTracer* trc);
};
namespace binding_detail {
struct MOZ_EMPTY_BASES FastWebTransportOptions : public WebTransportOptions
{
inline FastWebTransportOptions()
: WebTransportOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MOZ_EMPTY_BASES WebTransportSendStreamOptions : public WebTransportSendOptions
{
WebTransportSendStreamOptions();
explicit inline WebTransportSendStreamOptions(const FastDictionaryInitializer& )
: WebTransportSendOptions(FastDictionaryInitializer())
{
// Do nothing here; this is used by our "Fast" subclass
}
WebTransportSendStreamOptions(WebTransportSendStreamOptions&& aOther) = default;
explicit inline WebTransportSendStreamOptions(const WebTransportSendStreamOptions& aOther)
: WebTransportSendOptions(FastDictionaryInitializer())
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
TraceDictionary(JSTracer* trc);
inline void
TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
{
WebTransportSendOptions::TraverseForCC(aCallback, aFlags);
}
inline void
UnlinkForCC()
{
WebTransportSendOptions::UnlinkForCC();
}
WebTransportSendStreamOptions&
operator=(const WebTransportSendStreamOptions& aOther);
};
namespace binding_detail {
struct MOZ_EMPTY_BASES FastWebTransportSendStreamOptions : public WebTransportSendStreamOptions
{
inline FastWebTransportSendStreamOptions()
: WebTransportSendStreamOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
namespace WebTransport_Binding {
typedef mozilla::dom::WebTransport NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::WebTransport* 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;
}
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, DefineInterfaceProperty aDefineOnGlobal);
JS::Handle<JSObject*>
GetConstructorObjectHandle(JSContext* aCx);
inline bool CreateAndDefineOnGlobal(JSContext* aCx)
{
// Get the interface or namespace object for this class. This will
// create the object as needed and always define the properties for
// it on the global. The caller should make sure the interface or
// namespace is exposed on the global before calling this.
return GetPerInterfaceObjectHandle(aCx, constructors::id::WebTransport,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace WebTransport_Binding
} // namespace dom
template <>
struct MaxContiguousEnumValue<dom::WebTransportCongestionControl>
{
static constexpr dom::WebTransportCongestionControl value = dom::WebTransportCongestionControl::Low_latency;
static_assert(static_cast<uint8_t>(dom::WebTransportCongestionControl::Default) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(std::size(dom::binding_detail::EnumStrings<dom::WebTransportCongestionControl>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
template <>
struct MaxContiguousEnumValue<dom::WebTransportReliabilityMode>
{
static constexpr dom::WebTransportReliabilityMode value = dom::WebTransportReliabilityMode::Supports_unreliable;
static_assert(static_cast<uint8_t>(dom::WebTransportReliabilityMode::Pending) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(std::size(dom::binding_detail::EnumStrings<dom::WebTransportReliabilityMode>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
} // namespace mozilla
#endif // DOM_WEBTRANSPORTBINDING_H_