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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM Promise.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #ifndef mozilla_dom_PromiseBinding_h
       4             : #define mozilla_dom_PromiseBinding_h
       5             : 
       6             : #include "js/RootingAPI.h"
       7             : #include "jspubtd.h"
       8             : #include "mozilla/ErrorResult.h"
       9             : #include "mozilla/dom/BindingDeclarations.h"
      10             : #include "mozilla/dom/CallbackFunction.h"
      11             : #include "mozilla/dom/Nullable.h"
      12             : #include "mozilla/dom/ToJSValue.h"
      13             : 
      14             : namespace mozilla {
      15             : namespace dom {
      16             : 
      17             : class AnyCallback;
      18             : struct NativePropertyHooks;
      19             : class PromiseJobCallback;
      20             : class PromiseNativeHandler;
      21             : struct PromiseNativeHandlerAtoms;
      22             : class ProtoAndIfaceCache;
      23             : 
      24             : } // namespace dom
      25             : } // namespace mozilla
      26             : 
      27             : namespace mozilla {
      28             : namespace dom {
      29             : 
      30         675 : class PromiseJobCallback : public CallbackFunction
      31             : {
      32             : public:
      33             :   explicit inline PromiseJobCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
      34             :     : CallbackFunction(aCx, aCallback, aIncumbentGlobal)
      35             :   {
      36             :     MOZ_ASSERT(JS::IsCallable(mCallback));
      37             :   }
      38             : 
      39             :   explicit inline PromiseJobCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
      40             :     : CallbackFunction(aCallback, FastCallbackConstructor())
      41             :   {
      42             :     MOZ_ASSERT(JS::IsCallable(mCallback));
      43             :   }
      44             : 
      45         235 :   explicit inline PromiseJobCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
      46         235 :     : CallbackFunction(aCallback, aAsyncStack, aIncumbentGlobal)
      47             :   {
      48         235 :     MOZ_ASSERT(JS::IsCallable(mCallback));
      49         235 :   }
      50             : 
      51             :   explicit inline PromiseJobCallback(CallbackFunction* aOther)
      52             :     : CallbackFunction(aOther)
      53             :   {
      54             :   }
      55             : 
      56             :   template <typename T>
      57             :   inline void
      58             :   Call(const T& thisVal, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
      59             :   {
      60             :     MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
      61             :     if (!aExecutionReason) {
      62             :       aExecutionReason = "PromiseJobCallback";
      63             :     }
      64             :     CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
      65             :     if (!s.GetContext()) {
      66             :       MOZ_ASSERT(aRv.Failed());
      67             :       return;
      68             :     }
      69             :     JS::Rooted<JS::Value> thisValJS(s.GetContext());
      70             :     if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
      71             :       aRv.Throw(NS_ERROR_FAILURE);
      72             :       return;
      73             :     }
      74             :     return Call(s.GetContext(), thisValJS, aRv);
      75             :   }
      76             : 
      77             :   inline void
      78         235 :   Call(ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
      79             :   {
      80         235 :     MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
      81         235 :     if (!aExecutionReason) {
      82           0 :       aExecutionReason = "PromiseJobCallback";
      83             :     }
      84         470 :     CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
      85         235 :     if (!s.GetContext()) {
      86           0 :       MOZ_ASSERT(aRv.Failed());
      87           0 :       return;
      88             :     }
      89         235 :     return Call(s.GetContext(), JS::UndefinedHandleValue, aRv);
      90             :   }
      91             : 
      92             :   template <typename T>
      93             :   inline void
      94             :   Call(const T& thisVal, const char* aExecutionReason = nullptr)
      95             :   {
      96             :     IgnoredErrorResult rv;
      97             :     return Call(thisVal, rv, aExecutionReason);
      98             :   }
      99             : 
     100             :   inline void
     101         235 :   Call(const char* aExecutionReason = nullptr)
     102             :   {
     103         470 :     IgnoredErrorResult rv;
     104         470 :     return Call(rv, aExecutionReason, eReportExceptions, nullptr);
     105             :   }
     106             : 
     107             :   inline bool
     108             :   operator==(const PromiseJobCallback& aOther) const
     109             :   {
     110             :     return CallbackFunction::operator==(aOther);
     111             :   }
     112             : 
     113             : private:
     114             :   void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, ErrorResult& aRv);
     115             : };
     116             : 
     117             : 
     118           0 : class AnyCallback : public CallbackFunction
     119             : {
     120             : public:
     121             :   explicit inline AnyCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
     122             :     : CallbackFunction(aCx, aCallback, aIncumbentGlobal)
     123             :   {
     124             :     MOZ_ASSERT(JS::IsCallable(mCallback));
     125             :   }
     126             : 
     127           0 :   explicit inline AnyCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
     128           0 :     : CallbackFunction(aCallback, FastCallbackConstructor())
     129             :   {
     130           0 :     MOZ_ASSERT(JS::IsCallable(mCallback));
     131           0 :   }
     132             : 
     133             :   explicit inline AnyCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
     134             :     : CallbackFunction(aCallback, aAsyncStack, aIncumbentGlobal)
     135             :   {
     136             :     MOZ_ASSERT(JS::IsCallable(mCallback));
     137             :   }
     138             : 
     139             :   explicit inline AnyCallback(CallbackFunction* aOther)
     140             :     : CallbackFunction(aOther)
     141             :   {
     142             :   }
     143             : 
     144             :   template <typename T>
     145             :   inline void
     146             :   Call(const T& thisVal, JS::Handle<JS::Value> value, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
     147             :   {
     148             :     MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
     149             :     if (!aExecutionReason) {
     150             :       aExecutionReason = "AnyCallback";
     151             :     }
     152             :     CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
     153             :     if (!s.GetContext()) {
     154             :       MOZ_ASSERT(aRv.Failed());
     155             :       return;
     156             :     }
     157             :     JS::Rooted<JS::Value> thisValJS(s.GetContext());
     158             :     if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
     159             :       aRv.Throw(NS_ERROR_FAILURE);
     160             :       return;
     161             :     }
     162             :     return Call(s.GetContext(), thisValJS, value, aRetVal, aRv);
     163             :   }
     164             : 
     165             :   inline void
     166           0 :   Call(JS::Handle<JS::Value> value, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
     167             :   {
     168           0 :     MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
     169           0 :     if (!aExecutionReason) {
     170           0 :       aExecutionReason = "AnyCallback";
     171             :     }
     172           0 :     CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
     173           0 :     if (!s.GetContext()) {
     174           0 :       MOZ_ASSERT(aRv.Failed());
     175           0 :       return;
     176             :     }
     177           0 :     return Call(s.GetContext(), JS::UndefinedHandleValue, value, aRetVal, aRv);
     178             :   }
     179             : 
     180             :   template <typename T>
     181             :   inline void
     182             :   Call(const T& thisVal, JS::Handle<JS::Value> value, JS::MutableHandle<JS::Value> aRetVal, const char* aExecutionReason = nullptr)
     183             :   {
     184             :     IgnoredErrorResult rv;
     185             :     return Call(thisVal, value, aRetVal, rv, aExecutionReason);
     186             :   }
     187             : 
     188             :   inline void
     189           0 :   Call(JS::Handle<JS::Value> value, JS::MutableHandle<JS::Value> aRetVal, const char* aExecutionReason = nullptr)
     190             :   {
     191           0 :     IgnoredErrorResult rv;
     192           0 :     return Call(value, aRetVal, rv, aExecutionReason, eReportExceptions, nullptr);
     193             :   }
     194             : 
     195             :   inline bool
     196             :   operator==(const AnyCallback& aOther) const
     197             :   {
     198             :     return CallbackFunction::operator==(aOther);
     199             :   }
     200             : 
     201             : private:
     202             :   void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, JS::Handle<JS::Value> value, JS::MutableHandle<JS::Value> aRetVal, ErrorResult& aRv);
     203             : };
     204             : 
     205             : 
     206             : namespace binding_detail {
     207             : class FastPromiseJobCallback : public PromiseJobCallback
     208             : {
     209             : public:
     210             :   explicit inline FastPromiseJobCallback(JS::Handle<JSObject*> aCallback)
     211             :     : PromiseJobCallback(aCallback, FastCallbackConstructor())
     212             :   {
     213             :   }
     214             : 
     215             :   inline void
     216             :   Trace(JSTracer* aTracer)
     217             :   {
     218             :     PromiseJobCallback::Trace(aTracer);
     219             :   }
     220             : 
     221             :   inline void
     222             :   FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
     223             :   {
     224             :     PromiseJobCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
     225             :   }
     226             : };
     227             : } // namespace binding_detail
     228             : 
     229             : 
     230             : namespace binding_detail {
     231           0 : class FastAnyCallback : public AnyCallback
     232             : {
     233             : public:
     234           0 :   explicit inline FastAnyCallback(JS::Handle<JSObject*> aCallback)
     235           0 :     : AnyCallback(aCallback, FastCallbackConstructor())
     236             :   {
     237           0 :   }
     238             : 
     239             :   inline void
     240           0 :   Trace(JSTracer* aTracer)
     241             :   {
     242           0 :     AnyCallback::Trace(aTracer);
     243           0 :   }
     244             : 
     245             :   inline void
     246           0 :   FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
     247             :   {
     248           0 :     AnyCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
     249           0 :   }
     250             : };
     251             : } // namespace binding_detail
     252             : 
     253             : 
     254             : namespace PromiseNativeHandlerBinding {
     255             : 
     256             :   typedef mozilla::dom::PromiseNativeHandler NativeType;
     257             : 
     258             :   const JSClass*
     259             :   GetJSClass();
     260             : 
     261             :   bool
     262             :   Wrap(JSContext* aCx, mozilla::dom::PromiseNativeHandler* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
     263             : 
     264             :   // We declare this as an array so that retrieving a pointer to this
     265             :   // binding's property hooks only requires compile/link-time resolvable
     266             :   // address arithmetic.  Declaring it as a pointer instead would require
     267             :   // doing a run-time load to fetch a pointer to this binding's property
     268             :   // hooks.  And then structures which embedded a pointer to this structure
     269             :   // would require a run-time load for proper initialization, which would
     270             :   // then induce static constructors.  Lots of static constructors.
     271             :   extern const NativePropertyHooks sNativePropertyHooks[];
     272             : 
     273             :   void
     274             :   CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
     275             : 
     276             :   JS::Handle<JSObject*>
     277             :   GetProtoObjectHandle(JSContext* aCx);
     278             : 
     279             : } // namespace PromiseNativeHandlerBinding
     280             : 
     281             : 
     282             : 
     283             : } // namespace dom
     284             : } // namespace mozilla
     285             : 
     286             : #endif // mozilla_dom_PromiseBinding_h

Generated by: LCOV version 1.13