mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
LibJS: Make CreateDataByteBlock AO publicly available
At the same time, make CopyDataBlockBytes const-correct.
This commit is contained in:
parent
267074cd81
commit
56d0a0ac0f
Notes:
sideshowbarker
2024-07-16 23:13:25 +09:00
Author: https://github.com/ADKaster
Commit: 56d0a0ac0f
Pull-request: https://github.com/SerenityOS/serenity/pull/21039
2 changed files with 4 additions and 3 deletions
|
@ -51,7 +51,7 @@ void ArrayBuffer::visit_edges(Cell::Visitor& visitor)
|
|||
}
|
||||
|
||||
// 6.2.9.1 CreateByteDataBlock ( size ), https://tc39.es/ecma262/#sec-createbytedatablock
|
||||
static ThrowCompletionOr<ByteBuffer> create_byte_data_block(VM& vm, size_t size)
|
||||
ThrowCompletionOr<ByteBuffer> create_byte_data_block(VM& vm, size_t size)
|
||||
{
|
||||
// 1. If size > 2^53 - 1, throw a RangeError exception.
|
||||
if (size > MAX_ARRAY_LIKE_INDEX)
|
||||
|
@ -68,7 +68,7 @@ static ThrowCompletionOr<ByteBuffer> create_byte_data_block(VM& vm, size_t size)
|
|||
}
|
||||
|
||||
// 6.2.9.3 CopyDataBlockBytes ( toBlock, toIndex, fromBlock, fromIndex, count ), https://tc39.es/ecma262/#sec-copydatablockbytes
|
||||
void copy_data_block_bytes(ByteBuffer& to_block, u64 to_index, ByteBuffer& from_block, u64 from_index, u64 count)
|
||||
void copy_data_block_bytes(ByteBuffer& to_block, u64 to_index, ByteBuffer const& from_block, u64 from_index, u64 count)
|
||||
{
|
||||
// 1. Assert: fromBlock and toBlock are distinct values.
|
||||
VERIFY(&to_block != &from_block);
|
||||
|
|
|
@ -99,7 +99,8 @@ private:
|
|||
Value m_detach_key;
|
||||
};
|
||||
|
||||
void copy_data_block_bytes(ByteBuffer& to_block, u64 to_index, ByteBuffer& from_block, u64 from_index, u64 count);
|
||||
ThrowCompletionOr<ByteBuffer> create_byte_data_block(VM& vm, size_t size);
|
||||
void copy_data_block_bytes(ByteBuffer& to_block, u64 to_index, ByteBuffer const& from_block, u64 from_index, u64 count);
|
||||
ThrowCompletionOr<ArrayBuffer*> allocate_array_buffer(VM&, FunctionObject& constructor, size_t byte_length);
|
||||
ThrowCompletionOr<void> detach_array_buffer(VM&, ArrayBuffer& array_buffer, Optional<Value> key = {});
|
||||
ThrowCompletionOr<ArrayBuffer*> clone_array_buffer(VM&, ArrayBuffer& source_buffer, size_t source_byte_offset, size_t source_length);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue