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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM MediaStream.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #ifndef mozilla_dom_MediaStreamBinding_h
       4             : #define mozilla_dom_MediaStreamBinding_h
       5             : 
       6             : #include "MediaStreamTrackBinding.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             : 
      17             : class DOMMediaStream;
      18             : struct DOMMediaStreamAtoms;
      19             : 
      20             : namespace dom {
      21             : 
      22             : class BooleanOrMediaTrackConstraints;
      23             : struct MediaStreamConstraintsAtoms;
      24             : struct NativePropertyHooks;
      25             : class OwningBooleanOrMediaTrackConstraints;
      26             : class ProtoAndIfaceCache;
      27             : 
      28             : } // namespace dom
      29             : 
      30             : } // namespace mozilla
      31             : 
      32             : namespace mozilla {
      33             : namespace dom {
      34             : 
      35             : class BooleanOrMediaTrackConstraints
      36             : {
      37             :   friend class BooleanOrMediaTrackConstraintsArgument;
      38             :   enum Type
      39             :   {
      40             :     eUninitialized,
      41             :     eBoolean,
      42             :     eMediaTrackConstraints
      43             :   };
      44             : 
      45             :   union Value
      46             :   {
      47             :     UnionMember<bool > mBoolean;
      48             :     UnionMember<binding_detail::FastMediaTrackConstraints > mMediaTrackConstraints;
      49             : 
      50             :   };
      51             : 
      52             :   Type mType;
      53             :   Value mValue;
      54             : 
      55             :   BooleanOrMediaTrackConstraints(const BooleanOrMediaTrackConstraints&) = delete;
      56             :   BooleanOrMediaTrackConstraints& operator=(const BooleanOrMediaTrackConstraints&) = delete;
      57             : public:
      58             :   explicit inline BooleanOrMediaTrackConstraints()
      59             :     : mType(eUninitialized)
      60             :   {
      61             :   }
      62             : 
      63             :   inline ~BooleanOrMediaTrackConstraints()
      64             :   {
      65             :     Uninit();
      66             :   }
      67             : 
      68             :   inline bool&
      69             :   RawSetAsBoolean()
      70             :   {
      71             :     if (mType == eBoolean) {
      72             :       return mValue.mBoolean.Value();
      73             :     }
      74             :     MOZ_ASSERT(mType == eUninitialized);
      75             :     mType = eBoolean;
      76             :     return mValue.mBoolean.SetValue();
      77             :   }
      78             : 
      79             :   inline bool&
      80             :   SetAsBoolean()
      81             :   {
      82             :     if (mType == eBoolean) {
      83             :       return mValue.mBoolean.Value();
      84             :     }
      85             :     Uninit();
      86             :     mType = eBoolean;
      87             :     return mValue.mBoolean.SetValue();
      88             :   }
      89             : 
      90             :   inline bool
      91             :   IsBoolean() const
      92             :   {
      93             :     return mType == eBoolean;
      94             :   }
      95             : 
      96             :   inline bool&
      97             :   GetAsBoolean()
      98             :   {
      99             :     MOZ_ASSERT(IsBoolean(), "Wrong type!");
     100             :     return mValue.mBoolean.Value();
     101             :   }
     102             : 
     103             :   inline bool
     104             :   GetAsBoolean() const
     105             :   {
     106             :     MOZ_ASSERT(IsBoolean(), "Wrong type!");
     107             :     return mValue.mBoolean.Value();
     108             :   }
     109             : 
     110             :   inline binding_detail::FastMediaTrackConstraints&
     111             :   RawSetAsMediaTrackConstraints()
     112             :   {
     113             :     if (mType == eMediaTrackConstraints) {
     114             :       return mValue.mMediaTrackConstraints.Value();
     115             :     }
     116             :     MOZ_ASSERT(mType == eUninitialized);
     117             :     mType = eMediaTrackConstraints;
     118             :     return mValue.mMediaTrackConstraints.SetValue();
     119             :   }
     120             : 
     121             :   inline binding_detail::FastMediaTrackConstraints&
     122             :   SetAsMediaTrackConstraints()
     123             :   {
     124             :     if (mType == eMediaTrackConstraints) {
     125             :       return mValue.mMediaTrackConstraints.Value();
     126             :     }
     127             :     Uninit();
     128             :     mType = eMediaTrackConstraints;
     129             :     return mValue.mMediaTrackConstraints.SetValue();
     130             :   }
     131             : 
     132             :   inline bool
     133             :   IsMediaTrackConstraints() const
     134             :   {
     135             :     return mType == eMediaTrackConstraints;
     136             :   }
     137             : 
     138             :   inline binding_detail::FastMediaTrackConstraints&
     139             :   GetAsMediaTrackConstraints()
     140             :   {
     141             :     MOZ_ASSERT(IsMediaTrackConstraints(), "Wrong type!");
     142             :     return mValue.mMediaTrackConstraints.Value();
     143             :   }
     144             : 
     145             :   inline const MediaTrackConstraints&
     146             :   GetAsMediaTrackConstraints() const
     147             :   {
     148             :     MOZ_ASSERT(IsMediaTrackConstraints(), "Wrong type!");
     149             :     return mValue.mMediaTrackConstraints.Value();
     150             :   }
     151             : 
     152             :   inline void
     153             :   Uninit()
     154             :   {
     155             :     switch (mType) {
     156             :       case eUninitialized: {
     157             :         break;
     158             :       }
     159             :       case eBoolean: {
     160             :         DestroyBoolean();
     161             :         break;
     162             :       }
     163             :       case eMediaTrackConstraints: {
     164             :         DestroyMediaTrackConstraints();
     165             :         break;
     166             :       }
     167             :     }
     168             :   }
     169             : 
     170             :   bool
     171             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     172             : 
     173             : private:
     174             :   inline void
     175             :   DestroyBoolean()
     176             :   {
     177             :     MOZ_ASSERT(IsBoolean(), "Wrong type!");
     178             :     mValue.mBoolean.Destroy();
     179             :     mType = eUninitialized;
     180             :   }
     181             : 
     182             :   inline void
     183             :   DestroyMediaTrackConstraints()
     184             :   {
     185             :     MOZ_ASSERT(IsMediaTrackConstraints(), "Wrong type!");
     186             :     mValue.mMediaTrackConstraints.Destroy();
     187             :     mType = eUninitialized;
     188             :   }
     189             : };
     190             : 
     191             : 
     192             : class OwningBooleanOrMediaTrackConstraints : public AllOwningUnionBase
     193             : {
     194             :   friend void ImplCycleCollectionUnlink(OwningBooleanOrMediaTrackConstraints& aUnion);
     195             :   enum Type
     196             :   {
     197             :     eUninitialized,
     198             :     eBoolean,
     199             :     eMediaTrackConstraints
     200             :   };
     201             : 
     202           0 :   union Value
     203             :   {
     204             :     UnionMember<bool > mBoolean;
     205             :     UnionMember<MediaTrackConstraints > mMediaTrackConstraints;
     206             : 
     207             :   };
     208             : 
     209             :   Type mType;
     210             :   Value mValue;
     211             : 
     212             : public:
     213           0 :   explicit inline OwningBooleanOrMediaTrackConstraints()
     214           0 :     : mType(eUninitialized)
     215             :   {
     216           0 :   }
     217             : 
     218             :   explicit inline OwningBooleanOrMediaTrackConstraints(const OwningBooleanOrMediaTrackConstraints& aOther)
     219             :     : mType(eUninitialized)
     220             :   {
     221             :     *this = aOther;
     222             :   }
     223             : 
     224           0 :   inline ~OwningBooleanOrMediaTrackConstraints()
     225           0 :   {
     226           0 :     Uninit();
     227           0 :   }
     228             : 
     229             :   bool&
     230             :   RawSetAsBoolean();
     231             : 
     232             :   bool&
     233             :   SetAsBoolean();
     234             : 
     235             :   bool
     236             :   TrySetToBoolean(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     237             : 
     238             :   inline bool
     239           0 :   IsBoolean() const
     240             :   {
     241           0 :     return mType == eBoolean;
     242             :   }
     243             : 
     244             :   inline bool&
     245             :   GetAsBoolean()
     246             :   {
     247             :     MOZ_ASSERT(IsBoolean(), "Wrong type!");
     248             :     return mValue.mBoolean.Value();
     249             :   }
     250             : 
     251             :   inline bool const &
     252           0 :   GetAsBoolean() const
     253             :   {
     254           0 :     MOZ_ASSERT(IsBoolean(), "Wrong type!");
     255           0 :     return mValue.mBoolean.Value();
     256             :   }
     257             : 
     258             :   MediaTrackConstraints&
     259             :   RawSetAsMediaTrackConstraints();
     260             : 
     261             :   MediaTrackConstraints&
     262             :   SetAsMediaTrackConstraints();
     263             : 
     264             :   bool
     265             :   TrySetToMediaTrackConstraints(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
     266             : 
     267             :   inline bool
     268           0 :   IsMediaTrackConstraints() const
     269             :   {
     270           0 :     return mType == eMediaTrackConstraints;
     271             :   }
     272             : 
     273             :   inline MediaTrackConstraints&
     274           0 :   GetAsMediaTrackConstraints()
     275             :   {
     276           0 :     MOZ_ASSERT(IsMediaTrackConstraints(), "Wrong type!");
     277           0 :     return mValue.mMediaTrackConstraints.Value();
     278             :   }
     279             : 
     280             :   inline MediaTrackConstraints const &
     281           0 :   GetAsMediaTrackConstraints() const
     282             :   {
     283           0 :     MOZ_ASSERT(IsMediaTrackConstraints(), "Wrong type!");
     284           0 :     return mValue.mMediaTrackConstraints.Value();
     285             :   }
     286             : 
     287             :   void
     288             :   Uninit();
     289             : 
     290             :   bool
     291             :   ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
     292             : 
     293             :   void
     294             :   TraceUnion(JSTracer* trc);
     295             : 
     296             :   OwningBooleanOrMediaTrackConstraints&
     297             :   operator=(const OwningBooleanOrMediaTrackConstraints& aOther);
     298             : 
     299             : private:
     300             :   void
     301             :   DestroyBoolean();
     302             : 
     303             :   void
     304             :   DestroyMediaTrackConstraints();
     305             : };
     306             : 
     307             : 
     308           0 : struct MediaStreamConstraints : public DictionaryBase
     309             : {
     310             :   MOZ_INIT_OUTSIDE_CTOR OwningBooleanOrMediaTrackConstraints mAudio;
     311             :   MOZ_INIT_OUTSIDE_CTOR Optional<bool> mFake;
     312             :   MOZ_INIT_OUTSIDE_CTOR nsString mPeerIdentity;
     313             :   MOZ_INIT_OUTSIDE_CTOR bool mPicture;
     314             :   MOZ_INIT_OUTSIDE_CTOR OwningBooleanOrMediaTrackConstraints mVideo;
     315             : 
     316             :   MediaStreamConstraints();
     317             : 
     318           0 :   explicit inline MediaStreamConstraints(const FastDictionaryInitializer& )
     319           0 :   {
     320             :     // Do nothing here; this is used by our "Fast" subclass
     321           0 :   }
     322             : 
     323           0 :   explicit inline MediaStreamConstraints(const MediaStreamConstraints& aOther)
     324           0 :   {
     325           0 :     *this = aOther;
     326           0 :   }
     327             : 
     328             :   bool
     329             :   Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
     330             : 
     331             :   bool
     332             :   Init(const nsAString& aJSON);
     333             : 
     334             :   bool
     335             :   ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
     336             : 
     337             :   bool
     338             :   ToJSON(nsAString& aJSON) const;
     339             : 
     340             :   void
     341             :   TraceDictionary(JSTracer* trc);
     342             : 
     343             :   MediaStreamConstraints&
     344             :   operator=(const MediaStreamConstraints& aOther);
     345             : 
     346             : private:
     347             :   static bool
     348             :   InitIds(JSContext* cx, MediaStreamConstraintsAtoms* atomsCache);
     349             : };
     350             : 
     351             : namespace binding_detail {
     352           0 : struct FastMediaStreamConstraints : public MediaStreamConstraints
     353             : {
     354           0 :   inline FastMediaStreamConstraints()
     355           0 :     : MediaStreamConstraints(FastDictionaryInitializer())
     356             :   {
     357             :     // Doesn't matter what int we pass to the parent constructor
     358           0 :   }
     359             : };
     360             : } // namespace binding_detail
     361             : 
     362             : 
     363             : namespace MediaStreamBinding {
     364             : 
     365             :   typedef mozilla::DOMMediaStream NativeType;
     366             : 
     367             :   JSObject*
     368             :   DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
     369             : 
     370             :   const JSClass*
     371             :   GetJSClass();
     372             : 
     373             :   bool
     374             :   Wrap(JSContext* aCx, mozilla::DOMMediaStream* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     375             : 
     376             :   template <class T>
     377           0 :   inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
     378             :   {
     379           0 :     JS::Rooted<JSObject*> reflector(aCx);
     380           0 :     return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
     381             :   }
     382             : 
     383             :   // We declare this as an array so that retrieving a pointer to this
     384             :   // binding's property hooks only requires compile/link-time resolvable
     385             :   // address arithmetic.  Declaring it as a pointer instead would require
     386             :   // doing a run-time load to fetch a pointer to this binding's property
     387             :   // hooks.  And then structures which embedded a pointer to this structure
     388             :   // would require a run-time load for proper initialization, which would
     389             :   // then induce static constructors.  Lots of static constructors.
     390             :   extern const NativePropertyHooks sNativePropertyHooks[];
     391             : 
     392             :   void
     393             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
     394             : 
     395             :   JS::Handle<JSObject*>
     396             :   GetProtoObjectHandle(JSContext* aCx);
     397             : 
     398             :   JSObject*
     399             :   GetProtoObject(JSContext* aCx);
     400             : 
     401             :   JS::Handle<JSObject*>
     402             :   GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
     403             : 
     404             :   JSObject*
     405             :   GetConstructorObject(JSContext* aCx);
     406             : 
     407             : } // namespace MediaStreamBinding
     408             : 
     409             : 
     410             : 
     411             : } // namespace dom
     412             : } // namespace mozilla
     413             : 
     414             : #endif // mozilla_dom_MediaStreamBinding_h

Generated by: LCOV version 1.13