aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/JSDOMConvertBufferSource+JSBuffer.h
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/bun.js/bindings/JSDOMConvertBufferSource+JSBuffer.h
parent25f820c6bf1d8ec6d444ef579cc036b8c0607b75 (diff)
downloadbun-729d445b6885f69dd2c6355f38707bd42851c791.tar.gz
bun-729d445b6885f69dd2c6355f38707bd42851c791.tar.zst
bun-729d445b6885f69dd2c6355f38707bd42851c791.zip
change the directory structurejarred/rename
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