Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM QueuingStrategy.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_QUEUINGSTRATEGYBINDING_H_
#define DOM_QUEUINGSTRATEGYBINDING_H_
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/CallbackFunction.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrototypeList.h"
#include "mozilla/dom/ToJSValue.h"
namespace mozilla {
namespace dom {
class ByteLengthQueuingStrategy;
class CountQueuingStrategy;
struct NativePropertyHooks;
class ProtoAndIfaceCache;
struct QueuingStrategyAtoms;
struct QueuingStrategyInitAtoms;
class QueuingStrategySize;
} // namespace dom
} // namespace mozilla
namespace mozilla::dom {
struct QueuingStrategy : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<double> mHighWaterMark;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<QueuingStrategySize>> mSize;
QueuingStrategy();
explicit inline QueuingStrategy(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
QueuingStrategy(QueuingStrategy&& aOther) = default;
private:
QueuingStrategy(const QueuingStrategy&) = delete;
QueuingStrategy& operator=(const QueuingStrategy&) = delete;
static bool
InitIds(JSContext* cx, QueuingStrategyAtoms* atomsCache);
public:
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
TraceDictionary(JSTracer* trc);
inline void
TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
{
ImplCycleCollectionTraverse(aCallback, mSize, "mSize", aFlags);
}
inline void
UnlinkForCC()
{
ImplCycleCollectionUnlink(mSize);
}
};
namespace binding_detail {
struct FastQueuingStrategy : public QueuingStrategy
{
inline FastQueuingStrategy()
: QueuingStrategy(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct QueuingStrategyInit : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR double mHighWaterMark;
QueuingStrategyInit();
explicit inline QueuingStrategyInit(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
QueuingStrategyInit(QueuingStrategyInit&& aOther) = default;
explicit inline QueuingStrategyInit(const QueuingStrategyInit& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
TraceDictionary(JSTracer* trc);
QueuingStrategyInit&
operator=(const QueuingStrategyInit& aOther);
bool
operator==(const QueuingStrategyInit& aOther) const;
private:
static bool
InitIds(JSContext* cx, QueuingStrategyInitAtoms* atomsCache);
};
namespace binding_detail {
struct FastQueuingStrategyInit : public QueuingStrategyInit
{
inline FastQueuingStrategyInit()
: QueuingStrategyInit(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
class QueuingStrategySize : public CallbackFunction
{
public:
explicit inline QueuingStrategySize(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline QueuingStrategySize(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline QueuingStrategySize(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline QueuingStrategySize(CallbackFunction* aOther)
: CallbackFunction(aOther)
{
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline double
Call(const T& thisVal, const Optional<JS::Handle<JS::Value>>& chunk, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
{
MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
if (!aExecutionReason) {
aExecutionReason = "QueuingStrategySize";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return double(0);
}
JS::Rooted<JS::Value> thisValJS(s.GetContext());
if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
aRv.Throw(NS_ERROR_FAILURE);
return double(0);
}
return Call(s.GetCallContext(), thisValJS, chunk, aRv);
}
MOZ_CAN_RUN_SCRIPT inline double
Call(const Optional<JS::Handle<JS::Value>>& chunk, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
{
MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
if (!aExecutionReason) {
aExecutionReason = "QueuingStrategySize";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return double(0);
}
return Call(s.GetCallContext(), JS::UndefinedHandleValue, chunk, aRv);
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline double
Call(const T& thisVal, const Optional<JS::Handle<JS::Value>>& chunk, const char* aExecutionReason = nullptr)
{
return Call(thisVal, chunk, IgnoreErrors(), aExecutionReason);
}
MOZ_CAN_RUN_SCRIPT inline double
Call(const Optional<JS::Handle<JS::Value>>& chunk, const char* aExecutionReason = nullptr)
{
return Call(chunk, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
}
inline bool
operator==(const QueuingStrategySize& aOther) const
{
return CallbackFunction::operator==(aOther);
}
private:
MOZ_CAN_RUN_SCRIPT double Call(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, const Optional<JS::Handle<JS::Value>>& chunk, ErrorResult& aRv);
};
namespace binding_detail {
class FastQueuingStrategySize : public QueuingStrategySize
{
public:
explicit inline FastQueuingStrategySize(JSObject* aCallback, JSObject* aCallbackGlobal)
: QueuingStrategySize(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
inline void
Trace(JSTracer* aTracer)
{
QueuingStrategySize::Trace(aTracer);
}
inline void
FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
{
QueuingStrategySize::FinishSlowJSInitIfMoreThanOneOwner(aCx);
}
};
} // namespace binding_detail
namespace ByteLengthQueuingStrategy_Binding {
typedef mozilla::dom::ByteLengthQueuingStrategy NativeType;
bool
Wrap(JSContext* aCx, mozilla::dom::ByteLengthQueuingStrategy* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
template <class T>
inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
{
JS::Rooted<JSObject*> reflector(aCx);
return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
}
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
{
/* Get the interface prototype object for this class. This will create the
object as needed. */
return GetPerInterfaceObjectHandle(aCx, prototypes::id::ByteLengthQueuingStrategy,
&CreateInterfaceObjects,
/* aDefineOnGlobal = */ true);
}
inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
{
/* Get the interface object for this class. This will create the object as
needed. */
return GetPerInterfaceObjectHandle(aCx, constructors::id::ByteLengthQueuingStrategy,
&CreateInterfaceObjects,
aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx);
} // namespace ByteLengthQueuingStrategy_Binding
namespace CountQueuingStrategy_Binding {
typedef mozilla::dom::CountQueuingStrategy NativeType;
bool
Wrap(JSContext* aCx, mozilla::dom::CountQueuingStrategy* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
template <class T>
inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
{
JS::Rooted<JSObject*> reflector(aCx);
return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
}
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
{
/* Get the interface prototype object for this class. This will create the
object as needed. */
return GetPerInterfaceObjectHandle(aCx, prototypes::id::CountQueuingStrategy,
&CreateInterfaceObjects,
/* aDefineOnGlobal = */ true);
}
inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
{
/* Get the interface object for this class. This will create the object as
needed. */
return GetPerInterfaceObjectHandle(aCx, constructors::id::CountQueuingStrategy,
&CreateInterfaceObjects,
aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx);
} // namespace CountQueuingStrategy_Binding
} // namespace mozilla::dom
#endif // DOM_QUEUINGSTRATEGYBINDING_H_