Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM WebrtcGlobalInformation.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_WebrtcGlobalInformationBinding_h
4 : #define mozilla_dom_WebrtcGlobalInformationBinding_h
5 :
6 : #include "RTCStatsReportBinding.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/CallbackFunction.h"
12 : #include "mozilla/dom/Nullable.h"
13 : #include "mozilla/dom/ToJSValue.h"
14 :
15 : namespace mozilla {
16 : namespace dom {
17 :
18 : struct NativePropertyHooks;
19 : class ProtoAndIfaceCache;
20 : struct RTCStatsReportInternal;
21 : class WebrtcGlobalInformation;
22 : struct WebrtcGlobalInformationAtoms;
23 : class WebrtcGlobalLoggingCallback;
24 : class WebrtcGlobalStatisticsCallback;
25 : struct WebrtcGlobalStatisticsReport;
26 : struct WebrtcGlobalStatisticsReportAtoms;
27 :
28 : } // namespace dom
29 : } // namespace mozilla
30 :
31 : namespace mozilla {
32 : namespace dom {
33 :
34 0 : struct WebrtcGlobalStatisticsReport : public DictionaryBase
35 : {
36 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<RTCStatsReportInternal>> mReports;
37 :
38 : WebrtcGlobalStatisticsReport();
39 :
40 : explicit inline WebrtcGlobalStatisticsReport(const FastDictionaryInitializer& )
41 : {
42 : // Do nothing here; this is used by our "Fast" subclass
43 : }
44 :
45 0 : explicit inline WebrtcGlobalStatisticsReport(const WebrtcGlobalStatisticsReport& aOther)
46 0 : {
47 0 : *this = aOther;
48 0 : }
49 :
50 : bool
51 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
52 :
53 : bool
54 : Init(const nsAString& aJSON);
55 :
56 : bool
57 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
58 :
59 : bool
60 : ToJSON(nsAString& aJSON) const;
61 :
62 : void
63 : TraceDictionary(JSTracer* trc);
64 :
65 : WebrtcGlobalStatisticsReport&
66 : operator=(const WebrtcGlobalStatisticsReport& aOther);
67 :
68 : private:
69 : static bool
70 : InitIds(JSContext* cx, WebrtcGlobalStatisticsReportAtoms* atomsCache);
71 : };
72 :
73 : namespace binding_detail {
74 : struct FastWebrtcGlobalStatisticsReport : public WebrtcGlobalStatisticsReport
75 : {
76 : inline FastWebrtcGlobalStatisticsReport()
77 : : WebrtcGlobalStatisticsReport(FastDictionaryInitializer())
78 : {
79 : // Doesn't matter what int we pass to the parent constructor
80 : }
81 : };
82 : } // namespace binding_detail
83 :
84 :
85 0 : class WebrtcGlobalStatisticsCallback : public CallbackFunction
86 : {
87 : public:
88 : explicit inline WebrtcGlobalStatisticsCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
89 : : CallbackFunction(aCx, aCallback, aIncumbentGlobal)
90 : {
91 : MOZ_ASSERT(JS::IsCallable(mCallback));
92 : }
93 :
94 0 : explicit inline WebrtcGlobalStatisticsCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
95 0 : : CallbackFunction(aCallback, FastCallbackConstructor())
96 : {
97 0 : MOZ_ASSERT(JS::IsCallable(mCallback));
98 0 : }
99 :
100 : explicit inline WebrtcGlobalStatisticsCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
101 : : CallbackFunction(aCallback, aAsyncStack, aIncumbentGlobal)
102 : {
103 : MOZ_ASSERT(JS::IsCallable(mCallback));
104 : }
105 :
106 : explicit inline WebrtcGlobalStatisticsCallback(CallbackFunction* aOther)
107 : : CallbackFunction(aOther)
108 : {
109 : }
110 :
111 : template <typename T>
112 : inline void
113 : Call(const T& thisVal, const WebrtcGlobalStatisticsReport& reports, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
114 : {
115 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
116 : if (!aExecutionReason) {
117 : aExecutionReason = "WebrtcGlobalStatisticsCallback";
118 : }
119 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
120 : if (!s.GetContext()) {
121 : MOZ_ASSERT(aRv.Failed());
122 : return;
123 : }
124 : JS::Rooted<JS::Value> thisValJS(s.GetContext());
125 : if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
126 : aRv.Throw(NS_ERROR_FAILURE);
127 : return;
128 : }
129 : return Call(s.GetContext(), thisValJS, reports, aRv);
130 : }
131 :
132 : inline void
133 0 : Call(const WebrtcGlobalStatisticsReport& reports, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
134 : {
135 0 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
136 0 : if (!aExecutionReason) {
137 0 : aExecutionReason = "WebrtcGlobalStatisticsCallback";
138 : }
139 0 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
140 0 : if (!s.GetContext()) {
141 0 : MOZ_ASSERT(aRv.Failed());
142 0 : return;
143 : }
144 0 : return Call(s.GetContext(), JS::UndefinedHandleValue, reports, aRv);
145 : }
146 :
147 : template <typename T>
148 : inline void
149 : Call(const T& thisVal, const WebrtcGlobalStatisticsReport& reports, const char* aExecutionReason = nullptr)
150 : {
151 : IgnoredErrorResult rv;
152 : return Call(thisVal, reports, rv, aExecutionReason);
153 : }
154 :
155 : inline void
156 : Call(const WebrtcGlobalStatisticsReport& reports, const char* aExecutionReason = nullptr)
157 : {
158 : IgnoredErrorResult rv;
159 : return Call(reports, rv, aExecutionReason, eReportExceptions, nullptr);
160 : }
161 :
162 : inline bool
163 : operator==(const WebrtcGlobalStatisticsCallback& aOther) const
164 : {
165 : return CallbackFunction::operator==(aOther);
166 : }
167 :
168 : private:
169 : void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, const WebrtcGlobalStatisticsReport& reports, ErrorResult& aRv);
170 : };
171 :
172 :
173 0 : class WebrtcGlobalLoggingCallback : public CallbackFunction
174 : {
175 : public:
176 : explicit inline WebrtcGlobalLoggingCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
177 : : CallbackFunction(aCx, aCallback, aIncumbentGlobal)
178 : {
179 : MOZ_ASSERT(JS::IsCallable(mCallback));
180 : }
181 :
182 0 : explicit inline WebrtcGlobalLoggingCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
183 0 : : CallbackFunction(aCallback, FastCallbackConstructor())
184 : {
185 0 : MOZ_ASSERT(JS::IsCallable(mCallback));
186 0 : }
187 :
188 : explicit inline WebrtcGlobalLoggingCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
189 : : CallbackFunction(aCallback, aAsyncStack, aIncumbentGlobal)
190 : {
191 : MOZ_ASSERT(JS::IsCallable(mCallback));
192 : }
193 :
194 : explicit inline WebrtcGlobalLoggingCallback(CallbackFunction* aOther)
195 : : CallbackFunction(aOther)
196 : {
197 : }
198 :
199 : template <typename T>
200 : inline void
201 : Call(const T& thisVal, const Sequence<nsString>& logMessages, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
202 : {
203 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
204 : if (!aExecutionReason) {
205 : aExecutionReason = "WebrtcGlobalLoggingCallback";
206 : }
207 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
208 : if (!s.GetContext()) {
209 : MOZ_ASSERT(aRv.Failed());
210 : return;
211 : }
212 : JS::Rooted<JS::Value> thisValJS(s.GetContext());
213 : if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
214 : aRv.Throw(NS_ERROR_FAILURE);
215 : return;
216 : }
217 : return Call(s.GetContext(), thisValJS, logMessages, aRv);
218 : }
219 :
220 : inline void
221 0 : Call(const Sequence<nsString>& logMessages, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
222 : {
223 0 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
224 0 : if (!aExecutionReason) {
225 0 : aExecutionReason = "WebrtcGlobalLoggingCallback";
226 : }
227 0 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
228 0 : if (!s.GetContext()) {
229 0 : MOZ_ASSERT(aRv.Failed());
230 0 : return;
231 : }
232 0 : return Call(s.GetContext(), JS::UndefinedHandleValue, logMessages, aRv);
233 : }
234 :
235 : template <typename T>
236 : inline void
237 : Call(const T& thisVal, const Sequence<nsString>& logMessages, const char* aExecutionReason = nullptr)
238 : {
239 : IgnoredErrorResult rv;
240 : return Call(thisVal, logMessages, rv, aExecutionReason);
241 : }
242 :
243 : inline void
244 : Call(const Sequence<nsString>& logMessages, const char* aExecutionReason = nullptr)
245 : {
246 : IgnoredErrorResult rv;
247 : return Call(logMessages, rv, aExecutionReason, eReportExceptions, nullptr);
248 : }
249 :
250 : inline bool
251 : operator==(const WebrtcGlobalLoggingCallback& aOther) const
252 : {
253 : return CallbackFunction::operator==(aOther);
254 : }
255 :
256 : private:
257 : void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, const Sequence<nsString>& logMessages, ErrorResult& aRv);
258 : };
259 :
260 :
261 : namespace binding_detail {
262 0 : class FastWebrtcGlobalStatisticsCallback : public WebrtcGlobalStatisticsCallback
263 : {
264 : public:
265 0 : explicit inline FastWebrtcGlobalStatisticsCallback(JS::Handle<JSObject*> aCallback)
266 0 : : WebrtcGlobalStatisticsCallback(aCallback, FastCallbackConstructor())
267 : {
268 0 : }
269 :
270 : inline void
271 0 : Trace(JSTracer* aTracer)
272 : {
273 0 : WebrtcGlobalStatisticsCallback::Trace(aTracer);
274 0 : }
275 :
276 : inline void
277 0 : FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
278 : {
279 0 : WebrtcGlobalStatisticsCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
280 0 : }
281 : };
282 : } // namespace binding_detail
283 :
284 :
285 : namespace binding_detail {
286 0 : class FastWebrtcGlobalLoggingCallback : public WebrtcGlobalLoggingCallback
287 : {
288 : public:
289 0 : explicit inline FastWebrtcGlobalLoggingCallback(JS::Handle<JSObject*> aCallback)
290 0 : : WebrtcGlobalLoggingCallback(aCallback, FastCallbackConstructor())
291 : {
292 0 : }
293 :
294 : inline void
295 0 : Trace(JSTracer* aTracer)
296 : {
297 0 : WebrtcGlobalLoggingCallback::Trace(aTracer);
298 0 : }
299 :
300 : inline void
301 0 : FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
302 : {
303 0 : WebrtcGlobalLoggingCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
304 0 : }
305 : };
306 : } // namespace binding_detail
307 :
308 :
309 : namespace WebrtcGlobalInformationBinding {
310 :
311 : typedef mozilla::dom::WebrtcGlobalInformation NativeType;
312 :
313 : bool
314 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
315 :
316 : JSObject*
317 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
318 :
319 : // We declare this as an array so that retrieving a pointer to this
320 : // binding's property hooks only requires compile/link-time resolvable
321 : // address arithmetic. Declaring it as a pointer instead would require
322 : // doing a run-time load to fetch a pointer to this binding's property
323 : // hooks. And then structures which embedded a pointer to this structure
324 : // would require a run-time load for proper initialization, which would
325 : // then induce static constructors. Lots of static constructors.
326 : extern const NativePropertyHooks sNativePropertyHooks[];
327 :
328 : void
329 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
330 :
331 : JS::Handle<JSObject*>
332 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
333 :
334 : JSObject*
335 : GetConstructorObject(JSContext* aCx);
336 :
337 : } // namespace WebrtcGlobalInformationBinding
338 :
339 :
340 :
341 : } // namespace dom
342 : } // namespace mozilla
343 :
344 : #endif // mozilla_dom_WebrtcGlobalInformationBinding_h
|