Copy as Markdown

Other Tools

/* 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"
namespace mozilla {
namespace dom {
class ArrayBufferViewOrArrayBuffer;
struct NativePropertyHooks;
class OwningArrayBufferViewOrArrayBuffer;
class ProtoAndIfaceCache;
class WebTransport;
struct WebTransportCloseInfoAtoms;
struct WebTransportDatagramStats;
struct WebTransportDatagramStatsAtoms;
struct WebTransportHash;
struct WebTransportHashAtoms;
struct WebTransportOptionsAtoms;
struct WebTransportSendStreamOptionsAtoms;
struct WebTransportStatsAtoms;
} // 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 const nsLiteralCString Values[3];
};
} // 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 const nsLiteralCString Values[3];
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, WebTransportReliabilityMode aArgument, JS::MutableHandle<JS::Value> aValue);
struct WebTransportCloseInfo : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR uint32_t mCloseCode;
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);
bool
operator==(const WebTransportCloseInfo& aOther) const;
private:
static bool
InitIds(JSContext* cx, WebTransportCloseInfoAtoms* atomsCache);
};
namespace binding_detail {
struct FastWebTransportCloseInfo : public WebTransportCloseInfo
{
inline FastWebTransportCloseInfo()
: WebTransportCloseInfo(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct WebTransportDatagramStats : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mDroppedIncoming;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mExpiredOutgoing;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mLostOutgoing;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mTimestamp;
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);
bool
operator==(const WebTransportDatagramStats& aOther) const;
private:
static bool
InitIds(JSContext* cx, WebTransportDatagramStatsAtoms* atomsCache);
};
namespace binding_detail {
struct FastWebTransportDatagramStats : public WebTransportDatagramStats
{
inline FastWebTransportDatagramStats()
: WebTransportDatagramStats(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct WebTransportHash : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mAlgorithm;
MOZ_INIT_OUTSIDE_CTOR Optional<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 FastWebTransportHash : public WebTransportHash
{
inline FastWebTransportHash()
: WebTransportHash(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct WebTransportSendStreamOptions : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Nullable<int64_t> mSendOrder;
WebTransportSendStreamOptions();
explicit inline WebTransportSendStreamOptions(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
WebTransportSendStreamOptions(WebTransportSendStreamOptions&& aOther) = default;
explicit inline WebTransportSendStreamOptions(const WebTransportSendStreamOptions& 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);
WebTransportSendStreamOptions&
operator=(const WebTransportSendStreamOptions& aOther);
bool
operator==(const WebTransportSendStreamOptions& aOther) const;
private:
static bool
InitIds(JSContext* cx, WebTransportSendStreamOptionsAtoms* atomsCache);
};
namespace binding_detail {
struct FastWebTransportSendStreamOptions : public WebTransportSendStreamOptions
{
inline FastWebTransportSendStreamOptions()
: WebTransportSendStreamOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct WebTransportOptions : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR bool mAllowPooling;
MOZ_INIT_OUTSIDE_CTOR WebTransportCongestionControl mCongestionControl;
MOZ_INIT_OUTSIDE_CTOR bool mRequireUnreliable;
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 FastWebTransportOptions : public WebTransportOptions
{
inline FastWebTransportOptions()
: WebTransportOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct WebTransportStats : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBytesReceived;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBytesSent;
MOZ_INIT_OUTSIDE_CTOR Optional<WebTransportDatagramStats> mDatagrams;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mMinRtt;
MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mNumIncomingStreamsCreated;
MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mNumOutgoingStreamsCreated;
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;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mTimestamp;
WebTransportStats();
explicit inline WebTransportStats(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
WebTransportStats(WebTransportStats&& aOther) = default;
explicit inline WebTransportStats(const WebTransportStats& 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);
WebTransportStats&
operator=(const WebTransportStats& aOther);
private:
static bool
InitIds(JSContext* cx, WebTransportStatsAtoms* atomsCache);
};
namespace binding_detail {
struct FastWebTransportStats : public WebTransportStats
{
inline FastWebTransportStats()
: WebTransportStats(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, bool aDefineOnGlobal);
inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
{
/* Get the interface prototype object for this class. This will create the
object as needed. */
return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebTransport,
&CreateInterfaceObjects,
/* aDefineOnGlobal = */ true);
}
inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
{
/* Get the interface object for this class. This will create the object as
needed. */
return GetPerInterfaceObjectHandle(aCx, constructors::id::WebTransport,
&CreateInterfaceObjects,
aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx);
} // 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(mozilla::ArrayLength(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(mozilla::ArrayLength(dom::binding_detail::EnumStrings<dom::WebTransportReliabilityMode>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
} // namespace mozilla
#endif // DOM_WEBTRANSPORTBINDING_H_