mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibJS: Add ArrayBuffer::create() for ByteBuffer passed by value
This commit is contained in:
parent
615be9eb7c
commit
841bd680fa
Notes:
sideshowbarker
2024-07-17 22:48:04 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/841bd680faa Pull-request: https://github.com/SerenityOS/serenity/pull/11249
2 changed files with 6 additions and 0 deletions
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue