Copy as Markdown
Other Tools
/* THIS FILE IS AUTOGENERATED FROM PeerConnectionObserver.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_PEERCONNECTIONOBSERVERBINDING_H_
#define DOM_PEERCONNECTIONOBSERVERBINDING_H_
#include "PeerConnectionObserverEnumsBinding.h"
#include "RTCPeerConnectionBinding.h"
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/CallbackInterface.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrototypeList.h"
#include "mozilla/dom/ToJSValue.h"
#include "mozilla/dom/TypedArray.h"
#include "nsWeakReference.h"
class nsDOMDataChannel;
namespace mozilla {
class DOMMediaStream;
namespace dom {
struct NativePropertyHooks;
struct PCErrorData;
struct PCErrorDataAtoms;
class PeerConnectionObserver;
struct PeerConnectionObserverAtoms;
class ProtoAndIfaceCache;
class RTCPeerConnection;
class RTCRtpReceiver;
} // namespace dom
} // namespace mozilla
namespace mozilla::dom {
struct PCErrorData : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR nsString mMessage;
MOZ_INIT_OUTSIDE_CTOR PCError mName;
PCErrorData();
explicit inline PCErrorData(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
PCErrorData(PCErrorData&& aOther) = default;
explicit inline PCErrorData(const PCErrorData& 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);
PCErrorData&
operator=(const PCErrorData& aOther);
private:
static bool
InitIds(JSContext* cx, PCErrorDataAtoms* atomsCache);
};
namespace binding_detail {
struct FastPCErrorData : public PCErrorData
{
inline FastPCErrorData()
: PCErrorData(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
namespace PeerConnectionObserver_Binding {
typedef mozilla::dom::PeerConnectionObserver NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::PeerConnectionObserver* 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::PeerConnectionObserver,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace PeerConnectionObserver_Binding
class PeerConnectionObserverJSImpl : public CallbackInterface
{
public:
explicit inline PeerConnectionObserverJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
}
explicit inline PeerConnectionObserverJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
explicit inline PeerConnectionObserverJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
}
void OnCreateOfferSuccess(const nsAString& offer, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnCreateOfferError(const PCErrorData& error, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnCreateAnswerSuccess(const nsAString& answer, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnCreateAnswerError(const PCErrorData& error, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnSetDescriptionSuccess(ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnSetDescriptionError(const PCErrorData& error, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnAddIceCandidateSuccess(ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnAddIceCandidateError(const PCErrorData& error, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnIceCandidate(uint16_t level, const nsAString& mid, const nsAString& candidate, const nsAString& ufrag, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void NotifyDataChannel(nsDOMDataChannel& channel, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnStateChange(PCObserverStateType state, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void FireTrackEvent(RTCRtpReceiver& receiver, const Sequence<OwningNonNull<DOMMediaStream>>& streams, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void FireStreamEvent(DOMMediaStream& stream, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void FireNegotiationNeededEvent(ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnPacket(uint32_t level, mozPacketDumpType type, bool sending, const ArrayBuffer& packet, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void __Init(RTCPeerConnection& domPC, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
inline bool
operator==(const PeerConnectionObserverJSImpl& aOther) const
{
return CallbackInterface::operator==(aOther);
}
private:
static bool
InitIds(JSContext* cx, PeerConnectionObserverAtoms* atomsCache);
};
class PeerConnectionObserver final : public nsSupportsWeakReference,
public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(PeerConnectionObserver)
private:
RefPtr<PeerConnectionObserverJSImpl> mImpl;
nsCOMPtr<nsIGlobalObject> mParent;
public:
PeerConnectionObserver(JS::Handle<JSObject*> aJSImplObject, JS::Handle<JSObject*> aJSImplGlobal, nsIGlobalObject* aParent);
private:
~PeerConnectionObserver();
public:
nsISupports* GetParentObject() const;
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
static already_AddRefed<PeerConnectionObserver> Constructor(const GlobalObject& global, JSContext* cx, RTCPeerConnection& domPC, ErrorResult& aRv, JS::Handle<JSObject*> aGivenProto = nullptr);
void OnCreateOfferSuccess(const nsAString& offer, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnCreateOfferError(const PCErrorData& error, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnCreateAnswerSuccess(const nsAString& answer, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnCreateAnswerError(const PCErrorData& error, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnSetDescriptionSuccess(ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnSetDescriptionError(const PCErrorData& error, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnAddIceCandidateSuccess(ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnAddIceCandidateError(const PCErrorData& error, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnIceCandidate(uint16_t level, const nsAString& mid, const nsAString& candidate, const nsAString& ufrag, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void NotifyDataChannel(nsDOMDataChannel& channel, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnStateChange(PCObserverStateType state, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void FireTrackEvent(RTCRtpReceiver& receiver, const Sequence<OwningNonNull<DOMMediaStream>>& streams, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void FireStreamEvent(DOMMediaStream& stream, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void FireNegotiationNeededEvent(ErrorResult& aRv, JS::Realm* aRealm = nullptr);
void OnPacket(uint32_t level, mozPacketDumpType type, bool sending, const ArrayBuffer& packet, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
static bool
_Create(JSContext* cx, unsigned argc, JS::Value* vp);
};
} // namespace mozilla::dom
#endif // DOM_PEERCONNECTIONOBSERVERBINDING_H_