diff options
Diffstat (limited to 'src/bun.js/bindings/JSSink.cpp')
-rw-r--r-- | src/bun.js/bindings/JSSink.cpp | 84 |
1 files changed, 40 insertions, 44 deletions
diff --git a/src/bun.js/bindings/JSSink.cpp b/src/bun.js/bindings/JSSink.cpp index 09a5a396c..782c6e326 100644 --- a/src/bun.js/bindings/JSSink.cpp +++ b/src/bun.js/bindings/JSSink.cpp @@ -1,6 +1,6 @@ // AUTO-GENERATED FILE. DO NOT EDIT. -// Generated by 'make generate-sink' at 2023-07-17T20:32:20.223Z +// Generated by 'make generate-sink' // To regenerate this file, run: // // make generate-sink @@ -10,6 +10,7 @@ #include "BunClientData.h" #include "JSSink.h" +#include "AsyncContextFrame.h" #include "ActiveDOMObject.h" #include "ExtendedDOMClientIsoSubspaces.h" @@ -68,6 +69,8 @@ JSC_DEFINE_HOST_FUNCTION(functionStartDirectStream, (JSC::JSGlobalObject * lexic JSC::JSValue readableStream = callFrame->argument(0); JSC::JSValue onPull = callFrame->argument(1); JSC::JSValue onClose = callFrame->argument(2); + JSC::JSValue asyncContext = callFrame->argument(3); + if (!readableStream.isObject()) { scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected ReadableStream"_s)); return JSC::JSValue::encode(JSC::jsUndefined()); @@ -75,22 +78,23 @@ JSC_DEFINE_HOST_FUNCTION(functionStartDirectStream, (JSC::JSGlobalObject * lexic if (!onPull.isObject() || !onPull.isCallable()) { onPull = JSC::jsUndefined(); + } else if (!asyncContext.isUndefined()) { + onPull = AsyncContextFrame::create(globalObject, onPull, asyncContext); } if (!onClose.isObject() || !onClose.isCallable()) { onClose = JSC::jsUndefined(); + } else if (!asyncContext.isUndefined()) { + onClose = AsyncContextFrame::create(globalObject, onClose, asyncContext); } - JSC::JSFunction* onPullFunction = JSC::jsDynamicCast<JSC::JSFunction*>(onPull); - JSC::JSFunction* onCloseFunction = JSC::jsDynamicCast<JSC::JSFunction*>(onClose); - if (WebCore::JSReadableArrayBufferSinkController* ArrayBufferSinkController = JSC::jsDynamicCast<WebCore::JSReadableArrayBufferSinkController*>(callFrame->thisValue())) { if (ArrayBufferSinkController->wrapped() == nullptr) { scope.throwException(globalObject, JSC::createTypeError(globalObject, "Cannot start stream with closed controller"_s)); return JSC::JSValue::encode(JSC::jsUndefined()); } - ArrayBufferSinkController->start(globalObject, readableStream, onPullFunction, onCloseFunction); + ArrayBufferSinkController->start(globalObject, readableStream, onPull, onClose); } else if (WebCore::JSReadableFileSinkController* FileSinkController = JSC::jsDynamicCast<WebCore::JSReadableFileSinkController*>(callFrame->thisValue())) { @@ -99,7 +103,7 @@ JSC_DEFINE_HOST_FUNCTION(functionStartDirectStream, (JSC::JSGlobalObject * lexic return JSC::JSValue::encode(JSC::jsUndefined()); } - FileSinkController->start(globalObject, readableStream, onPullFunction, onCloseFunction); + FileSinkController->start(globalObject, readableStream, onPull, onClose); } else if (WebCore::JSReadableHTTPResponseSinkController* HTTPResponseSinkController = JSC::jsDynamicCast<WebCore::JSReadableHTTPResponseSinkController*>(callFrame->thisValue())) { @@ -108,7 +112,7 @@ JSC_DEFINE_HOST_FUNCTION(functionStartDirectStream, (JSC::JSGlobalObject * lexic return JSC::JSValue::encode(JSC::jsUndefined()); } - HTTPResponseSinkController->start(globalObject, readableStream, onPullFunction, onCloseFunction); + HTTPResponseSinkController->start(globalObject, readableStream, onPull, onClose); } else if (WebCore::JSReadableHTTPSResponseSinkController* HTTPSResponseSinkController = JSC::jsDynamicCast<WebCore::JSReadableHTTPSResponseSinkController*>(callFrame->thisValue())) { @@ -117,7 +121,7 @@ JSC_DEFINE_HOST_FUNCTION(functionStartDirectStream, (JSC::JSGlobalObject * lexic return JSC::JSValue::encode(JSC::jsUndefined()); } - HTTPSResponseSinkController->start(globalObject, readableStream, onPullFunction, onCloseFunction); + HTTPSResponseSinkController->start(globalObject, readableStream, onPull, onClose); } else { @@ -927,7 +931,7 @@ void JSArrayBufferSink::visitChildrenImpl(JSCell* cell, Visitor& visitor) DEFINE_VISIT_CHILDREN(JSArrayBufferSink); -void JSReadableArrayBufferSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSFunction* onPull, JSC::JSFunction* onClose) +void JSReadableArrayBufferSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSValue onPull, JSC::JSValue onClose) { this->m_weakReadableStream = JSC::Weak<JSC::JSObject>(readableStream.getObject()); this->m_onPull.set(globalObject->vm(), this, onPull); @@ -1181,7 +1185,7 @@ void JSFileSink::visitChildrenImpl(JSCell* cell, Visitor& visitor) DEFINE_VISIT_CHILDREN(JSFileSink); -void JSReadableFileSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSFunction* onPull, JSC::JSFunction* onClose) +void JSReadableFileSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSValue onPull, JSC::JSValue onClose) { this->m_weakReadableStream = JSC::Weak<JSC::JSObject>(readableStream.getObject()); this->m_onPull.set(globalObject->vm(), this, onPull); @@ -1435,7 +1439,7 @@ void JSHTTPResponseSink::visitChildrenImpl(JSCell* cell, Visitor& visitor) DEFINE_VISIT_CHILDREN(JSHTTPResponseSink); -void JSReadableHTTPResponseSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSFunction* onPull, JSC::JSFunction* onClose) +void JSReadableHTTPResponseSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSValue onPull, JSC::JSValue onClose) { this->m_weakReadableStream = JSC::Weak<JSC::JSObject>(readableStream.getObject()); this->m_onPull.set(globalObject->vm(), this, onPull); @@ -1689,7 +1693,7 @@ void JSHTTPSResponseSink::visitChildrenImpl(JSCell* cell, Visitor& visitor) DEFINE_VISIT_CHILDREN(JSHTTPSResponseSink); -void JSReadableHTTPSResponseSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSFunction* onPull, JSC::JSFunction* onClose) +void JSReadableHTTPSResponseSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSValue onPull, JSC::JSValue onClose) { this->m_weakReadableStream = JSC::Weak<JSC::JSObject>(readableStream.getObject()); this->m_onPull.set(globalObject->vm(), this, onPull); @@ -1824,18 +1828,17 @@ extern "C" void ArrayBufferSink__onReady(JSC__JSValue controllerValue, JSC__JSVa { WebCore::JSReadableArrayBufferSinkController* controller = JSC::jsCast<WebCore::JSReadableArrayBufferSinkController*>(JSC::JSValue::decode(controllerValue).getObject()); - JSC::JSFunction* function = controller->m_onPull.get(); - if (function == nullptr) + JSC::JSValue function = controller->m_onPull.get(); + if (!function) return; JSC::JSGlobalObject* globalObject = controller->globalObject(); - auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; arguments.append(controller); arguments.append(JSC::JSValue::decode(amt)); arguments.append(JSC::JSValue::decode(offset)); - JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments); + AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); } extern "C" void ArrayBufferSink__onStart(JSC__JSValue controllerValue) @@ -1846,20 +1849,19 @@ extern "C" void ArrayBufferSink__onClose(JSC__JSValue controllerValue, JSC__JSVa { WebCore::JSReadableArrayBufferSinkController* controller = JSC::jsCast<WebCore::JSReadableArrayBufferSinkController*>(JSC::JSValue::decode(controllerValue).getObject()); - JSC::JSFunction* function = controller->m_onClose.get(); - if (function == nullptr) + JSC::JSValue function = controller->m_onClose.get(); + if (!function) return; // only call close once controller->m_onClose.clear(); JSC::JSGlobalObject* globalObject = controller->globalObject(); - auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; auto readableStream = controller->m_weakReadableStream.get(); arguments.append(readableStream ? readableStream : JSC::jsUndefined()); arguments.append(JSC::JSValue::decode(reason)); - JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments); + AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); } extern "C" JSC__JSValue FileSink__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr) @@ -1910,18 +1912,17 @@ extern "C" void FileSink__onReady(JSC__JSValue controllerValue, JSC__JSValue amt { WebCore::JSReadableFileSinkController* controller = JSC::jsCast<WebCore::JSReadableFileSinkController*>(JSC::JSValue::decode(controllerValue).getObject()); - JSC::JSFunction* function = controller->m_onPull.get(); - if (function == nullptr) + JSC::JSValue function = controller->m_onPull.get(); + if (!function) return; JSC::JSGlobalObject* globalObject = controller->globalObject(); - auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; arguments.append(controller); arguments.append(JSC::JSValue::decode(amt)); arguments.append(JSC::JSValue::decode(offset)); - JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments); + AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); } extern "C" void FileSink__onStart(JSC__JSValue controllerValue) @@ -1932,20 +1933,19 @@ extern "C" void FileSink__onClose(JSC__JSValue controllerValue, JSC__JSValue rea { WebCore::JSReadableFileSinkController* controller = JSC::jsCast<WebCore::JSReadableFileSinkController*>(JSC::JSValue::decode(controllerValue).getObject()); - JSC::JSFunction* function = controller->m_onClose.get(); - if (function == nullptr) + JSC::JSValue function = controller->m_onClose.get(); + if (!function) return; // only call close once controller->m_onClose.clear(); JSC::JSGlobalObject* globalObject = controller->globalObject(); - auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; auto readableStream = controller->m_weakReadableStream.get(); arguments.append(readableStream ? readableStream : JSC::jsUndefined()); arguments.append(JSC::JSValue::decode(reason)); - JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments); + AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); } extern "C" JSC__JSValue HTTPResponseSink__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr) @@ -1996,18 +1996,17 @@ extern "C" void HTTPResponseSink__onReady(JSC__JSValue controllerValue, JSC__JSV { WebCore::JSReadableHTTPResponseSinkController* controller = JSC::jsCast<WebCore::JSReadableHTTPResponseSinkController*>(JSC::JSValue::decode(controllerValue).getObject()); - JSC::JSFunction* function = controller->m_onPull.get(); - if (function == nullptr) + JSC::JSValue function = controller->m_onPull.get(); + if (!function) return; JSC::JSGlobalObject* globalObject = controller->globalObject(); - auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; arguments.append(controller); arguments.append(JSC::JSValue::decode(amt)); arguments.append(JSC::JSValue::decode(offset)); - JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments); + AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); } extern "C" void HTTPResponseSink__onStart(JSC__JSValue controllerValue) @@ -2018,20 +2017,19 @@ extern "C" void HTTPResponseSink__onClose(JSC__JSValue controllerValue, JSC__JSV { WebCore::JSReadableHTTPResponseSinkController* controller = JSC::jsCast<WebCore::JSReadableHTTPResponseSinkController*>(JSC::JSValue::decode(controllerValue).getObject()); - JSC::JSFunction* function = controller->m_onClose.get(); - if (function == nullptr) + JSC::JSValue function = controller->m_onClose.get(); + if (!function) return; // only call close once controller->m_onClose.clear(); JSC::JSGlobalObject* globalObject = controller->globalObject(); - auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; auto readableStream = controller->m_weakReadableStream.get(); arguments.append(readableStream ? readableStream : JSC::jsUndefined()); arguments.append(JSC::JSValue::decode(reason)); - JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments); + AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); } extern "C" JSC__JSValue HTTPSResponseSink__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr) @@ -2082,18 +2080,17 @@ extern "C" void HTTPSResponseSink__onReady(JSC__JSValue controllerValue, JSC__JS { WebCore::JSReadableHTTPSResponseSinkController* controller = JSC::jsCast<WebCore::JSReadableHTTPSResponseSinkController*>(JSC::JSValue::decode(controllerValue).getObject()); - JSC::JSFunction* function = controller->m_onPull.get(); - if (function == nullptr) + JSC::JSValue function = controller->m_onPull.get(); + if (!function) return; JSC::JSGlobalObject* globalObject = controller->globalObject(); - auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; arguments.append(controller); arguments.append(JSC::JSValue::decode(amt)); arguments.append(JSC::JSValue::decode(offset)); - JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments); + AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); } extern "C" void HTTPSResponseSink__onStart(JSC__JSValue controllerValue) @@ -2104,18 +2101,17 @@ extern "C" void HTTPSResponseSink__onClose(JSC__JSValue controllerValue, JSC__JS { WebCore::JSReadableHTTPSResponseSinkController* controller = JSC::jsCast<WebCore::JSReadableHTTPSResponseSinkController*>(JSC::JSValue::decode(controllerValue).getObject()); - JSC::JSFunction* function = controller->m_onClose.get(); - if (function == nullptr) + JSC::JSValue function = controller->m_onClose.get(); + if (!function) return; // only call close once controller->m_onClose.clear(); JSC::JSGlobalObject* globalObject = controller->globalObject(); - auto callData = JSC::getCallData(function); JSC::MarkedArgumentBuffer arguments; auto readableStream = controller->m_weakReadableStream.get(); arguments.append(readableStream ? readableStream : JSC::jsUndefined()); arguments.append(JSC::JSValue::decode(reason)); - JSC::call(globalObject, function, callData, JSC::jsUndefined(), arguments); + AsyncContextFrame::call(globalObject, function, JSC::jsUndefined(), arguments); } |