aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/JSDOMConvertBufferSource+JSBuffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/bindings/JSDOMConvertBufferSource+JSBuffer.h')
-rw-r--r--src/bun.js/bindings/JSDOMConvertBufferSource+JSBuffer.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/bun.js/bindings/JSDOMConvertBufferSource+JSBuffer.h b/src/bun.js/bindings/JSDOMConvertBufferSource+JSBuffer.h
new file mode 100644
index 000000000..76d05e1b1
--- /dev/null
+++ b/src/bun.js/bindings/JSDOMConvertBufferSource+JSBuffer.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "BufferSource.h"
+#include "IDLTypes.h"
+#include "JSDOMConvertBase.h"
+#include "JSDOMWrapperCache.h"
+#include "JSBuffer.h"
+
+namespace WebCore {
+
+struct IDLJSBuffer : IDLTypedArray<WebCore::JSBuffer> {
+};
+
+template<> struct JSConverter<IDLJSBuffer> {
+ static constexpr bool needsState = true;
+ static constexpr bool needsGlobalObject = true;
+
+ template<typename U>
+ static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
+ {
+ return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
+ }
+
+ template<typename U>
+ static JSC::JSValue convertNewlyCreated(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, U&& value)
+ {
+ return convert(lexicalGlobalObject, globalObject, std::forward<U>(value));
+ }
+};
+
+} \ No newline at end of file