LibJS: Add ArrayBuffer::create() for ByteBuffer passed by value

This commit is contained in:
Linus Groh 2021-12-13 22:05:42 +00:00 committed by Andreas Kling
parent 615be9eb7c
commit 841bd680fa
Notes: sideshowbarker 2024-07-17 22:48:04 +09:00
2 changed files with 6 additions and 0 deletions

View file

@ -20,6 +20,11 @@ ArrayBuffer* ArrayBuffer::create(GlobalObject& global_object, size_t byte_length
return global_object.heap().allocate<ArrayBuffer>(global_object, buffer.release_value(), *global_object.array_buffer_prototype());
}
ArrayBuffer* ArrayBuffer::create(GlobalObject& global_object, ByteBuffer buffer)
{
return global_object.heap().allocate<ArrayBuffer>(global_object, move(buffer), *global_object.array_buffer_prototype());
}
ArrayBuffer* ArrayBuffer::create(GlobalObject& global_object, ByteBuffer* buffer)
{
return global_object.heap().allocate<ArrayBuffer>(global_object, buffer, *global_object.array_buffer_prototype());

View file

@ -26,6 +26,7 @@ class ArrayBuffer : public Object {
public:
static ArrayBuffer* create(GlobalObject&, size_t);
static ArrayBuffer* create(GlobalObject&, ByteBuffer);
static ArrayBuffer* create(GlobalObject&, ByteBuffer*);
ArrayBuffer(ByteBuffer buffer, Object& prototype);