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-15 07:17:42 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-06-15 07:17:42 -0700
commit56e88fb4dd06e07569ddc3861e2e8e21f71e45b8 (patch)
treea355df05ffd4665916c3eefb8370e154d1128f72 /src/javascript/jsc/bindings/JSSink.cpp
parentd93f09331394148441d142930fea236a9fd73c5c (diff)
downloadbun-56e88fb4dd06e07569ddc3861e2e8e21f71e45b8.tar.gz
bun-56e88fb4dd06e07569ddc3861e2e8e21f71e45b8.tar.zst
bun-56e88fb4dd06e07569ddc3861e2e8e21f71e45b8.zip
direct streams mostly workjarred/direct
Diffstat (limited to 'src/javascript/jsc/bindings/JSSink.cpp')
-rw-r--r--src/javascript/jsc/bindings/JSSink.cpp227
1 files changed, 145 insertions, 82 deletions
diff --git a/src/javascript/jsc/bindings/JSSink.cpp b/src/javascript/jsc/bindings/JSSink.cpp
index 3e659deb0..60227464c 100644
--- a/src/javascript/jsc/bindings/JSSink.cpp
+++ b/src/javascript/jsc/bindings/JSSink.cpp
@@ -1,9 +1,9 @@
// AUTO-GENERATED FILE. DO NOT EDIT.
-// Generated by /Users/jarred/Code/bun/src/javascript/jsc/generate-JSSink.js at 2022-06-14T08:19:26.544Z
+// 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
+// bun src/javascript/jsc/generate-jssink.js
//
#include "root.h"
#include "JSSink.h"
@@ -49,56 +49,125 @@
// #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_CUSTOM_GETTER(functionArrayBufferSink__getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
+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);
- return JSC::JSValue::encode(globalObject->ArrayBufferSink());
+ 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(functionReadableArrayBufferSinkController__getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
+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->ArrayBufferSinkController());
+ return JSC::JSValue::encode(globalObject->ArrayBufferSink());
}
-JSC_DECLARE_HOST_FUNCTION(functionReadableArrayBufferSinkController__run);
-JSC_DEFINE_HOST_FUNCTION(functionReadableArrayBufferSinkController__run, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame))
+JSC_DECLARE_HOST_FUNCTION(JSReadableArrayBufferSinkController__close);
+JSC_DEFINE_HOST_FUNCTION(JSReadableArrayBufferSinkController__close, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame))
{
+
auto& vm = lexicalGlobalObject->vm();
- Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject);
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());
+ }
- if (callFrame->argumentCount() < 6) {
- throwException(callFrame, scope, createNotEnoughArgumentsError(callFrame));
+ void* ptr = controller->wrapped();
+ if (ptr == nullptr) {
+ scope.throwException(globalObject, JSC::createTypeError(globalObject, "Controller is already closed"_s));
return JSC::JSValue::encode(JSC::jsUndefined());
}
- WebCore::JSReadableStream* readableStream = JSC::jsDynamicCast<WebCore::JSReadableStream*>(vm, callFrame->argument(0));
- if (!readableStream) {
- throwException(callFrame, scope, createTypeError(callFrame, "first argument is not a ReadableStream"));
+ 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* sinkPtr = reinterpret_cast<void*>(bitwise_cast<uintptr_t>(callFrame->argument(1).toDouble(globalObject)));
- JSObject* startFunctionObj = callFrame->argument(2).getObject();
- JSObject* pullFunctionObj = callFrame->argument(3).getObject();
- JSObject* cancelFunctionObj = callFrame->argument(4).getObject();
+ void* ptr = sink->wrapped();
+ if (ptr == nullptr) {
+ scope.throwException(globalObject, JSC::createTypeError(globalObject, "Controller is already closed"_s));
+ return JSC::JSValue::encode(JSC::jsUndefined());
+ }
- JSFunction* pullFunction = pullFunctionObj != nullptr && startFunctionObj->isCallbable() ? JSC::jsCast<JSFunction*>(pullFunctionObj) : nullptr;
- JSFunction* cancelFunction = cancelFunctionObj != nullptr && startFunctionObj->isCallbable() ? JSC::jsCast<JSFunction*>(cancelFunctionObj) : nullptr;
+ 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__close), (intptr_t)(0) } },
- { "closeWithError"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__closeWithError), (intptr_t)(1) } },
+ { "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) } },
@@ -171,15 +240,12 @@ private:
};
STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableArrayBufferSinkControllerPrototype, JSReadableArrayBufferSinkControllerPrototype::Base);
-// Classes without streams
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) };
-// Classes with streams
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) };
-const ClassInfo JSReadableArrayBufferSinkControllerConstructor::s_info = { "ReadableArrayBufferSinkController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableArrayBufferSinkControllerConstructor) };
JSArrayBufferSink::~JSArrayBufferSink()
{
@@ -191,7 +257,7 @@ JSArrayBufferSink::~JSArrayBufferSink()
JSReadableArrayBufferSinkController::~JSReadableArrayBufferSinkController()
{
if (m_sinkPtr) {
- ArrayBufferSink__finalizeController(m_sinkPtr);
+ ArrayBufferSink__finalize(m_sinkPtr);
}
}
@@ -202,13 +268,6 @@ JSArrayBufferSinkConstructor* JSArrayBufferSinkConstructor::create(JSC::VM& vm,
return ptr;
}
-JSReadableArrayBufferSinkControllerConstructor* JSReadableArrayBufferSinkControllerConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSObject* prototype)
-{
- JSReadableArrayBufferSinkControllerConstructor* ptr = new (NotNull, JSC::allocateCell<JSReadableArrayBufferSinkControllerConstructor>(vm)) JSReadableArrayBufferSinkControllerConstructor(vm, structure, ArrayBufferSink__constructController);
- 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);
@@ -230,23 +289,11 @@ void JSArrayBufferSinkConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* g
initializeProperties(vm, globalObject, prototype);
}
-void JSReadableArrayBufferSinkControllerConstructor::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);
}
-JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSReadableArrayBufferSinkController::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame)
-{
- return ArrayBufferSink__constructController(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);
@@ -255,14 +302,6 @@ void JSArrayBufferSinkConstructor::initializeProperties(VM& vm, JSC::JSGlobalObj
putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
}
-void JSReadableArrayBufferSinkControllerConstructor::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);
@@ -273,7 +312,7 @@ void JSArrayBufferSinkPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject
void JSReadableArrayBufferSinkControllerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject)
{
Base::finishCreation(vm);
- reifyStaticProperties(vm, JSReadableArrayBufferSinkControllerPrototype::info(), ReadableArrayBufferSinkControllerPrototypeTableValues, *this);
+ reifyStaticProperties(vm, JSReadableArrayBufferSinkController::info(), JSReadableArrayBufferSinkControllerPrototypeTableValues, *this);
JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
}
@@ -283,25 +322,12 @@ void JSArrayBufferSink::finishCreation(VM& vm)
ASSERT(inherits(info()));
}
-void ReadableArrayBufferSinkController::finishCreation(VM& vm)
+void JSReadableArrayBufferSinkController::finishCreation(VM& vm)
{
Base::finishCreation(vm);
ASSERT(inherits(info()));
}
-template<typename Visitor>
-void JSReadableArrayBufferSinkController::visitChildrenImpl(JSCell* cell, Visitor& visitor)
-{
- auto* thisObject = jsCast<JSReadableArrayBufferSinkController*>(cell);
- ASSERT_GC_OBJECT_INHERITS(thisObject, info());
- Base::visitChildren(thisObject, visitor);
- visitor.append(thisObject->m_pull);
- visitor.append(thisObject->m_close);
- visitor.append(thisObject->m_start);
-}
-
-DEFINE_VISIT_CHILDREN(JSReadableArrayBufferSinkController);
-
void JSArrayBufferSink::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
{
auto* thisObject = jsCast<JSArrayBufferSink*>(cell);
@@ -324,6 +350,26 @@ void JSReadableArrayBufferSinkController::analyzeHeap(JSCell* cell, HeapAnalyzer
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();
@@ -367,29 +413,46 @@ extern "C" JSC__JSValue ArrayBufferSink__createObject(JSC__JSGlobalObject* arg0,
return JSC::JSValue::encode(WebCore::JSArrayBufferSink::create(vm, globalObject, structure, sinkPtr));
}
-extern "C" JSC__JSValue ArrayBufferSink__setStreamController(JSC__JSGlobalObject* arg0, JSC__JSValue readableStream, void* sinkPtr)
-{
- auto& vm = arg0->vm();
- Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(arg0);
- JSC::JSValue prototype = globalObject->ArrayBufferSinkControllerPrototype();
- JSC::Structure* structure = WebCore::JSReadableArrayBufferSinkController::createStructure(vm, globalObject, prototype);
- return JSC::JSValue::encode(WebCore::JSReadableArrayBufferSinkController::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" void* JSReadableArrayBufferSinkController__fromJS(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1)
+extern "C" JSC__JSValue ArrayBufferSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue stream, void* sinkPtr, int32_t* bunNativeTag, void** bunNativePtr)
{
- JSC::VM& vm = WebCore::getVM(arg0);
- if (auto* sink = JSC::jsDynamicCast<WebCore::JSReadableArrayBufferSinkController*>(JSC::JSValue::decode(JSValue1)))
- return sink->wrapped();
+ 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());
+ }
+ }
+ }
- return nullptr;
+ 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);
}