Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM MediaStreamAudioDestinationNode.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "AudioNodeBinding.h"
4 : #include "DOMMediaStream.h"
5 : #include "MediaStreamAudioDestinationNodeBinding.h"
6 : #include "WrapperFactory.h"
7 : #include "mozilla/OwningNonNull.h"
8 : #include "mozilla/Preferences.h"
9 : #include "mozilla/dom/AudioContext.h"
10 : #include "mozilla/dom/BindingUtils.h"
11 : #include "mozilla/dom/DOMJSClass.h"
12 : #include "mozilla/dom/MediaStreamAudioDestinationNode.h"
13 : #include "mozilla/dom/NonRefcountedDOMObject.h"
14 : #include "mozilla/dom/XrayExpandoClass.h"
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 : namespace MediaStreamAudioDestinationNodeBinding {
20 :
21 : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<AudioNodeBinding::NativeType>::value,
22 : "Can't inherit from an interface with a different ownership model.");
23 :
24 : static bool
25 0 : get_stream(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::MediaStreamAudioDestinationNode* self, JSJitGetterCallArgs args)
26 : {
27 0 : auto result(StrongOrRawPtr<mozilla::DOMMediaStream>(self->DOMStream()));
28 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
29 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
30 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
31 0 : return false;
32 : }
33 0 : return true;
34 : }
35 :
36 : static const JSJitInfo stream_getterinfo = {
37 : { (JSJitGetterOp)get_stream },
38 : { prototypes::id::MediaStreamAudioDestinationNode },
39 : { PrototypeTraits<prototypes::id::MediaStreamAudioDestinationNode>::Depth },
40 : JSJitInfo::Getter,
41 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
42 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
43 : false, /* isInfallible. False in setters. */
44 : false, /* isMovable. Not relevant for setters. */
45 : false, /* isEliminatable. Not relevant for setters. */
46 : false, /* isAlwaysInSlot. Only relevant for getters. */
47 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
48 : false, /* isTypedMethod. Only relevant for methods. */
49 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
50 : };
51 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
52 : static_assert(0 < 1, "There is no slot for us");
53 :
54 : static bool
55 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
56 : {
57 0 : mozilla::dom::MediaStreamAudioDestinationNode* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::MediaStreamAudioDestinationNode>(obj);
58 : // We don't want to preserve if we don't have a wrapper, and we
59 : // obviously can't preserve if we're not initialized.
60 0 : if (self && self->GetWrapperPreserveColor()) {
61 0 : PreserveWrapper(self);
62 : }
63 0 : return true;
64 : }
65 :
66 : static void
67 0 : _finalize(js::FreeOp* fop, JSObject* obj)
68 : {
69 0 : mozilla::dom::MediaStreamAudioDestinationNode* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::MediaStreamAudioDestinationNode>(obj);
70 0 : if (self) {
71 0 : ClearWrapper(self, self, obj);
72 0 : AddForDeferredFinalization<mozilla::dom::MediaStreamAudioDestinationNode>(self);
73 : }
74 0 : }
75 :
76 : static void
77 0 : _objectMoved(JSObject* obj, const JSObject* old)
78 : {
79 0 : mozilla::dom::MediaStreamAudioDestinationNode* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::MediaStreamAudioDestinationNode>(obj);
80 0 : if (self) {
81 0 : UpdateWrapper(self, self, obj, old);
82 : }
83 0 : }
84 :
85 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
86 : #if defined(__clang__)
87 : #pragma clang diagnostic push
88 : #pragma clang diagnostic ignored "-Wmissing-braces"
89 : #endif
90 : static const JSPropertySpec sAttributes_specs[] = {
91 : { "stream", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &stream_getterinfo, nullptr, nullptr },
92 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
93 : };
94 : #if defined(__clang__)
95 : #pragma clang diagnostic pop
96 : #endif
97 :
98 :
99 : // Can't be const because the pref-enabled boolean needs to be writable
100 : static Prefable<const JSPropertySpec> sAttributes[] = {
101 : { nullptr, &sAttributes_specs[0] },
102 : { nullptr, nullptr }
103 : };
104 :
105 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
106 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
107 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
108 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
109 :
110 :
111 : static uint16_t sNativeProperties_sortedPropertyIndices[1];
112 : static PropertyInfo sNativeProperties_propertyInfos[1];
113 :
114 : static const NativePropertiesN<1> sNativeProperties = {
115 : false, 0,
116 : false, 0,
117 : false, 0,
118 : true, 0 /* sAttributes */,
119 : false, 0,
120 : false, 0,
121 : false, 0,
122 : -1,
123 : 1,
124 : sNativeProperties_sortedPropertyIndices,
125 : {
126 : { sAttributes, &sNativeProperties_propertyInfos[0] }
127 : }
128 : };
129 : static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
130 : "We have a property info count that is oversized");
131 :
132 : static bool
133 0 : _constructor(JSContext* cx, unsigned argc, JS::Value* vp)
134 : {
135 0 : JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
136 0 : JS::Rooted<JSObject*> obj(cx, &args.callee());
137 0 : if (!args.isConstructing()) {
138 : // XXXbz wish I could get the name from the callee instead of
139 : // Adding more relocations
140 0 : return ThrowConstructorWithoutNew(cx, "MediaStreamAudioDestinationNode");
141 : }
142 :
143 0 : GlobalObject global(cx, obj);
144 0 : if (global.Failed()) {
145 0 : return false;
146 : }
147 :
148 0 : JS::Rooted<JSObject*> desiredProto(cx);
149 0 : if (!GetDesiredProto(cx, args, &desiredProto)) {
150 0 : return false;
151 : }
152 :
153 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
154 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "MediaStreamAudioDestinationNode");
155 : }
156 0 : bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
157 0 : NonNull<mozilla::dom::AudioContext> arg0;
158 0 : if (args[0].isObject()) {
159 : {
160 0 : nsresult rv = UnwrapObject<prototypes::id::AudioContext, mozilla::dom::AudioContext>(args[0], arg0);
161 0 : if (NS_FAILED(rv)) {
162 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of MediaStreamAudioDestinationNode.constructor", "AudioContext");
163 0 : return false;
164 : }
165 : }
166 : } else {
167 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of MediaStreamAudioDestinationNode.constructor");
168 0 : return false;
169 : }
170 0 : binding_detail::FastAudioNodeOptions arg1;
171 0 : if (!arg1.Init(cx, (args.hasDefined(1)) ? args[1] : JS::NullHandleValue, "Argument 2 of MediaStreamAudioDestinationNode.constructor", false)) {
172 0 : return false;
173 : }
174 0 : Maybe<JSAutoCompartment> ac;
175 0 : if (objIsXray) {
176 0 : obj = js::CheckedUnwrap(obj);
177 0 : if (!obj) {
178 0 : return false;
179 : }
180 0 : ac.emplace(cx, obj);
181 0 : if (!JS_WrapObject(cx, &desiredProto)) {
182 0 : return false;
183 : }
184 : }
185 0 : binding_detail::FastErrorResult rv;
186 0 : auto result(StrongOrRawPtr<mozilla::dom::MediaStreamAudioDestinationNode>(mozilla::dom::MediaStreamAudioDestinationNode::Constructor(global, NonNullHelper(arg0), Constify(arg1), rv)));
187 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
188 0 : return false;
189 : }
190 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
191 : static_assert(!IsPointer<decltype(result)>::value,
192 : "NewObject implies that we need to keep the object alive with a strong reference.");
193 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) {
194 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
195 0 : return false;
196 : }
197 0 : return true;
198 : }
199 :
200 : static const js::ClassOps sInterfaceObjectClassOps = {
201 : nullptr, /* addProperty */
202 : nullptr, /* delProperty */
203 : nullptr, /* getProperty */
204 : nullptr, /* setProperty */
205 : nullptr, /* enumerate */
206 : nullptr, /* newEnumerate */
207 : nullptr, /* resolve */
208 : nullptr, /* mayResolve */
209 : nullptr, /* finalize */
210 : _constructor, /* call */
211 : nullptr, /* hasInstance */
212 : _constructor, /* construct */
213 : nullptr, /* trace */
214 : };
215 :
216 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
217 : {
218 : "Function",
219 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
220 : &sInterfaceObjectClassOps,
221 : JS_NULL_CLASS_SPEC,
222 : JS_NULL_CLASS_EXT,
223 : &sInterfaceObjectClassObjectOps
224 : },
225 : eInterface,
226 : true,
227 : prototypes::id::MediaStreamAudioDestinationNode,
228 : PrototypeTraits<prototypes::id::MediaStreamAudioDestinationNode>::Depth,
229 : sNativePropertyHooks,
230 : "function MediaStreamAudioDestinationNode() {\n [native code]\n}",
231 : AudioNodeBinding::GetConstructorObject
232 : };
233 :
234 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
235 : {
236 : "MediaStreamAudioDestinationNodePrototype",
237 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
238 : JS_NULL_CLASS_OPS,
239 : JS_NULL_CLASS_SPEC,
240 : JS_NULL_CLASS_EXT,
241 : JS_NULL_OBJECT_OPS
242 : },
243 : eInterfacePrototype,
244 : false,
245 : prototypes::id::MediaStreamAudioDestinationNode,
246 : PrototypeTraits<prototypes::id::MediaStreamAudioDestinationNode>::Depth,
247 : sNativePropertyHooks,
248 : "[object MediaStreamAudioDestinationNodePrototype]",
249 : AudioNodeBinding::GetProtoObject
250 : };
251 :
252 : bool
253 0 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
254 : {
255 : static bool sPrefValue;
256 : static bool sPrefCacheSetUp = false;
257 0 : if (!sPrefCacheSetUp) {
258 0 : sPrefCacheSetUp = true;
259 0 : Preferences::AddBoolVarCache(&sPrefValue, "dom.webaudio.enabled");
260 : }
261 :
262 0 : return sPrefValue;
263 : }
264 :
265 : JSObject*
266 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
267 : {
268 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
269 : }
270 :
271 : static const js::ClassOps sClassOps = {
272 : _addProperty, /* addProperty */
273 : nullptr, /* delProperty */
274 : nullptr, /* getProperty */
275 : nullptr, /* setProperty */
276 : nullptr, /* enumerate */
277 : nullptr, /* newEnumerate */
278 : nullptr, /* resolve */
279 : nullptr, /* mayResolve */
280 : _finalize, /* finalize */
281 : nullptr, /* call */
282 : nullptr, /* hasInstance */
283 : nullptr, /* construct */
284 : nullptr, /* trace */
285 : };
286 :
287 : static const js::ClassExtension sClassExtension = {
288 : nullptr, /* weakmapKeyDelegateOp */
289 : _objectMoved /* objectMovedOp */
290 : };
291 :
292 : static const DOMJSClass sClass = {
293 : { "MediaStreamAudioDestinationNode",
294 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
295 : &sClassOps,
296 : JS_NULL_CLASS_SPEC,
297 : &sClassExtension,
298 : JS_NULL_OBJECT_OPS
299 : },
300 : { prototypes::id::EventTarget, prototypes::id::AudioNode, prototypes::id::MediaStreamAudioDestinationNode, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
301 : IsBaseOf<nsISupports, mozilla::dom::MediaStreamAudioDestinationNode >::value,
302 : sNativePropertyHooks,
303 : FindAssociatedGlobalForNative<mozilla::dom::MediaStreamAudioDestinationNode>::Get,
304 : GetProtoObjectHandle,
305 : GetCCParticipant<mozilla::dom::MediaStreamAudioDestinationNode>::Get()
306 : };
307 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
308 : "Must have the right minimal number of reserved slots.");
309 : static_assert(1 >= 1,
310 : "Must have enough reserved slots.");
311 :
312 : const JSClass*
313 0 : GetJSClass()
314 : {
315 0 : return sClass.ToJSClass();
316 : }
317 :
318 : bool
319 0 : Wrap(JSContext* aCx, mozilla::dom::MediaStreamAudioDestinationNode* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
320 : {
321 : MOZ_ASSERT(static_cast<mozilla::dom::MediaStreamAudioDestinationNode*>(aObject) ==
322 : reinterpret_cast<mozilla::dom::MediaStreamAudioDestinationNode*>(aObject),
323 : "Multiple inheritance for mozilla::dom::MediaStreamAudioDestinationNode is broken.");
324 : MOZ_ASSERT(static_cast<mozilla::dom::AudioNode*>(aObject) ==
325 : reinterpret_cast<mozilla::dom::AudioNode*>(aObject),
326 : "Multiple inheritance for mozilla::dom::AudioNode is broken.");
327 : MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
328 : reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
329 : "Multiple inheritance for mozilla::dom::EventTarget is broken.");
330 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
331 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
332 0 : MOZ_ASSERT(!aCache->GetWrapper(),
333 : "You should probably not be using Wrap() directly; use "
334 : "GetOrCreateDOMReflector instead");
335 :
336 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
337 : "nsISupports must be on our primary inheritance chain");
338 :
339 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
340 0 : if (!global) {
341 0 : return false;
342 : }
343 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
344 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
345 :
346 : // That might have ended up wrapping us already, due to the wonders
347 : // of XBL. Check for that, and bail out as needed.
348 0 : aReflector.set(aCache->GetWrapper());
349 0 : if (aReflector) {
350 : #ifdef DEBUG
351 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
352 : #endif // DEBUG
353 0 : return true;
354 : }
355 :
356 0 : JSAutoCompartment ac(aCx, global);
357 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
358 0 : if (!canonicalProto) {
359 0 : return false;
360 : }
361 0 : JS::Rooted<JSObject*> proto(aCx);
362 0 : if (aGivenProto) {
363 0 : proto = aGivenProto;
364 : // Unfortunately, while aGivenProto was in the compartment of aCx
365 : // coming in, we changed compartments to that of "parent" so may need
366 : // to wrap the proto here.
367 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
368 0 : if (!JS_WrapObject(aCx, &proto)) {
369 0 : return false;
370 : }
371 : }
372 : } else {
373 0 : proto = canonicalProto;
374 : }
375 :
376 0 : BindingJSObjectCreator<mozilla::dom::MediaStreamAudioDestinationNode> creator(aCx);
377 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
378 0 : if (!aReflector) {
379 0 : return false;
380 : }
381 :
382 0 : aCache->SetWrapper(aReflector);
383 0 : creator.InitializationSucceeded();
384 :
385 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
386 : aCache->GetWrapperPreserveColor() == aReflector);
387 : // If proto != canonicalProto, we have to preserve our wrapper;
388 : // otherwise we won't be able to properly recreate it later, since
389 : // we won't know what proto to use. Note that we don't check
390 : // aGivenProto here, since it's entirely possible (and even
391 : // somewhat common) to have a non-null aGivenProto which is the
392 : // same as canonicalProto.
393 0 : if (proto != canonicalProto) {
394 0 : PreserveWrapper(aObject);
395 : }
396 :
397 0 : return true;
398 : }
399 :
400 : const NativePropertyHooks sNativePropertyHooks[] = { {
401 : nullptr,
402 : nullptr,
403 : nullptr,
404 : { sNativeProperties.Upcast(), nullptr },
405 : prototypes::id::MediaStreamAudioDestinationNode,
406 : constructors::id::MediaStreamAudioDestinationNode,
407 : AudioNodeBinding::sNativePropertyHooks,
408 : &DefaultXrayExpandoObjectClass
409 : } };
410 :
411 : void
412 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
413 : {
414 0 : JS::Handle<JSObject*> parentProto(AudioNodeBinding::GetProtoObjectHandle(aCx));
415 0 : if (!parentProto) {
416 0 : return;
417 : }
418 :
419 0 : JS::Handle<JSObject*> constructorProto(AudioNodeBinding::GetConstructorObjectHandle(aCx));
420 0 : if (!constructorProto) {
421 0 : return;
422 : }
423 :
424 : static bool sIdsInited = false;
425 0 : if (!sIdsInited && NS_IsMainThread()) {
426 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
427 0 : return;
428 : }
429 0 : sIdsInited = true;
430 : }
431 :
432 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::MediaStreamAudioDestinationNode);
433 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::MediaStreamAudioDestinationNode);
434 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
435 : &sPrototypeClass.mBase, protoCache,
436 : constructorProto, &sInterfaceObjectClass.mBase, 1, nullptr,
437 : interfaceCache,
438 : sNativeProperties.Upcast(),
439 : nullptr,
440 : "MediaStreamAudioDestinationNode", aDefineOnGlobal,
441 : nullptr,
442 0 : false);
443 : }
444 :
445 : JS::Handle<JSObject*>
446 0 : GetProtoObjectHandle(JSContext* aCx)
447 : {
448 : /* Get the interface prototype object for this class. This will create the
449 : object as needed. */
450 0 : bool aDefineOnGlobal = true;
451 :
452 : /* Make sure our global is sane. Hopefully we can remove this sometime */
453 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
454 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
455 0 : return nullptr;
456 : }
457 :
458 : /* Check to see whether the interface objects are already installed */
459 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
460 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::MediaStreamAudioDestinationNode)) {
461 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
462 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
463 : }
464 :
465 : /*
466 : * The object might _still_ be null, but that's OK.
467 : *
468 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
469 : * traced by TraceProtoAndIfaceCache() and its contents are never
470 : * changed after they have been set.
471 : *
472 : * Calling address() avoids the read read barrier that does gray
473 : * unmarking, but it's not possible for the object to be gray here.
474 : */
475 :
476 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::MediaStreamAudioDestinationNode);
477 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
478 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
479 : }
480 :
481 : JS::Handle<JSObject*>
482 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
483 : {
484 : /* Get the interface object for this class. This will create the object as
485 : needed. */
486 :
487 : /* Make sure our global is sane. Hopefully we can remove this sometime */
488 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
489 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
490 0 : return nullptr;
491 : }
492 :
493 : /* Check to see whether the interface objects are already installed */
494 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
495 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::MediaStreamAudioDestinationNode)) {
496 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
497 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
498 : }
499 :
500 : /*
501 : * The object might _still_ be null, but that's OK.
502 : *
503 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
504 : * traced by TraceProtoAndIfaceCache() and its contents are never
505 : * changed after they have been set.
506 : *
507 : * Calling address() avoids the read read barrier that does gray
508 : * unmarking, but it's not possible for the object to be gray here.
509 : */
510 :
511 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::MediaStreamAudioDestinationNode);
512 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
513 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
514 : }
515 :
516 : JSObject*
517 0 : GetConstructorObject(JSContext* aCx)
518 : {
519 0 : return GetConstructorObjectHandle(aCx);
520 : }
521 :
522 : } // namespace MediaStreamAudioDestinationNodeBinding
523 :
524 :
525 :
526 : } // namespace dom
527 : } // namespace mozilla
|