#pragma once
#include "JSDOMWrapper.h"
#include "SetLike.h"
#include <wtf/NeverDestroyed.h>
namespace WebCore {
class JSSetLike : public JSDOMWrapper<SetLike> {
public:
using Base = JSDOMWrapper<SetLike>;
static JSSetLike* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<SetLike>&& impl)
{
JSSetLike* ptr = new (NotNull, JSC::allocateCell<JSSetLike>(globalObject->vm().heap)) JSSetLike(structure, *globalObject, WTFMove(impl));
ptr->finishCreation(globalObject->vm());
return ptr;
}
static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
static SetLike* toWrapped(JSC::VM&, JSC::JSValue);
static void destroy(JSC::JSCell*);
DECLARE_INFO;
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
{
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info(), JSC::NonArray);
}
static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
template<typename, JSC::SubspaceAccess mode> static JSC::IsoSubspace* subspaceFor(JSC::VM& vm)
{
if constexpr (mode == JSC::SubspaceAccess::Concurrently)
return nullptr;
return subspaceForImpl(vm);
}
static JSC::IsoSubspace* subspaceForImpl(JSC::VM& vm);
static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&);
protected:
JSSetLike(JSC::Structure*, JSDOMGlobalObject&, Ref<SetLike>&&);
void finishCreation(JSC::VM&);
};
class JSSetLikeOwner : public JSC::WeakHandleOwner {
public:
virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&, const char**);
virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
};
inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, SetLike*)
{
static NeverDestroyed<JSSetLikeOwner> owner;
return &owner.get();
}
inline void* wrapperKey(SetLike* wrappableObject)
{
return wrappableObject;
}
JSC::JSValue toJS(JSC::JSGlobalObject*, JSDOMGlobalObject*, SetLike&);
inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, SetLike* impl) { return impl ? toJS(lexicalGlobalObject, globalObject, *impl) : JSC::jsNull(); }
JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject*, Ref<SetLike>&&);
inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, RefPtr<SetLike>&& impl) { return impl ? toJSNewlyCreated(lexicalGlobalObject, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
template<> struct JSDOMWrapperConverterTraits<SetLike> {
using WrapperClass = JSSetLike;
using ToWrappedReturnType = SetLike*;
};
}