Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/RTCRtpReceiverBinding.h
Line
Count
Source (jump to first uncovered line)
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 "GeckoProfiler.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/PrototypeList.h"
14
#include "mozilla/dom/ToJSValue.h"
15
#include "nsWeakReference.h"
16
17
namespace mozilla {
18
namespace dom {
19
20
class MediaStreamTrack;
21
struct NativePropertyHooks;
22
class Promise;
23
class ProtoAndIfaceCache;
24
struct RTCRtpContributingSource;
25
class RTCRtpReceiver;
26
struct RTCRtpReceiverAtoms;
27
struct RTCRtpSynchronizationSource;
28
class RTCRtpTransceiver;
29
30
} // namespace dom
31
} // namespace mozilla
32
33
namespace mozilla {
34
namespace dom {
35
36
namespace RTCRtpReceiver_Binding {
37
38
  typedef mozilla::dom::RTCRtpReceiver NativeType;
39
40
  bool
41
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
42
43
  const JSClass*
44
  GetJSClass();
45
46
  bool
47
  Wrap(JSContext* aCx, mozilla::dom::RTCRtpReceiver* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
48
49
  template <class T>
50
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
51
0
  {
52
0
    JS::Rooted<JSObject*> reflector(aCx);
53
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
54
0
  }
55
56
  // We declare this as an array so that retrieving a pointer to this
57
  // binding's property hooks only requires compile/link-time resolvable
58
  // address arithmetic.  Declaring it as a pointer instead would require
59
  // doing a run-time load to fetch a pointer to this binding's property
60
  // hooks.  And then structures which embedded a pointer to this structure
61
  // would require a run-time load for proper initialization, which would
62
  // then induce static constructors.  Lots of static constructors.
63
  extern const NativePropertyHooks sNativePropertyHooks[];
64
65
  void
66
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
67
68
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
69
0
  {
70
0
    /* Get the interface prototype object for this class.  This will create the
71
0
       object as needed. */
72
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::RTCRtpReceiver,
73
0
                                       &CreateInterfaceObjects,
74
0
                                       /* aDefineOnGlobal = */ true);
75
0
76
0
  }
77
78
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
79
0
  {
80
0
    /* Get the interface object for this class.  This will create the object as
81
0
       needed. */
82
0
83
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::RTCRtpReceiver,
84
0
                                       &CreateInterfaceObjects,
85
0
                                       aDefineOnGlobal);
86
0
  }
87
88
  JSObject*
89
  GetConstructorObject(JSContext* aCx);
90
91
} // namespace RTCRtpReceiver_Binding
92
93
94
95
class RTCRtpReceiverJSImpl : public CallbackInterface
96
{
97
public:
98
  explicit inline RTCRtpReceiverJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
99
    : CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
100
0
  {
101
0
  }
102
103
  explicit inline RTCRtpReceiverJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
104
    : CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor())
105
0
  {
106
0
  }
107
108
  explicit inline RTCRtpReceiverJSImpl(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
109
    : CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
110
0
  {
111
0
  }
112
113
  already_AddRefed<Promise> GetStats(ErrorResult& aRv, JS::Realm* aRealm = nullptr);
114
115
  void GetContributingSources(nsTArray<RTCRtpContributingSource>& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
116
117
  void GetSynchronizationSources(nsTArray<RTCRtpSynchronizationSource>& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
118
119
  void SetStreamIds(const Sequence<nsString>& streamIds, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
120
121
  void SetRemoteSendBit(bool sendBit, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
122
123
  void ProcessTrackAdditionsAndRemovals(RTCRtpTransceiver& transceiver, JS::Handle<JSObject*> postProcessing, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
124
125
  inline bool
126
  operator==(const RTCRtpReceiverJSImpl& aOther) const
127
0
  {
128
0
    return CallbackInterface::operator==(aOther);
129
0
  }
130
131
  already_AddRefed<MediaStreamTrack> GetTrack(ErrorResult& aRv, JS::Realm* aRealm = nullptr);
132
133
private:
134
  static bool
135
  InitIds(JSContext* cx, RTCRtpReceiverAtoms* atomsCache);
136
};
137
138
139
class RTCRtpReceiver final : public nsSupportsWeakReference,
140
                             public nsWrapperCache
141
{
142
public:
143
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
144
  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(RTCRtpReceiver)
145
146
private:
147
  RefPtr<RTCRtpReceiverJSImpl> mImpl;
148
  nsCOMPtr<nsIGlobalObject> mParent;
149
150
public:
151
  RTCRtpReceiver(JS::Handle<JSObject*> aJSImplObject, JS::Handle<JSObject*> aJSImplGlobal, nsIGlobalObject* aParent);
152
153
private:
154
  ~RTCRtpReceiver();
155
156
public:
157
  nsISupports* GetParentObject() const;
158
159
  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
160
161
  // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
162
  already_AddRefed<MediaStreamTrack> GetTrack(ErrorResult& aRv, JS::Realm* aRealm = nullptr) const;
163
164
  // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
165
  already_AddRefed<Promise> GetStats(ErrorResult& aRv, JS::Realm* aRealm = nullptr);
166
167
  void GetContributingSources(nsTArray<RTCRtpContributingSource>& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
168
169
  void GetSynchronizationSources(nsTArray<RTCRtpSynchronizationSource>& aRetVal, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
170
171
  void SetStreamIds(const Sequence<nsString>& streamIds, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
172
173
  void SetRemoteSendBit(bool sendBit, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
174
175
  void ProcessTrackAdditionsAndRemovals(RTCRtpTransceiver& transceiver, JS::Handle<JSObject*> postProcessing, ErrorResult& aRv, JS::Realm* aRealm = nullptr);
176
177
  static bool
178
  _Create(JSContext* cx, unsigned argc, JS::Value* vp);
179
};
180
181
182
} // namespace dom
183
} // namespace mozilla
184
185
#endif // mozilla_dom_RTCRtpReceiverBinding_h