aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/ZigGeneratedClasses.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/bindings/ZigGeneratedClasses.h')
-rw-r--r--src/bun.js/bindings/ZigGeneratedClasses.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/bun.js/bindings/ZigGeneratedClasses.h b/src/bun.js/bindings/ZigGeneratedClasses.h
index 7080146df..31ea8ef47 100644
--- a/src/bun.js/bindings/ZigGeneratedClasses.h
+++ b/src/bun.js/bindings/ZigGeneratedClasses.h
@@ -1928,10 +1928,37 @@ public:
: Base(vm, structure)
{
m_ctx = sinkPtr;
+ m_weakThis = JSC::Weak<JSPostgresSQLQuery>(this, getOwner());
}
void finishCreation(JSC::VM&);
+ JSC::Weak<JSPostgresSQLQuery> 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<JSPostgresSQLQuery*>(handle.slot()->asCell());
+ if (JSPostgresSQLQuery::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;