diff options
author | 2023-01-02 21:05:56 -0800 | |
---|---|---|
committer | 2023-01-02 21:05:56 -0800 | |
commit | ea2b65d4834d864029299809fb23f40ba2a56f90 (patch) | |
tree | b178b1c6327ed9b450b8764b0c13dea63112ee55 /src/bun.js/bindings/ZigGeneratedClasses.h | |
parent | 80c2da73ef59f0170f1c92551c948a1b285da17c (diff) | |
download | bun-jarred/pg.tar.gz bun-jarred/pg.tar.zst bun-jarred/pg.zip |
Draw the owljarred/pg
Diffstat (limited to 'src/bun.js/bindings/ZigGeneratedClasses.h')
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/bun.js/bindings/ZigGeneratedClasses.h b/src/bun.js/bindings/ZigGeneratedClasses.h index aee32a315..2423c973a 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses.h +++ b/src/bun.js/bindings/ZigGeneratedClasses.h @@ -959,6 +959,93 @@ public: mutable JSC::WriteBarrier<JSC::Unknown> m_scriptSrc; }; +class JSPostgresSQLDatabase final : public JSC::JSDestructibleObject { +public: + using Base = JSC::JSDestructibleObject; + static JSPostgresSQLDatabase* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSPostgresSQLDatabase, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForPostgresSQLDatabase.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForPostgresSQLDatabase = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForPostgresSQLDatabase.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForPostgresSQLDatabase = WTFMove(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + ; + + ~JSPostgresSQLDatabase(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSPostgresSQLDatabase, m_ctx); } + + void* m_ctx { nullptr }; + + JSPostgresSQLDatabase(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + m_weakThis = JSC::Weak<JSPostgresSQLDatabase>(this, getOwner()); + } + + void finishCreation(JSC::VM&); + + JSC::Weak<JSPostgresSQLDatabase> m_weakThis; + + static bool hasPendingActivity(void* ctx); + + class Owner final : public JSC::WeakHandleOwner { + public: + bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void* context, JSC::AbstractSlotVisitor& visitor, const char** reason) final + { + auto* controller = JSC::jsCast<JSPostgresSQLDatabase*>(handle.slot()->asCell()); + if (JSPostgresSQLDatabase::hasPendingActivity(controller->wrapped())) { + if (UNLIKELY(reason)) + *reason = "has pending activity"; + return true; + } + + return visitor.containsOpaqueRoot(context); + } + void finalize(JSC::Handle<JSC::Unknown>, void* context) final {} + }; + + static JSC::WeakHandleOwner* getOwner() + { + static NeverDestroyed<Owner> m_owner; + return &m_owner.get(); + } + + DECLARE_VISIT_CHILDREN; + template<typename Visitor> void visitAdditionalChildren(Visitor&); + DECLARE_VISIT_OUTPUT_CONSTRAINTS; + + mutable JSC::WriteBarrier<JSC::Unknown> m_onClose; + mutable JSC::WriteBarrier<JSC::Unknown> m_onNotice; + mutable JSC::WriteBarrier<JSC::Unknown> m_onOpen; + mutable JSC::WriteBarrier<JSC::Unknown> m_onTimeout; + mutable JSC::WriteBarrier<JSC::Unknown> m_onDrain; +}; + class JSExpect final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; |