LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dist/include/mozilla/dom - SharedWorkerBinding.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 55 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 SharedWorker.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #ifndef mozilla_dom_SharedWorkerBinding_h
       4             : #define mozilla_dom_SharedWorkerBinding_h
       5             : 
       6             : #include "WorkerBinding.h"
       7             : #include "js/RootingAPI.h"
       8             : #include "jspubtd.h"
       9             : #include "mozilla/ErrorResult.h"
      10             : #include "mozilla/dom/BindingDeclarations.h"
      11             : #include "mozilla/dom/FakeString.h"
      12             : #include "mozilla/dom/Nullable.h"
      13             : #include "mozilla/dom/UnionMember.h"
      14             : 
      15             : namespace mozilla {
      16             : namespace dom {
      17             : 
      18             : struct NativePropertyHooks;
      19             : class ProtoAndIfaceCache;
      20             : 
      21             : namespace workers {
      22             : 
      23             : class SharedWorker;
      24             : struct SharedWorkerAtoms;
      25             : 
      26             : } // namespace workers
      27             : 
      28             : } // namespace dom
      29             : } // namespace mozilla
      30             : 
      31             : namespace mozilla {
      32             : namespace dom {
      33             : 
      34             : class StringOrWorkerOptions
      35             : {
      36             :   friend class StringOrWorkerOptionsArgument;
      37             :   enum Type
      38             :   {
      39             :     eUninitialized,
      40             :     eString,
      41             :     eWorkerOptions
      42             :   };
      43             : 
      44           0 :   union Value
      45             :   {
      46             :     UnionMember<binding_detail::FakeString > mString;
      47             :     UnionMember<binding_detail::FastWorkerOptions > mWorkerOptions;
      48             : 
      49             :   };
      50             : 
      51             :   Type mType;
      52             :   Value mValue;
      53             : 
      54             :   StringOrWorkerOptions(const StringOrWorkerOptions&) = delete;
      55             :   StringOrWorkerOptions& operator=(const StringOrWorkerOptions&) = delete;
      56             : public:
      57           0 :   explicit inline StringOrWorkerOptions()
      58           0 :     : mType(eUninitialized)
      59             :   {
      60           0 :   }
      61             : 
      62           0 :   inline ~StringOrWorkerOptions()
      63           0 :   {
      64           0 :     Uninit();
      65           0 :   }
      66             : 
      67             :   inline binding_detail::FakeString&
      68             :   RawSetAsString()
      69             :   {
      70             :     if (mType == eString) {
      71             :       return mValue.mString.Value();
      72             :     }
      73             :     MOZ_ASSERT(mType == eUninitialized);
      74             :     mType = eString;
      75             :     return mValue.mString.SetValue();
      76             :   }
      77             : 
      78             :   inline binding_detail::FakeString&
      79             :   SetAsString()
      80             :   {
      81             :     if (mType == eString) {
      82             :       return mValue.mString.Value();
      83             :     }
      84             :     Uninit();
      85             :     mType = eString;
      86             :     return mValue.mString.SetValue();
      87             :   }
      88             : 
      89             :   inline bool
      90           0 :   IsString() const
      91             :   {
      92           0 :     return mType == eString;
      93             :   }
      94             : 
      95             :   inline binding_detail::FakeString&
      96             :   GetAsString()
      97             :   {
      98             :     MOZ_ASSERT(IsString(), "Wrong type!");
      99             :     return mValue.mString.Value();
     100             :   }
     101             : 
     102             :   inline const nsAString&
     103           0 :   GetAsString() const
     104             :   {
     105           0 :     MOZ_ASSERT(IsString(), "Wrong type!");
     106           0 :     return mValue.mString.Value();
     107             :   }
     108             : 
     109             :   inline binding_detail::FastWorkerOptions&
     110           0 :   RawSetAsWorkerOptions()
     111             :   {
     112           0 :     if (mType == eWorkerOptions) {
     113           0 :       return mValue.mWorkerOptions.Value();
     114             :     }
     115           0 :     MOZ_ASSERT(mType == eUninitialized);
     116           0 :     mType = eWorkerOptions;
     117           0 :     return mValue.mWorkerOptions.SetValue();
     118             :   }
     119             : 
     120             :   inline binding_detail::FastWorkerOptions&
     121             :   SetAsWorkerOptions()
     122             :   {
     123             :     if (mType == eWorkerOptions) {
     124             :       return mValue.mWorkerOptions.Value();
     125             :     }
     126             :     Uninit();
     127             :     mType = eWorkerOptions;
     128             :     return mValue.mWorkerOptions.SetValue();
     129             :   }
     130             : 
     131             :   inline bool
     132           0 :   IsWorkerOptions() const
     133             :   {
     134           0 :     return mType == eWorkerOptions;
     135             :   }
     136             : 
     137             :   inline binding_detail::FastWorkerOptions&
     138             :   GetAsWorkerOptions()
     139             :   {
     140             :     MOZ_ASSERT(IsWorkerOptions(), "Wrong type!");
     141             :     return mValue.mWorkerOptions.Value();
     142             :   }
     143             : 
     144             :   inline const WorkerOptions&
     145           0 :   GetAsWorkerOptions() const
     146             :   {
     147           0 :     MOZ_ASSERT(IsWorkerOptions(), "Wrong type!");
     148           0 :     return mValue.mWorkerOptions.Value();
     149             :   }
     150             : 
     151             :   inline void
     152           0 :   Uninit()
     153             :   {
     154           0 :     switch (mType) {
     155             :       case eUninitialized: {
     156           0 :         break;
     157             :       }
     158             :       case eString: {
     159           0 :         DestroyString();
     160           0 :         break;
     161             :       }
     162             :       case eWorkerOptions: {
     163           0 :         DestroyWorkerOptions();
     164           0 :         break;
     165             :       }
     166             :     }
     167           0 :   }
     168             : 
     169             :   bool
     170             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     171             : 
     172             : private:
     173             :   inline void
     174           0 :   DestroyString()
     175             :   {
     176           0 :     MOZ_ASSERT(IsString(), "Wrong type!");
     177           0 :     mValue.mString.Destroy();
     178           0 :     mType = eUninitialized;
     179           0 :   }
     180             : 
     181             :   inline void
     182           0 :   DestroyWorkerOptions()
     183             :   {
     184           0 :     MOZ_ASSERT(IsWorkerOptions(), "Wrong type!");
     185           0 :     mValue.mWorkerOptions.Destroy();
     186           0 :     mType = eUninitialized;
     187           0 :   }
     188             : };
     189             : 
     190             : 
     191             : class OwningStringOrWorkerOptions : public AllOwningUnionBase
     192             : {
     193             :   friend void ImplCycleCollectionUnlink(OwningStringOrWorkerOptions& aUnion);
     194             :   enum Type
     195             :   {
     196             :     eUninitialized,
     197             :     eString,
     198             :     eWorkerOptions
     199             :   };
     200             : 
     201             :   union Value
     202             :   {
     203             :     UnionMember<nsString > mString;
     204             :     UnionMember<WorkerOptions > mWorkerOptions;
     205             : 
     206             :   };
     207             : 
     208             :   Type mType;
     209             :   Value mValue;
     210             : 
     211             : public:
     212             :   explicit inline OwningStringOrWorkerOptions()
     213             :     : mType(eUninitialized)
     214             :   {
     215             :   }
     216             : 
     217             :   explicit inline OwningStringOrWorkerOptions(const OwningStringOrWorkerOptions& aOther)
     218             :     : mType(eUninitialized)
     219             :   {
     220             :     *this = aOther;
     221             :   }
     222             : 
     223             :   inline ~OwningStringOrWorkerOptions()
     224             :   {
     225             :     Uninit();
     226             :   }
     227             : 
     228             :   nsString&
     229             :   RawSetAsString();
     230             : 
     231             :   nsString&
     232             :   SetAsString();
     233             : 
     234             :   bool
     235             :   TrySetToString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     236             : 
     237             :   inline void
     238             :   SetStringData(const nsString::char_type* aData, nsString::size_type aLength)
     239             :   {
     240             :     RawSetAsString().Assign(aData, aLength);
     241             :   }
     242             : 
     243             :   inline bool
     244           0 :   IsString() const
     245             :   {
     246           0 :     return mType == eString;
     247             :   }
     248             : 
     249             :   inline nsString&
     250             :   GetAsString()
     251             :   {
     252             :     MOZ_ASSERT(IsString(), "Wrong type!");
     253             :     return mValue.mString.Value();
     254             :   }
     255             : 
     256             :   inline nsString const &
     257           0 :   GetAsString() const
     258             :   {
     259           0 :     MOZ_ASSERT(IsString(), "Wrong type!");
     260           0 :     return mValue.mString.Value();
     261             :   }
     262             : 
     263             :   WorkerOptions&
     264             :   RawSetAsWorkerOptions();
     265             : 
     266             :   WorkerOptions&
     267             :   SetAsWorkerOptions();
     268             : 
     269             :   bool
     270             :   TrySetToWorkerOptions(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     271             : 
     272             :   inline bool
     273           0 :   IsWorkerOptions() const
     274             :   {
     275           0 :     return mType == eWorkerOptions;
     276             :   }
     277             : 
     278             :   inline WorkerOptions&
     279             :   GetAsWorkerOptions()
     280             :   {
     281             :     MOZ_ASSERT(IsWorkerOptions(), "Wrong type!");
     282             :     return mValue.mWorkerOptions.Value();
     283             :   }
     284             : 
     285             :   inline WorkerOptions const &
     286           0 :   GetAsWorkerOptions() const
     287             :   {
     288           0 :     MOZ_ASSERT(IsWorkerOptions(), "Wrong type!");
     289           0 :     return mValue.mWorkerOptions.Value();
     290             :   }
     291             : 
     292             :   void
     293             :   Uninit();
     294             : 
     295             :   bool
     296             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     297             : 
     298             :   void
     299             :   TraceUnion(JSTracer* trc);
     300             : 
     301             :   OwningStringOrWorkerOptions&
     302             :   operator=(const OwningStringOrWorkerOptions& aOther);
     303             : 
     304             : private:
     305             :   void
     306             :   DestroyString();
     307             : 
     308             :   void
     309             :   DestroyWorkerOptions();
     310             : };
     311             : 
     312             : 
     313             : namespace SharedWorkerBinding {
     314             : 
     315             :   typedef mozilla::dom::workers::SharedWorker NativeType;
     316             : 
     317             :   JSObject*
     318             :   DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
     319             : 
     320             :   const JSClass*
     321             :   GetJSClass();
     322             : 
     323             :   bool
     324             :   Wrap(JSContext* aCx, mozilla::dom::workers::SharedWorker* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     325             : 
     326             :   template <class T>
     327           0 :   inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
     328             :   {
     329           0 :     JS::Rooted<JSObject*> reflector(aCx);
     330           0 :     return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
     331             :   }
     332             : 
     333             :   // We declare this as an array so that retrieving a pointer to this
     334             :   // binding's property hooks only requires compile/link-time resolvable
     335             :   // address arithmetic.  Declaring it as a pointer instead would require
     336             :   // doing a run-time load to fetch a pointer to this binding's property
     337             :   // hooks.  And then structures which embedded a pointer to this structure
     338             :   // would require a run-time load for proper initialization, which would
     339             :   // then induce static constructors.  Lots of static constructors.
     340             :   extern const NativePropertyHooks sNativePropertyHooks[];
     341             : 
     342             :   void
     343             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
     344             : 
     345             :   JS::Handle<JSObject*>
     346             :   GetProtoObjectHandle(JSContext* aCx);
     347             : 
     348             :   JS::Handle<JSObject*>
     349             :   GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
     350             : 
     351             :   JSObject*
     352             :   GetConstructorObject(JSContext* aCx);
     353             : 
     354             : } // namespace SharedWorkerBinding
     355             : 
     356             : 
     357             : 
     358             : } // namespace dom
     359             : } // namespace mozilla
     360             : 
     361             : #endif // mozilla_dom_SharedWorkerBinding_h

Generated by: LCOV version 1.13