diff options
author | 2022-06-22 23:21:48 -0700 | |
---|---|---|
committer | 2022-06-22 23:21:48 -0700 | |
commit | 729d445b6885f69dd2c6355f38707bd42851c791 (patch) | |
tree | f87a7c408929ea3f57bbb7ace380cf869da83c0e /src/javascript/jsc/bindings/webcore/JSReadableStreamSink.cpp | |
parent | 25f820c6bf1d8ec6d444ef579cc036b8c0607b75 (diff) | |
download | bun-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/webcore/JSReadableStreamSink.cpp')
-rw-r--r-- | src/javascript/jsc/bindings/webcore/JSReadableStreamSink.cpp | 243 |
1 files changed, 0 insertions, 243 deletions
diff --git a/src/javascript/jsc/bindings/webcore/JSReadableStreamSink.cpp b/src/javascript/jsc/bindings/webcore/JSReadableStreamSink.cpp deleted file mode 100644 index 2fd819460..000000000 --- a/src/javascript/jsc/bindings/webcore/JSReadableStreamSink.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/* - This file is part of the WebKit open source project. - This file has been generated by generate-bindings.pl. DO NOT MODIFY! - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" -#include "JSReadableStreamSink.h" - -#include "ActiveDOMObject.h" -#include "ExtendedDOMClientIsoSubspaces.h" -#include "ExtendedDOMIsoSubspaces.h" -#include "IDLTypes.h" -#include "JSDOMBinding.h" -#include "JSDOMConvertBase.h" -#include "JSDOMConvertBufferSource.h" -#include "JSDOMConvertStrings.h" -#include "JSDOMConvertUnion.h" -#include "JSDOMExceptionHandling.h" -#include "JSDOMOperation.h" -#include "JSDOMWrapperCache.h" -#include "ScriptExecutionContext.h" -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/HeapAnalyzer.h> -#include <JavaScriptCore/JSCInlines.h> -#include <JavaScriptCore/JSDestructibleObjectHeapCellType.h> -#include <JavaScriptCore/SlotVisitorMacros.h> -#include <JavaScriptCore/SubspaceInlines.h> -#include <variant> -#include <wtf/GetPtr.h> -#include <wtf/PointerPreparations.h> -#include <wtf/URL.h> - -namespace WebCore { -using namespace JSC; - -// Functions - -static JSC_DECLARE_HOST_FUNCTION(jsReadableStreamSinkPrototypeFunction_enqueue); -static JSC_DECLARE_HOST_FUNCTION(jsReadableStreamSinkPrototypeFunction_close); -static JSC_DECLARE_HOST_FUNCTION(jsReadableStreamSinkPrototypeFunction_error); - -class JSReadableStreamSinkPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - static JSReadableStreamSinkPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) - { - JSReadableStreamSinkPrototype* ptr = new (NotNull, JSC::allocateCell<JSReadableStreamSinkPrototype>(vm)) JSReadableStreamSinkPrototype(vm, globalObject, structure); - ptr->finishCreation(vm); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableStreamSinkPrototype, Base); - 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: - JSReadableStreamSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) - : JSC::JSNonFinalObject(vm, structure) - { - } - - void finishCreation(JSC::VM&); -}; -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableStreamSinkPrototype, JSReadableStreamSinkPrototype::Base); - -/* Hash table for prototype */ - -static const HashTableValue JSReadableStreamSinkPrototypeTableValues[] = { - { "enqueue"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsReadableStreamSinkPrototypeFunction_enqueue), (intptr_t)(1) } }, - { "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsReadableStreamSinkPrototypeFunction_close), (intptr_t)(0) } }, - { "error"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsReadableStreamSinkPrototypeFunction_error), (intptr_t)(1) } }, -}; - -const ClassInfo JSReadableStreamSinkPrototype::s_info = { "ReadableStreamSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableStreamSinkPrototype) }; - -void JSReadableStreamSinkPrototype::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSReadableStreamSink::info(), JSReadableStreamSinkPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -const ClassInfo JSReadableStreamSink::s_info = { "ReadableStreamSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableStreamSink) }; - -JSReadableStreamSink::JSReadableStreamSink(Structure* structure, JSDOMGlobalObject& globalObject, Ref<ReadableStreamSink>&& impl) - : JSDOMWrapper<ReadableStreamSink>(structure, globalObject, WTFMove(impl)) -{ -} - -void JSReadableStreamSink::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); - - // static_assert(!std::is_base_of<ActiveDOMObject, ReadableStreamSink>::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject."); -} - -JSObject* JSReadableStreamSink::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) -{ - return JSReadableStreamSinkPrototype::create(vm, &globalObject, JSReadableStreamSinkPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); -} - -JSObject* JSReadableStreamSink::prototype(VM& vm, JSDOMGlobalObject& globalObject) -{ - return getDOMPrototype<JSReadableStreamSink>(vm, globalObject); -} - -void JSReadableStreamSink::destroy(JSC::JSCell* cell) -{ - JSReadableStreamSink* thisObject = static_cast<JSReadableStreamSink*>(cell); - thisObject->JSReadableStreamSink::~JSReadableStreamSink(); -} - -static inline JSC::EncodedJSValue jsReadableStreamSinkPrototypeFunction_enqueueBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSReadableStreamSink>::ClassParameter castedThis) -{ - auto& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - UNUSED_PARAM(throwScope); - UNUSED_PARAM(callFrame); - auto& impl = castedThis->wrapped(); - if (UNLIKELY(callFrame->argumentCount() < 1)) - return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); - EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); - auto chunk = convert<IDLUnion<IDLArrayBufferView, IDLArrayBuffer>>(*lexicalGlobalObject, argument0.value()); - RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.enqueue(WTFMove(chunk)); }))); -} - -JSC_DEFINE_HOST_FUNCTION(jsReadableStreamSinkPrototypeFunction_enqueue, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - return IDLOperation<JSReadableStreamSink>::call<jsReadableStreamSinkPrototypeFunction_enqueueBody>(*lexicalGlobalObject, *callFrame, "enqueue"); -} - -static inline JSC::EncodedJSValue jsReadableStreamSinkPrototypeFunction_closeBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSReadableStreamSink>::ClassParameter castedThis) -{ - auto& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - UNUSED_PARAM(throwScope); - UNUSED_PARAM(callFrame); - auto& impl = castedThis->wrapped(); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.close(); }))); -} - -JSC_DEFINE_HOST_FUNCTION(jsReadableStreamSinkPrototypeFunction_close, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - return IDLOperation<JSReadableStreamSink>::call<jsReadableStreamSinkPrototypeFunction_closeBody>(*lexicalGlobalObject, *callFrame, "close"); -} - -static inline JSC::EncodedJSValue jsReadableStreamSinkPrototypeFunction_errorBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSReadableStreamSink>::ClassParameter castedThis) -{ - auto& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - UNUSED_PARAM(throwScope); - UNUSED_PARAM(callFrame); - auto& impl = castedThis->wrapped(); - if (UNLIKELY(callFrame->argumentCount() < 1)) - return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); - EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); - auto message = convert<IDLDOMString>(*lexicalGlobalObject, argument0.value()); - RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.error(WTFMove(message)); }))); -} - -JSC_DEFINE_HOST_FUNCTION(jsReadableStreamSinkPrototypeFunction_error, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - return IDLOperation<JSReadableStreamSink>::call<jsReadableStreamSinkPrototypeFunction_errorBody>(*lexicalGlobalObject, *callFrame, "error"); -} - -JSC::GCClient::IsoSubspace* JSReadableStreamSink::subspaceForImpl(JSC::VM& vm) -{ - return WebCore::subspaceForImpl<JSReadableStreamSink, UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForReadableStreamSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForReadableStreamSink = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForReadableStreamSink.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForReadableStreamSink = WTFMove(space); }); -} - -void JSReadableStreamSink::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast<JSReadableStreamSink*>(cell); - analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); - if (thisObject->scriptExecutionContext()) - analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - Base::analyzeHeap(cell, analyzer); -} - -bool JSReadableStreamSinkOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, AbstractSlotVisitor& visitor, const char** reason) -{ - UNUSED_PARAM(handle); - UNUSED_PARAM(visitor); - UNUSED_PARAM(reason); - return false; -} - -void JSReadableStreamSinkOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) -{ - auto* jsReadableStreamSink = static_cast<JSReadableStreamSink*>(handle.slot()->asCell()); - auto& world = *static_cast<DOMWrapperWorld*>(context); - uncacheWrapper(world, &jsReadableStreamSink->wrapped(), jsReadableStreamSink); -} - -JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<ReadableStreamSink>&& impl) -{ - return createWrapper<ReadableStreamSink>(globalObject, WTFMove(impl)); -} - -JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, ReadableStreamSink& impl) -{ - return wrap(lexicalGlobalObject, globalObject, impl); -} - -ReadableStreamSink* JSReadableStreamSink::toWrapped(JSC::VM&, JSC::JSValue value) -{ - if (auto* wrapper = jsDynamicCast<JSReadableStreamSink*>(value)) - return &wrapper->wrapped(); - return nullptr; -} - -} |