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

Generated by: LCOV version 1.13