Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM RTCRtpReceiver.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_RTCRtpReceiverBinding_h
4 : #define mozilla_dom_RTCRtpReceiverBinding_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 : class MediaStreamTrack;
19 : struct NativePropertyHooks;
20 : class Promise;
21 : class ProtoAndIfaceCache;
22 : class RTCRtpReceiver;
23 : struct RTCRtpReceiverAtoms;
24 :
25 : } // namespace dom
26 : } // namespace mozilla
27 :
28 : namespace mozilla {
29 : namespace dom {
30 :
31 : namespace RTCRtpReceiverBinding {
32 :
33 : typedef mozilla::dom::RTCRtpReceiver NativeType;
34 :
35 : bool
36 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
37 :
38 : JSObject*
39 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
40 :
41 : const JSClass*
42 : GetJSClass();
43 :
44 : bool
45 : Wrap(JSContext* aCx, mozilla::dom::RTCRtpReceiver* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
46 :
47 : template <class T>
48 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
49 : {
50 0 : JS::Rooted<JSObject*> reflector(aCx);
51 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
52 : }
53 :
54 : // We declare this as an array so that retrieving a pointer to this
55 : // binding's property hooks only requires compile/link-time resolvable
56 : // address arithmetic. Declaring it as a pointer instead would require
57 : // doing a run-time load to fetch a pointer to this binding's property
58 : // hooks. And then structures which embedded a pointer to this structure
59 : // would require a run-time load for proper initialization, which would
60 : // then induce static constructors. Lots of static constructors.
61 : extern const NativePropertyHooks sNativePropertyHooks[];
62 :
63 : void
64 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
65 :
66 : JS::Handle<JSObject*>
67 : GetProtoObjectHandle(JSContext* aCx);
68 :
69 : JS::Handle<JSObject*>
70 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
71 :
72 : JSObject*
73 : GetConstructorObject(JSContext* aCx);
74 :
75 : } // namespace RTCRtpReceiverBinding
76 :
77 :
78 :
79 0 : class RTCRtpReceiverJSImpl : public CallbackInterface
80 : {
81 : public:
82 0 : explicit inline RTCRtpReceiverJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
83 0 : : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
84 : {
85 0 : }
86 :
87 : explicit inline RTCRtpReceiverJSImpl(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
88 : : CallbackInterface(aCallback, FastCallbackConstructor())
89 : {
90 : }
91 :
92 : explicit inline RTCRtpReceiverJSImpl(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
93 : : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
94 : {
95 : }
96 :
97 : already_AddRefed<Promise> GetStats(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
98 :
99 : inline bool
100 : operator==(const RTCRtpReceiverJSImpl& aOther) const
101 : {
102 : return CallbackInterface::operator==(aOther);
103 : }
104 :
105 : already_AddRefed<MediaStreamTrack> GetTrack(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
106 :
107 : private:
108 : static bool
109 : InitIds(JSContext* cx, RTCRtpReceiverAtoms* atomsCache);
110 : };
111 :
112 :
113 : class RTCRtpReceiver final : public nsSupportsWeakReference,
114 : public nsWrapperCache
115 : {
116 : public:
117 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
118 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(RTCRtpReceiver)
119 :
120 : private:
121 : RefPtr<RTCRtpReceiverJSImpl> mImpl;
122 : nsCOMPtr<nsISupports> mParent;
123 :
124 : public:
125 : RTCRtpReceiver(JS::Handle<JSObject*> aJSImplObject, nsIGlobalObject* aParent);
126 :
127 : private:
128 : ~RTCRtpReceiver();
129 :
130 : public:
131 : nsISupports* GetParentObject() const;
132 :
133 : virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
134 :
135 : // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
136 : already_AddRefed<MediaStreamTrack> GetTrack(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;
137 :
138 : // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
139 : already_AddRefed<Promise> GetStats(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);
140 :
141 : static bool
142 : _Create(JSContext* cx, unsigned argc, JS::Value* vp);
143 : };
144 :
145 :
146 : } // namespace dom
147 : } // namespace mozilla
148 :
149 : #endif // mozilla_dom_RTCRtpReceiverBinding_h
|