aboutsummaryrefslogtreecommitdiff
path: root/src/javascript/jsc/bindings/JSSink.cpp
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-06-22 23:21:48 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-06-22 23:21:48 -0700
commit729d445b6885f69dd2c6355f38707bd42851c791 (patch)
treef87a7c408929ea3f57bbb7ace380cf869da83c0e /src/javascript/jsc/bindings/JSSink.cpp
parent25f820c6bf1d8ec6d444ef579cc036b8c0607b75 (diff)
downloadbun-jarred/rename.tar.gz
bun-jarred/rename.tar.zst
bun-jarred/rename.zip
change the directory structurejarred/rename
Diffstat (limited to 'src/javascript/jsc/bindings/JSSink.cpp')
-rw-r--r--src/javascript/jsc/bindings/JSSink.cpp458
1 files changed, 0 insertions, 458 deletions
diff --git a/src/javascript/jsc/bindings/JSSink.cpp b/src/javascript/jsc/bindings/JSSink.cpp
deleted file mode 100644
index 60227464c..000000000
--- a/src/javascript/jsc/bindings/JSSink.cpp
+++ /dev/null
@@ -1,458 +0,0 @@
-
-// AUTO-GENERATED FILE. DO NOT EDIT.
-// Generated by /Users/jarred/Code/bun/src/javascript/jsc/generate-jssink.js at 2022-06-15T10:28:21.211Z
-// To regenerate this file, run:
-//
-// bun src/javascript/jsc/generate-jssink.js
-//
-#include "root.h"
-#include "JSSink.h"
-
-#include "ActiveDOMObject.h"
-#include "ExtendedDOMClientIsoSubspaces.h"
-#include "ExtendedDOMIsoSubspaces.h"
-#include "IDLTypes.h"
-// #include "JSBlob.h"
-#include "JSDOMAttribute.h"
-#include "JSDOMBinding.h"
-#include "JSDOMConstructor.h"
-#include "JSDOMConvertBase.h"
-#include "JSDOMConvertInterface.h"
-#include "JSDOMConvertStrings.h"
-#include "JSDOMExceptionHandling.h"
-#include "JSDOMGlobalObject.h"
-#include "JSDOMGlobalObjectInlines.h"
-#include "JSDOMOperation.h"
-#include "JSDOMWrapperCache.h"
-#include "ScriptExecutionContext.h"
-#include "WebCoreJSClientData.h"
-#include "JavaScriptCore/FunctionPrototype.h"
-#include "JavaScriptCore/HeapAnalyzer.h"
-
-#include "JavaScriptCore/JSDestructibleObjectHeapCellType.h"
-#include "JavaScriptCore/SlotVisitorMacros.h"
-#include "JavaScriptCore/SubspaceInlines.h"
-#include "wtf/GetPtr.h"
-#include "wtf/PointerPreparations.h"
-#include "wtf/URL.h"
-#include "JavaScriptCore/BuiltinNames.h"
-
-#include "JSBufferEncodingType.h"
-#include "JSBufferPrototypeBuiltins.h"
-#include "JSBufferConstructorBuiltins.h"
-#include "JavaScriptCore/JSBase.h"
-#if ENABLE(MEDIA_SOURCE)
-#include "BufferMediaSource.h"
-#include "JSMediaSource.h"
-#endif
-
-// #include "JavaScriptCore/JSTypedArrayViewPrototype.h"
-#include "JavaScriptCore/JSArrayBufferViewInlines.h"
-
-#include "JSReadableStream.h"
-#include "BunClientData.h"
-#include "JavaScriptCore/Weak.h"
-#include "JavaScriptCore/WeakInlines.h"
-
-namespace WebCore {
-using namespace JSC;
-
-JSC_DEFINE_HOST_FUNCTION(functionStartDirectStream, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame))
-{
-
- auto& vm = lexicalGlobalObject->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
- Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject);
-
- JSC::JSValue readableStream = callFrame->argument(0);
- JSC::JSValue onPull = callFrame->argument(1);
- JSC::JSValue onClose = callFrame->argument(2);
- if (!readableStream.isObject()) {
- scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected ReadableStream"_s));
- return JSC::JSValue::encode(JSC::jsUndefined());
- }
-
- if (!onPull.isObject() || !onPull.isCallable()) {
- onPull = JSC::jsUndefined();
- }
-
- if (!onClose.isObject() || !onClose.isCallable()) {
- onClose = JSC::jsUndefined();
- }
-
- 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, "Controller is already closed"_s));
- return JSC::JSValue::encode(JSC::jsUndefined());
- }
-
- ArrayBufferSinkController->start(globalObject, readableStream, onPullFunction, onCloseFunction);
- }
-
- else {
- scope.throwException(globalObject, JSC::createTypeError(globalObject, "Unknown direct controller. This is a bug in Bun."_s));
- return JSC::JSValue::encode(JSC::jsUndefined());
- }
-
- RELEASE_AND_RETURN(scope, JSC::JSValue::encode(JSC::jsUndefined()));
-}
-
-JSC_DEFINE_CUSTOM_GETTER(functionArrayBufferSink__getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
-{
- auto& vm = lexicalGlobalObject->vm();
- Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject);
-
- return JSC::JSValue::encode(globalObject->ArrayBufferSink());
-}
-
-JSC_DECLARE_HOST_FUNCTION(JSReadableArrayBufferSinkController__close);
-JSC_DEFINE_HOST_FUNCTION(JSReadableArrayBufferSinkController__close, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame))
-{
-
- auto& vm = lexicalGlobalObject->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
- Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject);
- WebCore::JSReadableArrayBufferSinkController* controller = JSC::jsDynamicCast<WebCore::JSReadableArrayBufferSinkController*>(callFrame->thisValue());
- if (!controller) {
- scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected JSReadableArrayBufferSinkController"_s));
- return JSC::JSValue::encode(JSC::jsUndefined());
- }
-
- void* ptr = controller->wrapped();
- if (ptr == nullptr) {
- scope.throwException(globalObject, JSC::createTypeError(globalObject, "Controller is already closed"_s));
- return JSC::JSValue::encode(JSC::jsUndefined());
- }
-
- controller->detach();
- ArrayBufferSink__close(lexicalGlobalObject, ptr);
- return JSC::JSValue::encode(JSC::jsUndefined());
-}
-
-JSC_DECLARE_HOST_FUNCTION(ArrayBufferSink__doClose);
-JSC_DEFINE_HOST_FUNCTION(ArrayBufferSink__doClose, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame))
-{
-
- auto& vm = lexicalGlobalObject->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
- Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject);
- WebCore::JSArrayBufferSink* sink = JSC::jsDynamicCast<WebCore::JSArrayBufferSink*>(callFrame->thisValue());
- if (!sink) {
- scope.throwException(globalObject, JSC::createTypeError(globalObject, "Expected ArrayBufferSink"_s));
- return JSC::JSValue::encode(JSC::jsUndefined());
- }
-
- void* ptr = sink->wrapped();
- if (ptr == nullptr) {
- scope.throwException(globalObject, JSC::createTypeError(globalObject, "Controller is already closed"_s));
- return JSC::JSValue::encode(JSC::jsUndefined());
- }
-
- sink->detach();
- ArrayBufferSink__close(lexicalGlobalObject, ptr);
- return JSC::JSValue::encode(JSC::jsUndefined());
-}
-
-static const HashTableValue JSArrayBufferSinkPrototypeTableValues[]
- = {
- { "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__doClose), (intptr_t)(0) } },
- { "drain"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__drain), (intptr_t)(1) } },
- { "end"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__end), (intptr_t)(0) } },
- { "start"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__start), (intptr_t)(1) } },
- { "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__write), (intptr_t)(1) } },
- };
-
-static const HashTableValue JSReadableArrayBufferSinkControllerPrototypeTableValues[]
- = {
- { "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(JSReadableArrayBufferSinkController__close), (intptr_t)(0) } },
- { "drain"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__drain), (intptr_t)(1) } },
- { "end"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__end), (intptr_t)(0) } },
- { "start"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__start), (intptr_t)(1) } },
- { "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__write), (intptr_t)(1) } },
- };
-
-#pragma mark - ArrayBufferSink
-
-class JSArrayBufferSinkPrototype final : public JSC::JSNonFinalObject {
-public:
- using Base = JSC::JSNonFinalObject;
-
- static JSArrayBufferSinkPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure)
- {
- JSArrayBufferSinkPrototype* ptr = new (NotNull, JSC::allocateCell<JSArrayBufferSinkPrototype>(vm)) JSArrayBufferSinkPrototype(vm, globalObject, structure);
- ptr->finishCreation(vm, globalObject);
- return ptr;
- }
-
- DECLARE_INFO;
- template<typename CellType, JSC::SubspaceAccess>
- static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
- {
- return &vm.plainObjectSpace();
- }
- 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());
- }
-
-private:
- JSArrayBufferSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
- : Base(vm, structure)
- {
- }
-
- void finishCreation(JSC::VM&, JSC::JSGlobalObject*);
-};
-STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSArrayBufferSinkPrototype, JSArrayBufferSinkPrototype::Base);
-
-class JSReadableArrayBufferSinkControllerPrototype final : public JSC::JSNonFinalObject {
-public:
- using Base = JSC::JSNonFinalObject;
-
- static JSReadableArrayBufferSinkControllerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure)
- {
- JSReadableArrayBufferSinkControllerPrototype* ptr = new (NotNull, JSC::allocateCell<JSReadableArrayBufferSinkControllerPrototype>(vm)) JSReadableArrayBufferSinkControllerPrototype(vm, globalObject, structure);
- ptr->finishCreation(vm, globalObject);
- return ptr;
- }
-
- DECLARE_INFO;
- template<typename CellType, JSC::SubspaceAccess>
- static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
- {
- return &vm.plainObjectSpace();
- }
- 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());
- }
-
-private:
- JSReadableArrayBufferSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
- : Base(vm, structure)
- {
- }
-
- void finishCreation(JSC::VM&, JSC::JSGlobalObject*);
-};
-STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableArrayBufferSinkControllerPrototype, JSReadableArrayBufferSinkControllerPrototype::Base);
-
-const ClassInfo JSArrayBufferSinkPrototype::s_info = { "ArrayBufferSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSArrayBufferSinkPrototype) };
-const ClassInfo JSArrayBufferSink::s_info = { "ArrayBufferSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSArrayBufferSink) };
-const ClassInfo JSArrayBufferSinkConstructor::s_info = { "ArrayBufferSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSArrayBufferSinkConstructor) };
-
-const ClassInfo JSReadableArrayBufferSinkControllerPrototype::s_info = { "ReadableArrayBufferSinkController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableArrayBufferSinkControllerPrototype) };
-const ClassInfo JSReadableArrayBufferSinkController::s_info = { "ReadableArrayBufferSinkController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableArrayBufferSinkController) };
-
-JSArrayBufferSink::~JSArrayBufferSink()
-{
- if (m_sinkPtr) {
- ArrayBufferSink__finalize(m_sinkPtr);
- }
-}
-
-JSReadableArrayBufferSinkController::~JSReadableArrayBufferSinkController()
-{
- if (m_sinkPtr) {
- ArrayBufferSink__finalize(m_sinkPtr);
- }
-}
-
-JSArrayBufferSinkConstructor* JSArrayBufferSinkConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSObject* prototype)
-{
- JSArrayBufferSinkConstructor* ptr = new (NotNull, JSC::allocateCell<JSArrayBufferSinkConstructor>(vm)) JSArrayBufferSinkConstructor(vm, structure, ArrayBufferSink__construct);
- ptr->finishCreation(vm, globalObject, prototype);
- return ptr;
-}
-
-JSArrayBufferSink* JSArrayBufferSink::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr)
-{
- JSArrayBufferSink* ptr = new (NotNull, JSC::allocateCell<JSArrayBufferSink>(vm)) JSArrayBufferSink(vm, structure, sinkPtr);
- ptr->finishCreation(vm);
- return ptr;
-}
-
-JSReadableArrayBufferSinkController* JSReadableArrayBufferSinkController::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr)
-{
- JSReadableArrayBufferSinkController* ptr = new (NotNull, JSC::allocateCell<JSReadableArrayBufferSinkController>(vm)) JSReadableArrayBufferSinkController(vm, structure, sinkPtr);
- ptr->finishCreation(vm);
- return ptr;
-}
-
-void JSArrayBufferSinkConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype)
-{
- Base::finishCreation(vm);
- ASSERT(inherits(info()));
- initializeProperties(vm, globalObject, prototype);
-}
-
-JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSArrayBufferSinkConstructor::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame)
-{
- return ArrayBufferSink__construct(globalObject, callFrame);
-}
-
-void JSArrayBufferSinkConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype)
-{
- putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
- JSString* nameString = jsNontrivialString(vm, "ArrayBufferSink"_s);
- m_originalName.set(vm, this, nameString);
- putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
-}
-
-void JSArrayBufferSinkPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject)
-{
- Base::finishCreation(vm);
- reifyStaticProperties(vm, JSArrayBufferSink::info(), JSArrayBufferSinkPrototypeTableValues, *this);
- JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
-}
-
-void JSReadableArrayBufferSinkControllerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject)
-{
- Base::finishCreation(vm);
- reifyStaticProperties(vm, JSReadableArrayBufferSinkController::info(), JSReadableArrayBufferSinkControllerPrototypeTableValues, *this);
- JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
-}
-
-void JSArrayBufferSink::finishCreation(VM& vm)
-{
- Base::finishCreation(vm);
- ASSERT(inherits(info()));
-}
-
-void JSReadableArrayBufferSinkController::finishCreation(VM& vm)
-{
- Base::finishCreation(vm);
- ASSERT(inherits(info()));
-}
-
-void JSArrayBufferSink::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
-{
- auto* thisObject = jsCast<JSArrayBufferSink*>(cell);
- if (void* wrapped = thisObject->wrapped()) {
- analyzer.setWrappedObjectForCell(cell, wrapped);
- // if (thisObject->scriptExecutionContext())
- // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
- }
- Base::analyzeHeap(cell, analyzer);
-}
-
-void JSReadableArrayBufferSinkController::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
-{
- auto* thisObject = jsCast<JSReadableArrayBufferSinkController*>(cell);
- if (void* wrapped = thisObject->wrapped()) {
- analyzer.setWrappedObjectForCell(cell, wrapped);
- // if (thisObject->scriptExecutionContext())
- // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
- }
- Base::analyzeHeap(cell, analyzer);
-}
-
-template<typename Visitor>
-void JSReadableArrayBufferSinkController::visitChildrenImpl(JSCell* cell, Visitor& visitor)
-{
- JSReadableArrayBufferSinkController* thisObject = jsCast<JSReadableArrayBufferSinkController*>(cell);
- ASSERT_GC_OBJECT_INHERITS(thisObject, info());
- Base::visitChildren(thisObject, visitor);
- visitor.append(thisObject->m_onPull);
- visitor.append(thisObject->m_onClose);
- visitor.append(thisObject->m_weakReadableStream);
-}
-
-DEFINE_VISIT_CHILDREN(JSReadableArrayBufferSinkController);
-
-void JSReadableArrayBufferSinkController::start(JSC::JSGlobalObject* globalObject, JSC::JSValue readableStream, JSC::JSFunction* onPull, JSC::JSFunction* onClose)
-{
- this->m_weakReadableStream = JSC::Weak<JSC::JSObject>(readableStream.getObject());
- this->m_onPull.set(globalObject->vm(), this, onPull);
- this->m_onClose.set(globalObject->vm(), this, onClose);
-}
-
-void JSArrayBufferSink::destroy(JSCell* cell)
-{
- static_cast<JSArrayBufferSink*>(cell)->JSArrayBufferSink::~JSArrayBufferSink();
-}
-
-void JSReadableArrayBufferSinkController::destroy(JSCell* cell)
-{
- static_cast<JSReadableArrayBufferSinkController*>(cell)->JSReadableArrayBufferSinkController::~JSReadableArrayBufferSinkController();
-}
-
-JSObject* createJSSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, SinkID sinkID)
-{
- switch (sinkID) {
-
- case ArrayBufferSink:
- return JSArrayBufferSinkPrototype::create(vm, globalObject, JSArrayBufferSinkPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
-
- default:
- RELEASE_ASSERT_NOT_REACHED();
- }
-}
-JSObject* createJSSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, SinkID sinkID)
-{
- switch (sinkID) {
-
- case ArrayBufferSink:
- return JSReadableArrayBufferSinkControllerPrototype::create(vm, globalObject, JSReadableArrayBufferSinkControllerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
-
- default:
- RELEASE_ASSERT_NOT_REACHED();
- }
-}
-} // namespace WebCore
-
-extern "C" JSC__JSValue ArrayBufferSink__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr)
-{
- auto& vm = arg0->vm();
- Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(arg0);
- JSC::JSValue prototype = globalObject->ArrayBufferSinkPrototype();
- JSC::Structure* structure = WebCore::JSArrayBufferSink::createStructure(vm, globalObject, prototype);
- return JSC::JSValue::encode(WebCore::JSArrayBufferSink::create(vm, globalObject, structure, sinkPtr));
-}
-
-extern "C" void* ArrayBufferSink__fromJS(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1)
-{
- JSC::VM& vm = WebCore::getVM(arg0);
- if (auto* sink = JSC::jsDynamicCast<WebCore::JSArrayBufferSink*>(JSC::JSValue::decode(JSValue1)))
- return sink->wrapped();
-
- if (auto* controller = JSC::jsDynamicCast<WebCore::JSReadableArrayBufferSinkController*>(JSC::JSValue::decode(JSValue1)))
- return controller->wrapped();
-
- return nullptr;
-}
-
-extern "C" JSC__JSValue ArrayBufferSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue stream, void* sinkPtr, int32_t* bunNativeTag, void** bunNativePtr)
-{
- auto& vm = arg0->vm();
- Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(arg0);
- auto clientData = WebCore::clientData(vm);
- JSC::JSObject* readableStream = JSC::JSValue::decode(stream).getObject();
-
- if (JSC::JSValue tag = readableStream->get(globalObject, clientData->builtinNames().bunNativeTypePrivateName())) {
- if (tag.isInt32()) {
- int32_t tagNumber = tag.toInt32(arg0);
- if (tagNumber > 0 && tagNumber < 5) {
- *bunNativeTag = tagNumber;
- *bunNativePtr = reinterpret_cast<void*>(bitwise_cast<uintptr_t>(readableStream->get(globalObject, clientData->builtinNames().bunNativePtrPrivateName()).asNumber()));
- return JSC::JSValue::encode(JSC::jsNull());
- }
- }
- }
-
- JSC::JSValue prototype = globalObject->JSReadableArrayBufferSinkControllerPrototype();
- JSC::Structure* structure = WebCore::JSReadableArrayBufferSinkController::createStructure(vm, globalObject, prototype);
- WebCore::JSReadableArrayBufferSinkController* controller = WebCore::JSReadableArrayBufferSinkController::create(vm, globalObject, structure, sinkPtr);
-
- JSC::JSObject* function = globalObject->getDirect(vm, clientData->builtinNames().assignDirectStreamPrivateName()).getObject();
- auto callData = JSC::getCallData(function);
- JSC::MarkedArgumentBuffer arguments;
- arguments.append(JSC::JSValue::decode(stream));
- arguments.append(controller);
-
- auto result = JSC::call(arg0, function, callData, JSC::jsUndefined(), arguments);
- return JSC::JSValue::encode(result);
-}