LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dist/include/mozilla/dom - PushEventBinding.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 40 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 16 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM PushEvent.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #ifndef mozilla_dom_PushEventBinding_h
       4             : #define mozilla_dom_PushEventBinding_h
       5             : 
       6             : #include "ExtendableEventBinding.h"
       7             : #include "js/RootingAPI.h"
       8             : #include "jsfriendapi.h"
       9             : #include "jspubtd.h"
      10             : #include "mozilla/ErrorResult.h"
      11             : #include "mozilla/dom/BindingDeclarations.h"
      12             : #include "mozilla/dom/FakeString.h"
      13             : #include "mozilla/dom/Nullable.h"
      14             : #include "mozilla/dom/TypedArray.h"
      15             : #include "mozilla/dom/UnionMember.h"
      16             : 
      17             : namespace mozilla {
      18             : namespace dom {
      19             : 
      20             : class ArrayBufferViewOrArrayBufferOrUSVString;
      21             : struct NativePropertyHooks;
      22             : class OwningArrayBufferViewOrArrayBufferOrUSVString;
      23             : class ProtoAndIfaceCache;
      24             : struct PushEventInitAtoms;
      25             : 
      26             : namespace workers {
      27             : 
      28             : class PushEvent;
      29             : struct PushEventAtoms;
      30             : 
      31             : } // namespace workers
      32             : 
      33             : } // namespace dom
      34             : } // namespace mozilla
      35             : 
      36             : namespace mozilla {
      37             : namespace dom {
      38             : 
      39             : class ArrayBufferViewOrArrayBufferOrUSVString
      40             : {
      41             :   friend class ArrayBufferViewOrArrayBufferOrUSVStringArgument;
      42             :   enum Type
      43             :   {
      44             :     eUninitialized,
      45             :     eArrayBufferView,
      46             :     eArrayBuffer,
      47             :     eUSVString
      48             :   };
      49             : 
      50             :   union Value
      51             :   {
      52             :     UnionMember<RootedTypedArray<ArrayBufferView> > mArrayBufferView;
      53             :     UnionMember<RootedTypedArray<ArrayBuffer> > mArrayBuffer;
      54             :     UnionMember<binding_detail::FakeString > mUSVString;
      55             : 
      56             :   };
      57             : 
      58             :   Type mType;
      59             :   Value mValue;
      60             : 
      61             :   ArrayBufferViewOrArrayBufferOrUSVString(const ArrayBufferViewOrArrayBufferOrUSVString&) = delete;
      62             :   ArrayBufferViewOrArrayBufferOrUSVString& operator=(const ArrayBufferViewOrArrayBufferOrUSVString&) = delete;
      63             : public:
      64             :   explicit inline ArrayBufferViewOrArrayBufferOrUSVString()
      65             :     : mType(eUninitialized)
      66             :   {
      67             :   }
      68             : 
      69             :   inline ~ArrayBufferViewOrArrayBufferOrUSVString()
      70             :   {
      71             :     Uninit();
      72             :   }
      73             : 
      74             :   inline RootedTypedArray<ArrayBufferView>&
      75             :   RawSetAsArrayBufferView(JSContext* cx)
      76             :   {
      77             :     if (mType == eArrayBufferView) {
      78             :       return mValue.mArrayBufferView.Value();
      79             :     }
      80             :     MOZ_ASSERT(mType == eUninitialized);
      81             :     mType = eArrayBufferView;
      82             :     return mValue.mArrayBufferView.SetValue(cx);
      83             :   }
      84             : 
      85             :   inline RootedTypedArray<ArrayBufferView>&
      86             :   SetAsArrayBufferView(JSContext* cx)
      87             :   {
      88             :     if (mType == eArrayBufferView) {
      89             :       return mValue.mArrayBufferView.Value();
      90             :     }
      91             :     Uninit();
      92             :     mType = eArrayBufferView;
      93             :     return mValue.mArrayBufferView.SetValue(cx);
      94             :   }
      95             : 
      96             :   inline bool
      97             :   IsArrayBufferView() const
      98             :   {
      99             :     return mType == eArrayBufferView;
     100             :   }
     101             : 
     102             :   inline RootedTypedArray<ArrayBufferView>&
     103             :   GetAsArrayBufferView()
     104             :   {
     105             :     MOZ_ASSERT(IsArrayBufferView(), "Wrong type!");
     106             :     return mValue.mArrayBufferView.Value();
     107             :   }
     108             : 
     109             :   inline ArrayBufferView const &
     110             :   GetAsArrayBufferView() const
     111             :   {
     112             :     MOZ_ASSERT(IsArrayBufferView(), "Wrong type!");
     113             :     return mValue.mArrayBufferView.Value();
     114             :   }
     115             : 
     116             :   inline RootedTypedArray<ArrayBuffer>&
     117             :   RawSetAsArrayBuffer(JSContext* cx)
     118             :   {
     119             :     if (mType == eArrayBuffer) {
     120             :       return mValue.mArrayBuffer.Value();
     121             :     }
     122             :     MOZ_ASSERT(mType == eUninitialized);
     123             :     mType = eArrayBuffer;
     124             :     return mValue.mArrayBuffer.SetValue(cx);
     125             :   }
     126             : 
     127             :   inline RootedTypedArray<ArrayBuffer>&
     128             :   SetAsArrayBuffer(JSContext* cx)
     129             :   {
     130             :     if (mType == eArrayBuffer) {
     131             :       return mValue.mArrayBuffer.Value();
     132             :     }
     133             :     Uninit();
     134             :     mType = eArrayBuffer;
     135             :     return mValue.mArrayBuffer.SetValue(cx);
     136             :   }
     137             : 
     138             :   inline bool
     139             :   IsArrayBuffer() const
     140             :   {
     141             :     return mType == eArrayBuffer;
     142             :   }
     143             : 
     144             :   inline RootedTypedArray<ArrayBuffer>&
     145             :   GetAsArrayBuffer()
     146             :   {
     147             :     MOZ_ASSERT(IsArrayBuffer(), "Wrong type!");
     148             :     return mValue.mArrayBuffer.Value();
     149             :   }
     150             : 
     151             :   inline ArrayBuffer const &
     152             :   GetAsArrayBuffer() const
     153             :   {
     154             :     MOZ_ASSERT(IsArrayBuffer(), "Wrong type!");
     155             :     return mValue.mArrayBuffer.Value();
     156             :   }
     157             : 
     158             :   inline binding_detail::FakeString&
     159             :   RawSetAsUSVString()
     160             :   {
     161             :     if (mType == eUSVString) {
     162             :       return mValue.mUSVString.Value();
     163             :     }
     164             :     MOZ_ASSERT(mType == eUninitialized);
     165             :     mType = eUSVString;
     166             :     return mValue.mUSVString.SetValue();
     167             :   }
     168             : 
     169             :   inline binding_detail::FakeString&
     170             :   SetAsUSVString()
     171             :   {
     172             :     if (mType == eUSVString) {
     173             :       return mValue.mUSVString.Value();
     174             :     }
     175             :     Uninit();
     176             :     mType = eUSVString;
     177             :     return mValue.mUSVString.SetValue();
     178             :   }
     179             : 
     180             :   inline bool
     181             :   IsUSVString() const
     182             :   {
     183             :     return mType == eUSVString;
     184             :   }
     185             : 
     186             :   inline binding_detail::FakeString&
     187             :   GetAsUSVString()
     188             :   {
     189             :     MOZ_ASSERT(IsUSVString(), "Wrong type!");
     190             :     return mValue.mUSVString.Value();
     191             :   }
     192             : 
     193             :   inline const nsAString&
     194             :   GetAsUSVString() const
     195             :   {
     196             :     MOZ_ASSERT(IsUSVString(), "Wrong type!");
     197             :     return mValue.mUSVString.Value();
     198             :   }
     199             : 
     200             :   inline void
     201             :   Uninit()
     202             :   {
     203             :     switch (mType) {
     204             :       case eUninitialized: {
     205             :         break;
     206             :       }
     207             :       case eArrayBufferView: {
     208             :         DestroyArrayBufferView();
     209             :         break;
     210             :       }
     211             :       case eArrayBuffer: {
     212             :         DestroyArrayBuffer();
     213             :         break;
     214             :       }
     215             :       case eUSVString: {
     216             :         DestroyUSVString();
     217             :         break;
     218             :       }
     219             :     }
     220             :   }
     221             : 
     222             :   bool
     223             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     224             : 
     225             : private:
     226             :   inline void
     227             :   DestroyArrayBufferView()
     228             :   {
     229             :     MOZ_ASSERT(IsArrayBufferView(), "Wrong type!");
     230             :     mValue.mArrayBufferView.Destroy();
     231             :     mType = eUninitialized;
     232             :   }
     233             : 
     234             :   inline void
     235             :   DestroyArrayBuffer()
     236             :   {
     237             :     MOZ_ASSERT(IsArrayBuffer(), "Wrong type!");
     238             :     mValue.mArrayBuffer.Destroy();
     239             :     mType = eUninitialized;
     240             :   }
     241             : 
     242             :   inline void
     243             :   DestroyUSVString()
     244             :   {
     245             :     MOZ_ASSERT(IsUSVString(), "Wrong type!");
     246             :     mValue.mUSVString.Destroy();
     247             :     mType = eUninitialized;
     248             :   }
     249             : };
     250             : 
     251             : 
     252             : class OwningArrayBufferViewOrArrayBufferOrUSVString : public AllOwningUnionBase
     253             : {
     254             :   friend void ImplCycleCollectionUnlink(OwningArrayBufferViewOrArrayBufferOrUSVString& aUnion);
     255             :   enum Type
     256             :   {
     257             :     eUninitialized,
     258             :     eArrayBufferView,
     259             :     eArrayBuffer,
     260             :     eUSVString
     261             :   };
     262             : 
     263           0 :   union Value
     264             :   {
     265             :     UnionMember<ArrayBufferView > mArrayBufferView;
     266             :     UnionMember<ArrayBuffer > mArrayBuffer;
     267             :     UnionMember<nsString > mUSVString;
     268             : 
     269             :   };
     270             : 
     271             :   Type mType;
     272             :   Value mValue;
     273             : 
     274             :   OwningArrayBufferViewOrArrayBufferOrUSVString(const OwningArrayBufferViewOrArrayBufferOrUSVString&) = delete;
     275             :   OwningArrayBufferViewOrArrayBufferOrUSVString& operator=(const OwningArrayBufferViewOrArrayBufferOrUSVString&) = delete;
     276             : public:
     277           0 :   explicit inline OwningArrayBufferViewOrArrayBufferOrUSVString()
     278           0 :     : mType(eUninitialized)
     279             :   {
     280           0 :   }
     281             : 
     282           0 :   inline ~OwningArrayBufferViewOrArrayBufferOrUSVString()
     283           0 :   {
     284           0 :     Uninit();
     285           0 :   }
     286             : 
     287             :   ArrayBufferView&
     288             :   RawSetAsArrayBufferView();
     289             : 
     290             :   ArrayBufferView&
     291             :   SetAsArrayBufferView();
     292             : 
     293             :   bool
     294             :   TrySetToArrayBufferView(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     295             : 
     296             :   inline bool
     297           0 :   IsArrayBufferView() const
     298             :   {
     299           0 :     return mType == eArrayBufferView;
     300             :   }
     301             : 
     302             :   inline ArrayBufferView&
     303           0 :   GetAsArrayBufferView()
     304             :   {
     305           0 :     MOZ_ASSERT(IsArrayBufferView(), "Wrong type!");
     306           0 :     return mValue.mArrayBufferView.Value();
     307             :   }
     308             : 
     309             :   inline ArrayBufferView const &
     310           0 :   GetAsArrayBufferView() const
     311             :   {
     312           0 :     MOZ_ASSERT(IsArrayBufferView(), "Wrong type!");
     313           0 :     return mValue.mArrayBufferView.Value();
     314             :   }
     315             : 
     316             :   ArrayBuffer&
     317             :   RawSetAsArrayBuffer();
     318             : 
     319             :   ArrayBuffer&
     320             :   SetAsArrayBuffer();
     321             : 
     322             :   bool
     323             :   TrySetToArrayBuffer(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     324             : 
     325             :   inline bool
     326           0 :   IsArrayBuffer() const
     327             :   {
     328           0 :     return mType == eArrayBuffer;
     329             :   }
     330             : 
     331             :   inline ArrayBuffer&
     332           0 :   GetAsArrayBuffer()
     333             :   {
     334           0 :     MOZ_ASSERT(IsArrayBuffer(), "Wrong type!");
     335           0 :     return mValue.mArrayBuffer.Value();
     336             :   }
     337             : 
     338             :   inline ArrayBuffer const &
     339           0 :   GetAsArrayBuffer() const
     340             :   {
     341           0 :     MOZ_ASSERT(IsArrayBuffer(), "Wrong type!");
     342           0 :     return mValue.mArrayBuffer.Value();
     343             :   }
     344             : 
     345             :   nsString&
     346             :   RawSetAsUSVString();
     347             : 
     348             :   nsString&
     349             :   SetAsUSVString();
     350             : 
     351             :   bool
     352             :   TrySetToUSVString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     353             : 
     354             :   inline void
     355             :   SetStringData(const nsString::char_type* aData, nsString::size_type aLength)
     356             :   {
     357             :     RawSetAsUSVString().Assign(aData, aLength);
     358             :   }
     359             : 
     360             :   inline bool
     361           0 :   IsUSVString() const
     362             :   {
     363           0 :     return mType == eUSVString;
     364             :   }
     365             : 
     366             :   inline nsString&
     367             :   GetAsUSVString()
     368             :   {
     369             :     MOZ_ASSERT(IsUSVString(), "Wrong type!");
     370             :     return mValue.mUSVString.Value();
     371             :   }
     372             : 
     373             :   inline nsString const &
     374           0 :   GetAsUSVString() const
     375             :   {
     376           0 :     MOZ_ASSERT(IsUSVString(), "Wrong type!");
     377           0 :     return mValue.mUSVString.Value();
     378             :   }
     379             : 
     380             :   void
     381             :   Uninit();
     382             : 
     383             :   bool
     384             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     385             : 
     386             :   void
     387             :   TraceUnion(JSTracer* trc);
     388             : 
     389             : private:
     390             :   void
     391             :   DestroyArrayBufferView();
     392             : 
     393             :   void
     394             :   DestroyArrayBuffer();
     395             : 
     396             :   void
     397             :   DestroyUSVString();
     398             : };
     399             : 
     400             : 
     401           0 : struct PushEventInit : public ExtendableEventInit
     402             : {
     403             :   MOZ_INIT_OUTSIDE_CTOR Optional<OwningArrayBufferViewOrArrayBufferOrUSVString> mData;
     404             : 
     405             :   PushEventInit();
     406             : 
     407           0 :   explicit inline PushEventInit(const FastDictionaryInitializer& )
     408           0 :     : ExtendableEventInit(FastDictionaryInitializer())
     409             :   {
     410             :     // Do nothing here; this is used by our "Fast" subclass
     411           0 :   }
     412             : 
     413             : private:
     414             :   PushEventInit(const PushEventInit&) = delete;
     415             :   PushEventInit& operator=(const PushEventInit&) = delete;
     416             : 
     417             :   static bool
     418             :   InitIds(JSContext* cx, PushEventInitAtoms* atomsCache);
     419             : 
     420             : public:
     421             :   bool
     422             :   Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
     423             : 
     424             :   bool
     425             :   ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
     426             : 
     427             :   void
     428             :   TraceDictionary(JSTracer* trc);
     429             : };
     430             : 
     431             : namespace binding_detail {
     432           0 : struct FastPushEventInit : public PushEventInit
     433             : {
     434           0 :   inline FastPushEventInit()
     435           0 :     : PushEventInit(FastDictionaryInitializer())
     436             :   {
     437             :     // Doesn't matter what int we pass to the parent constructor
     438           0 :   }
     439             : };
     440             : } // namespace binding_detail
     441             : 
     442             : 
     443             : namespace PushEventBinding {
     444             : 
     445             :   typedef mozilla::dom::workers::PushEvent NativeType;
     446             : 
     447             :   bool
     448             :   ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
     449             : 
     450             :   const JSClass*
     451             :   GetJSClass();
     452             : 
     453             :   bool
     454             :   Wrap(JSContext* aCx, mozilla::dom::workers::PushEvent* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     455             : 
     456             :   template <class T>
     457           0 :   inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
     458             :   {
     459           0 :     JS::Rooted<JSObject*> reflector(aCx);
     460           0 :     return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
     461             :   }
     462             : 
     463             :   void
     464             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
     465             : 
     466             :   JS::Handle<JSObject*>
     467             :   GetProtoObjectHandle(JSContext* aCx);
     468             : 
     469             :   JS::Handle<JSObject*>
     470             :   GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
     471             : 
     472             :   JSObject*
     473             :   GetConstructorObject(JSContext* aCx);
     474             : 
     475             : } // namespace PushEventBinding
     476             : 
     477             : 
     478             : 
     479             : } // namespace dom
     480             : } // namespace mozilla
     481             : 
     482             : #endif // mozilla_dom_PushEventBinding_h

Generated by: LCOV version 1.13