LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dom/bindings - CanvasCaptureMediaStreamBinding.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 112 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 13 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.13