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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM AnimationTimeline.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "AnimationTimelineBinding.h"
       4             : #include "WrapperFactory.h"
       5             : #include "mozilla/FloatingPoint.h"
       6             : #include "mozilla/OwningNonNull.h"
       7             : #include "mozilla/dom/AnimationTimeline.h"
       8             : #include "mozilla/dom/BindingUtils.h"
       9             : #include "mozilla/dom/DOMJSClass.h"
      10             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      11             : #include "mozilla/dom/Nullable.h"
      12             : #include "mozilla/dom/PrimitiveConversions.h"
      13             : #include "mozilla/dom/XrayExpandoClass.h"
      14             : #include "nsDocument.h"
      15             : 
      16             : namespace mozilla {
      17             : namespace dom {
      18             : 
      19             : namespace AnimationTimelineBinding {
      20             : 
      21             : static bool
      22           0 : get_currentTime(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::AnimationTimeline* self, JSJitGetterCallArgs args)
      23             : {
      24           0 :   Nullable<double> result(self->GetCurrentTimeAsDouble());
      25           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      26           0 :   if (result.IsNull()) {
      27           0 :     args.rval().setNull();
      28           0 :     return true;
      29             :   }
      30           0 :   args.rval().set(JS_NumberValue(double(result.Value())));
      31           0 :   return true;
      32             : }
      33             : 
      34             : static const JSJitInfo currentTime_getterinfo = {
      35             :   { (JSJitGetterOp)get_currentTime },
      36             :   { prototypes::id::AnimationTimeline },
      37             :   { PrototypeTraits<prototypes::id::AnimationTimeline>::Depth },
      38             :   JSJitInfo::Getter,
      39             :   JSJitInfo::AliasEverything, /* aliasSet.  Not relevant for setters. */
      40             :   JSVAL_TYPE_UNKNOWN,  /* returnType.  Not relevant for setters. */
      41             :   true,  /* isInfallible. False in setters. */
      42             :   false,  /* isMovable.  Not relevant for setters. */
      43             :   false, /* isEliminatable.  Not relevant for setters. */
      44             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      45             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      46             :   false,  /* isTypedMethod.  Only relevant for methods. */
      47             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      48             : };
      49             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      50             : static_assert(0 < 1, "There is no slot for us");
      51             : 
      52             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
      53             : #if defined(__clang__)
      54             : #pragma clang diagnostic push
      55             : #pragma clang diagnostic ignored "-Wmissing-braces"
      56             : #endif
      57             : static const JSPropertySpec sAttributes_specs[] = {
      58             :   { "currentTime", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &currentTime_getterinfo, nullptr, nullptr },
      59             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
      60             : };
      61             : #if defined(__clang__)
      62             : #pragma clang diagnostic pop
      63             : #endif
      64             : 
      65             : 
      66             : // Can't be const because the pref-enabled boolean needs to be writable
      67             : static Prefable<const JSPropertySpec> sAttributes[] = {
      68             :   { nullptr, &sAttributes_specs[0] },
      69             :   { nullptr, nullptr }
      70             : };
      71             : 
      72             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
      73             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
      74             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
      75             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
      76             : 
      77             : 
      78             : static uint16_t sNativeProperties_sortedPropertyIndices[1];
      79             : static PropertyInfo sNativeProperties_propertyInfos[1];
      80             : 
      81             : static const NativePropertiesN<1> sNativeProperties = {
      82             :   false, 0,
      83             :   false, 0,
      84             :   false, 0,
      85             :   true,  0 /* sAttributes */,
      86             :   false, 0,
      87             :   false, 0,
      88             :   false, 0,
      89             :   -1,
      90             :   1,
      91             :   sNativeProperties_sortedPropertyIndices,
      92             :   {
      93             :     { sAttributes, &sNativeProperties_propertyInfos[0] }
      94             :   }
      95             : };
      96             : static_assert(1 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
      97             :     "We have a property info count that is oversized");
      98             : 
      99             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     100             :   {
     101             :     "Function",
     102             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     103             :     &sBoringInterfaceObjectClassClassOps,
     104             :     JS_NULL_CLASS_SPEC,
     105             :     JS_NULL_CLASS_EXT,
     106             :     &sInterfaceObjectClassObjectOps
     107             :   },
     108             :   eInterface,
     109             :   true,
     110             :   prototypes::id::AnimationTimeline,
     111             :   PrototypeTraits<prototypes::id::AnimationTimeline>::Depth,
     112             :   sNativePropertyHooks,
     113             :   "function AnimationTimeline() {\n    [native code]\n}",
     114             :   JS::GetRealmFunctionPrototype
     115             : };
     116             : 
     117             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     118             :   {
     119             :     "AnimationTimelinePrototype",
     120             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     121             :     JS_NULL_CLASS_OPS,
     122             :     JS_NULL_CLASS_SPEC,
     123             :     JS_NULL_CLASS_EXT,
     124             :     JS_NULL_OBJECT_OPS
     125             :   },
     126             :   eInterfacePrototype,
     127             :   false,
     128             :   prototypes::id::AnimationTimeline,
     129             :   PrototypeTraits<prototypes::id::AnimationTimeline>::Depth,
     130             :   sNativePropertyHooks,
     131             :   "[object AnimationTimelinePrototype]",
     132             :   JS::GetRealmObjectPrototype
     133             : };
     134             : 
     135             : bool
     136           0 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj)
     137             : {
     138           0 :   return nsDocument::IsWebAnimationsEnabled(aCx, aObj);
     139             : }
     140             : 
     141             : JSObject*
     142           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     143             : {
     144           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     145             : }
     146             : 
     147             : const NativePropertyHooks sNativePropertyHooks[] = { {
     148             :   nullptr,
     149             :   nullptr,
     150             :   nullptr,
     151             :   { sNativeProperties.Upcast(), nullptr },
     152             :   prototypes::id::AnimationTimeline,
     153             :   constructors::id::AnimationTimeline,
     154             :   nullptr,
     155             :   &DefaultXrayExpandoObjectClass
     156             : } };
     157             : 
     158             : void
     159           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     160             : {
     161           0 :   JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
     162           0 :   if (!parentProto) {
     163           0 :     return;
     164             :   }
     165             : 
     166           0 :   JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
     167           0 :   if (!constructorProto) {
     168           0 :     return;
     169             :   }
     170             : 
     171             :   static bool sIdsInited = false;
     172           0 :   if (!sIdsInited && NS_IsMainThread()) {
     173           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     174           0 :       return;
     175             :     }
     176           0 :     sIdsInited = true;
     177             :   }
     178             : 
     179           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::AnimationTimeline);
     180           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::AnimationTimeline);
     181           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     182             :                               &sPrototypeClass.mBase, protoCache,
     183             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     184             :                               interfaceCache,
     185             :                               sNativeProperties.Upcast(),
     186             :                               nullptr,
     187             :                               "AnimationTimeline", aDefineOnGlobal,
     188             :                               nullptr,
     189           0 :                               false);
     190             : }
     191             : 
     192             : JS::Handle<JSObject*>
     193           0 : GetProtoObjectHandle(JSContext* aCx)
     194             : {
     195             :   /* Get the interface prototype object for this class.  This will create the
     196             :      object as needed. */
     197           0 :   bool aDefineOnGlobal = true;
     198             : 
     199             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     200           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     201           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     202           0 :     return nullptr;
     203             :   }
     204             : 
     205             :   /* Check to see whether the interface objects are already installed */
     206           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     207           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::AnimationTimeline)) {
     208           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     209           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     210             :   }
     211             : 
     212             :   /*
     213             :    * The object might _still_ be null, but that's OK.
     214             :    *
     215             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     216             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     217             :    * changed after they have been set.
     218             :    *
     219             :    * Calling address() avoids the read read barrier that does gray
     220             :    * unmarking, but it's not possible for the object to be gray here.
     221             :    */
     222             : 
     223           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::AnimationTimeline);
     224           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     225           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     226             : }
     227             : 
     228             : JSObject*
     229           0 : GetProtoObject(JSContext* aCx)
     230             : {
     231           0 :   return GetProtoObjectHandle(aCx);
     232             : }
     233             : 
     234             : JS::Handle<JSObject*>
     235           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     236             : {
     237             :   /* Get the interface object for this class.  This will create the object as
     238             :      needed. */
     239             : 
     240             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     241           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     242           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     243           0 :     return nullptr;
     244             :   }
     245             : 
     246             :   /* Check to see whether the interface objects are already installed */
     247           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     248           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::AnimationTimeline)) {
     249           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     250           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     251             :   }
     252             : 
     253             :   /*
     254             :    * The object might _still_ be null, but that's OK.
     255             :    *
     256             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     257             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     258             :    * changed after they have been set.
     259             :    *
     260             :    * Calling address() avoids the read read barrier that does gray
     261             :    * unmarking, but it's not possible for the object to be gray here.
     262             :    */
     263             : 
     264           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::AnimationTimeline);
     265           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     266           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     267             : }
     268             : 
     269             : JSObject*
     270           0 : GetConstructorObject(JSContext* aCx)
     271             : {
     272           0 :   return GetConstructorObjectHandle(aCx);
     273             : }
     274             : 
     275             : } // namespace AnimationTimelineBinding
     276             : 
     277             : 
     278             : 
     279             : } // namespace dom
     280             : } // namespace mozilla

Generated by: LCOV version 1.13