Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM PeerConnectionObserver.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_PeerConnectionObserverBinding_h
4 : #define mozilla_dom_PeerConnectionObserverBinding_h
5 :
6 : #include "PeerConnectionObserverEnumsBinding.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 : class nsDOMDataChannel;
17 :
18 : namespace mozilla {
19 :
20 : class DOMMediaStream;
21 :
22 : namespace dom {
23 :
24 : class MediaStreamTrack;
25 : struct NativePropertyHooks;
26 : class PeerConnectionObserver;
27 : struct PeerConnectionObserverAtoms;
28 : class ProtoAndIfaceCache;
29 : class RTCPeerConnection;
30 : struct RTCStatsReportInternal;
31 :
32 : } // namespace dom
33 :
34 : } // namespace mozilla
35 :
36 : namespace mozilla {
37 : namespace dom {
38 :
39 : namespace PeerConnectionObserverBinding {
40 :
41 : typedef mozilla::dom::PeerConnectionObserver NativeType;
42 :
43 : bool
44 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
45 :
46 : JSObject*
47 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
48 :
49 : const JSClass*
50 : GetJSClass();
51 :
52 : bool
53 : Wrap(JSContext* aCx, mozilla::dom::PeerConnectionObserver* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
54 :
55 : template <class T>
56 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
57 : {
58 0 : JS::Rooted<JSObject*> reflector(aCx);
59 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
60 : }
61 :
62 : // We declare this as an array so that retrieving a pointer to this
63 : // binding's property hooks only requires compile/link-time resolvable
64 : // address arithmetic. Declaring it as a pointer instead would require
65 : // doing a run-time load to fetch a pointer to this binding's property
66 : // hooks. And then structures which embedded a pointer to this structure
67 : // would require a run-time load for proper initialization, which would
68 : // then induce static constructors. Lots of static constructors.
69 : extern const NativePropertyHooks sNativePropertyHooks[];
70 :
71 : void
72 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
73 :
74 : JS::Handle<JSObject*>
75 : GetProtoObjectHandle(JSContext* aCx);
76 :
77 : JS::Handle<JSObject*>
78 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
79 :
80 : JSObject*
81 : GetConstructorObject(JSContext* aCx);
82 :
83 : } // namespace PeerConnectionObserverBinding
84 :
85 :
86 :
87 0 : class PeerConnectionObserverJSImpl : public CallbackInterface
88 : {
89 : public:
90 0 : explicit inline PeerConnectionObserverJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
91 0 : : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
92 : {
93 0 : }
94 :
95 : explicit inline PeerConnectionObserverJSImpl(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
96 : : CallbackInterface(aCallback, FastCallbackConstructor())
97 : {
98 : }
99 :
100 : explicit inline PeerConnectionObserverJSImpl(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
101 : : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
102 : {
103 : }
104 :
105 : void OnCreateOfferSuccess(const nsAString& offer, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
106 :
107 : void OnCreateOfferError(uint32_t name, const nsAString& message, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
108 :
109 : void OnCreateAnswerSuccess(const nsAString& answer, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
110 :
111 : void OnCreateAnswerError(uint32_t name, const nsAString& message, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
112 :
113 : void OnSetLocalDescriptionSuccess(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
114 :
115 : void OnSetRemoteDescriptionSuccess(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
116 :
117 : void OnSetLocalDescriptionError(uint32_t name, const nsAString& message, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
118 :
119 : void OnSetRemoteDescriptionError(uint32_t name, const nsAString& message, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
120 :
121 : void OnAddIceCandidateSuccess(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
122 :
123 : void OnAddIceCandidateError(uint32_t name, const nsAString& message, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
124 :
125 : void OnIceCandidate(uint16_t level, const nsAString& mid, const nsAString& candidate, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
126 :
127 : void OnNegotiationNeeded(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
128 :
129 : void OnGetStatsSuccess(const RTCStatsReportInternal& report, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
130 :
131 : void OnGetStatsError(uint32_t name, const nsAString& message, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
132 :
133 : void OnReplaceTrackSuccess(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
134 :
135 : void OnReplaceTrackError(uint32_t name, const nsAString& message, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
136 :
137 : void NotifyDataChannel(nsDOMDataChannel& channel, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
138 :
139 : void OnStateChange(PCObserverStateType state, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
140 :
141 : void OnAddStream(DOMMediaStream& stream, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
142 :
143 : void OnRemoveStream(DOMMediaStream& stream, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
144 :
145 : void OnAddTrack(MediaStreamTrack& track, const Sequence<OwningNonNull<DOMMediaStream>>& streams, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
146 :
147 : void OnRemoveTrack(MediaStreamTrack& track, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
148 :
149 : void OnDTMFToneChange(const nsAString& trackId, const nsAString& tone, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
150 :
151 : void __Init(RTCPeerConnection& domPC, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
152 :
153 : inline bool
154 : operator==(const PeerConnectionObserverJSImpl& aOther) const
155 : {
156 : return CallbackInterface::operator==(aOther);
157 : }
158 :
159 : private:
160 : static bool
161 : InitIds(JSContext* cx, PeerConnectionObserverAtoms* atomsCache);
162 : };
163 :
164 :
165 : class PeerConnectionObserver final : public nsSupportsWeakReference,
166 : public nsWrapperCache
167 : {
168 : public:
169 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
170 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PeerConnectionObserver)
171 :
172 : private:
173 : RefPtr<PeerConnectionObserverJSImpl> mImpl;
174 : nsCOMPtr<nsISupports> mParent;
175 :
176 : public:
177 : PeerConnectionObserver(JS::Handle<JSObject*> aJSImplObject, nsIGlobalObject* aParent);
178 :
179 : private:
180 : ~PeerConnectionObserver();
181 :
182 : public:
183 : nsISupports* GetParentObject() const;
184 :
185 : virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
186 :
187 : static already_AddRefed<PeerConnectionObserver> Constructor(const GlobalObject& global, JSContext* cx, RTCPeerConnection& domPC, ErrorResult& aRv);
188 :
189 : void OnCreateOfferSuccess(const nsAString& offer, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
190 :
191 : void OnCreateOfferError(uint32_t name, const nsAString& message, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
192 :
193 : void OnCreateAnswerSuccess(const nsAString& answer, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
194 :
195 : void OnCreateAnswerError(uint32_t name, const nsAString& message, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
196 :
197 : void OnSetLocalDescriptionSuccess(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
198 :
199 : void OnSetRemoteDescriptionSuccess(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
200 :
201 : void OnSetLocalDescriptionError(uint32_t name, const nsAString& message, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
202 :
203 : void OnSetRemoteDescriptionError(uint32_t name, const nsAString& message, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
204 :
205 : void OnAddIceCandidateSuccess(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
206 :
207 : void OnAddIceCandidateError(uint32_t name, const nsAString& message, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
208 :
209 : void OnIceCandidate(uint16_t level, const nsAString& mid, const nsAString& candidate, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
210 :
211 : void OnNegotiationNeeded(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
212 :
213 : void OnGetStatsSuccess(const RTCStatsReportInternal& report, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
214 :
215 : void OnGetStatsError(uint32_t name, const nsAString& message, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
216 :
217 : void OnReplaceTrackSuccess(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
218 :
219 : void OnReplaceTrackError(uint32_t name, const nsAString& message, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
220 :
221 : void NotifyDataChannel(nsDOMDataChannel& channel, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
222 :
223 : void OnStateChange(PCObserverStateType state, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
224 :
225 : void OnAddStream(DOMMediaStream& stream, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
226 :
227 : void OnRemoveStream(DOMMediaStream& stream, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
228 :
229 : void OnAddTrack(MediaStreamTrack& track, const Sequence<OwningNonNull<DOMMediaStream>>& streams, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
230 :
231 : void OnRemoveTrack(MediaStreamTrack& track, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
232 :
233 : void OnDTMFToneChange(const nsAString& trackId, const nsAString& tone, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
234 :
235 : static bool
236 : _Create(JSContext* cx, unsigned argc, JS::Value* vp);
237 : };
238 :
239 :
240 : } // namespace dom
241 : } // namespace mozilla
242 :
243 : #endif // mozilla_dom_PeerConnectionObserverBinding_h
|