Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM RTCSessionDescription.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_RTCSessionDescriptionBinding_h
4 : #define mozilla_dom_RTCSessionDescriptionBinding_h
5 :
6 : #include "js/RootingAPI.h"
7 : #include "jspubtd.h"
8 : #include "mozilla/ErrorResult.h"
9 : #include "mozilla/dom/BindingDeclarations.h"
10 : #include "mozilla/dom/CallbackInterface.h"
11 : #include "mozilla/dom/Nullable.h"
12 : #include "mozilla/dom/ToJSValue.h"
13 : #include "nsWeakReference.h"
14 :
15 : namespace mozilla {
16 : namespace dom {
17 :
18 : struct NativePropertyHooks;
19 : class ProtoAndIfaceCache;
20 : class RTCSessionDescription;
21 : struct RTCSessionDescriptionAtoms;
22 : struct RTCSessionDescriptionInit;
23 : struct RTCSessionDescriptionInitAtoms;
24 :
25 : } // namespace dom
26 : } // namespace mozilla
27 :
28 : namespace mozilla {
29 : namespace dom {
30 :
31 : enum class RTCSdpType : uint8_t {
32 : Offer,
33 : Pranswer,
34 : Answer,
35 : Rollback,
36 : EndGuard_
37 : };
38 :
39 : namespace RTCSdpTypeValues {
40 : extern const EnumEntry strings[5];
41 : } // namespace RTCSdpTypeValues
42 :
43 : bool
44 : ToJSValue(JSContext* aCx, RTCSdpType aArgument, JS::MutableHandle<JS::Value> aValue);
45 :
46 :
47 0 : struct RTCSessionDescriptionInit : public DictionaryBase
48 : {
49 : MOZ_INIT_OUTSIDE_CTOR nsString mSdp;
50 : MOZ_INIT_OUTSIDE_CTOR RTCSdpType mType;
51 :
52 : RTCSessionDescriptionInit();
53 :
54 0 : explicit inline RTCSessionDescriptionInit(const FastDictionaryInitializer& )
55 0 : {
56 : // Do nothing here; this is used by our "Fast" subclass
57 0 : }
58 :
59 : explicit inline RTCSessionDescriptionInit(const RTCSessionDescriptionInit& aOther)
60 : {
61 : *this = aOther;
62 : }
63 :
64 : bool
65 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
66 :
67 : bool
68 : Init(const nsAString& aJSON);
69 :
70 : bool
71 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
72 :
73 : bool
74 : ToJSON(nsAString& aJSON) const;
75 :
76 : void
77 : TraceDictionary(JSTracer* trc);
78 :
79 : RTCSessionDescriptionInit&
80 : operator=(const RTCSessionDescriptionInit& aOther);
81 :
82 : private:
83 : static bool
84 : InitIds(JSContext* cx, RTCSessionDescriptionInitAtoms* atomsCache);
85 : };
86 :
87 : namespace binding_detail {
88 0 : struct FastRTCSessionDescriptionInit : public RTCSessionDescriptionInit
89 : {
90 0 : inline FastRTCSessionDescriptionInit()
91 0 : : RTCSessionDescriptionInit(FastDictionaryInitializer())
92 : {
93 : // Doesn't matter what int we pass to the parent constructor
94 0 : }
95 : };
96 : } // namespace binding_detail
97 :
98 :
99 : namespace RTCSessionDescriptionBinding {
100 :
101 : typedef mozilla::dom::RTCSessionDescription NativeType;
102 :
103 : bool
104 : JsonifyAttributes(JSContext* aCx, JS::Handle<JSObject*> obj, mozilla::dom::RTCSessionDescription* self, JS::Rooted<JSObject*>& aResult);
105 :
106 : bool
107 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
108 :
109 : JSObject*
110 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
111 :
112 : const JSClass*
113 : GetJSClass();
114 :
115 : bool
116 : Wrap(JSContext* aCx, mozilla::dom::RTCSessionDescription* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
117 :
118 : template <class T>
119 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
120 : {
121 0 : JS::Rooted<JSObject*> reflector(aCx);
122 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
123 : }
124 :
125 : // We declare this as an array so that retrieving a pointer to this
126 : // binding's property hooks only requires compile/link-time resolvable
127 : // address arithmetic. Declaring it as a pointer instead would require
128 : // doing a run-time load to fetch a pointer to this binding's property
129 : // hooks. And then structures which embedded a pointer to this structure
130 : // would require a run-time load for proper initialization, which would
131 : // then induce static constructors. Lots of static constructors.
132 : extern const NativePropertyHooks sNativePropertyHooks[];
133 :
134 : void
135 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
136 :
137 : JS::Handle<JSObject*>
138 : GetProtoObjectHandle(JSContext* aCx);
139 :
140 : JSObject*
141 : GetProtoObject(JSContext* aCx);
142 :
143 : JS::Handle<JSObject*>
144 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
145 :
146 : JSObject*
147 : GetConstructorObject(JSContext* aCx);
148 :
149 : } // namespace RTCSessionDescriptionBinding
150 :
151 :
152 :
153 0 : class RTCSessionDescriptionJSImpl : public CallbackInterface
154 : {
155 : public:
156 0 : explicit inline RTCSessionDescriptionJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
157 0 : : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
158 : {
159 0 : }
160 :
161 : explicit inline RTCSessionDescriptionJSImpl(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
162 : : CallbackInterface(aCallback, FastCallbackConstructor())
163 : {
164 : }
165 :
166 : explicit inline RTCSessionDescriptionJSImpl(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
167 : : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
168 : {
169 : }
170 :
171 : void __Init(const RTCSessionDescriptionInit& descriptionInitDict, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
172 :
173 : inline bool
174 : operator==(const RTCSessionDescriptionJSImpl& aOther) const
175 : {
176 : return CallbackInterface::operator==(aOther);
177 : }
178 :
179 : RTCSdpType GetType(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
180 :
181 : void GetSdp(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
182 :
183 : void SetType(RTCSdpType arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
184 :
185 : void SetSdp(const nsAString& arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
186 :
187 : private:
188 : static bool
189 : InitIds(JSContext* cx, RTCSessionDescriptionAtoms* atomsCache);
190 : };
191 :
192 :
193 : class RTCSessionDescription : public nsSupportsWeakReference,
194 : public nsWrapperCache
195 : {
196 : public:
197 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
198 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(RTCSessionDescription)
199 :
200 : private:
201 : RefPtr<RTCSessionDescriptionJSImpl> mImpl;
202 : nsCOMPtr<nsISupports> mParent;
203 :
204 : public:
205 : RTCSessionDescription(JS::Handle<JSObject*> aJSImplObject, nsIGlobalObject* aParent);
206 :
207 : protected:
208 : virtual ~RTCSessionDescription();
209 :
210 : public:
211 : nsISupports* GetParentObject() const;
212 :
213 : virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
214 :
215 : static already_AddRefed<RTCSessionDescription> Constructor(const GlobalObject& global, JSContext* cx, const RTCSessionDescriptionInit& descriptionInitDict, ErrorResult& aRv);
216 :
217 : RTCSdpType GetType(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
218 :
219 : void SetType(RTCSdpType arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
220 :
221 : void GetSdp(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
222 :
223 : void SetSdp(const nsAString& arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
224 :
225 : static bool
226 : _Create(JSContext* cx, unsigned argc, JS::Value* vp);
227 : };
228 :
229 :
230 : } // namespace dom
231 : } // namespace mozilla
232 :
233 : #endif // mozilla_dom_RTCSessionDescriptionBinding_h
|