JSWorkletGlobalScopeBase.h [plain text]
#pragma once
#if ENABLE(CSS_PAINTING_API)
#include "JSDOMGlobalObject.h"
#include "JSDOMWrapper.h"
#include "JSEventTarget.h"
namespace WebCore {
class JSWorkletGlobalScope;
class WorkletGlobalScope;
class JSWorkletGlobalScopeBase : public JSDOMGlobalObject {
public:
using Base = JSDOMGlobalObject;
template<typename, JSC::SubspaceAccess>
static void subspaceFor(JSC::VM&) { RELEASE_ASSERT_NOT_REACHED(); }
static void destroy(JSC::JSCell*);
DECLARE_INFO;
WorkletGlobalScope& wrapped() const { return *m_wrapped; }
JSC::JSProxy* proxy() const { ASSERT(m_proxy); return m_proxy.get(); }
ScriptExecutionContext* scriptExecutionContext() const;
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
{
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::GlobalObjectType, StructureFlags), info());
}
static const JSC::GlobalObjectMethodTable s_globalObjectMethodTable;
static bool supportsRichSourceInfo(const JSC::JSGlobalObject*);
static bool shouldInterruptScript(const JSC::JSGlobalObject*);
static bool shouldInterruptScriptBeforeTimeout(const JSC::JSGlobalObject*);
static JSC::RuntimeFlags javaScriptRuntimeFlags(const JSC::JSGlobalObject*);
static void queueMicrotaskToEventLoop(JSC::JSGlobalObject&, Ref<JSC::Microtask>&&);
void clearDOMGuardedObjects();
protected:
JSWorkletGlobalScopeBase(JSC::VM&, JSC::Structure*, RefPtr<WorkletGlobalScope>&&);
void finishCreation(JSC::VM&, JSC::JSProxy*);
static void visitChildren(JSC::JSCell*, JSC::SlotVisitor&);
private:
RefPtr<WorkletGlobalScope> m_wrapped;
JSC::WriteBarrier<JSC::JSProxy> m_proxy;
};
JSC::JSValue toJS(JSC::JSGlobalObject*, JSDOMGlobalObject*, WorkletGlobalScope&);
inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, WorkletGlobalScope* scope) { return scope ? toJS(lexicalGlobalObject, globalObject, *scope) : JSC::jsNull(); }
JSC::JSValue toJS(JSC::JSGlobalObject*, WorkletGlobalScope&);
inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, WorkletGlobalScope* scope) { return scope ? toJS(lexicalGlobalObject, *scope) : JSC::jsNull(); }
JSWorkletGlobalScope* toJSWorkletGlobalScope(JSC::VM&, JSC::JSValue);
}
#endif // ENABLE(CSS_PAINTING_API)