1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:57:44 +00:00

LibWeb: Use u64 for ReadableByteStream offsets instead of u32

These are specified in the IDL as "unsigned long long", which translates
to u64.
This commit is contained in:
Matthew Olsson 2023-04-18 20:05:06 -07:00 committed by Andreas Kling
parent 5fafd82927
commit 42fb847cc8
3 changed files with 12 additions and 12 deletions

View file

@ -27,23 +27,23 @@ struct PullIntoDescriptor {
// https://streams.spec.whatwg.org/#pull-into-descriptor-buffer-byte-length // https://streams.spec.whatwg.org/#pull-into-descriptor-buffer-byte-length
// A positive integer representing the initial byte length of buffer // A positive integer representing the initial byte length of buffer
u32 buffer_byte_length; u64 buffer_byte_length;
// https://streams.spec.whatwg.org/#pull-into-descriptor-byte-offset // https://streams.spec.whatwg.org/#pull-into-descriptor-byte-offset
// A nonnegative integer byte offset into the buffer where the underlying byte source will start writing // A nonnegative integer byte offset into the buffer where the underlying byte source will start writing
u32 byte_offset; u64 byte_offset;
// https://streams.spec.whatwg.org/#pull-into-descriptor-byte-length // https://streams.spec.whatwg.org/#pull-into-descriptor-byte-length
// A positive integer number of bytes which can be written into the buffer // A positive integer number of bytes which can be written into the buffer
u32 byte_length; u64 byte_length;
// https://streams.spec.whatwg.org/#pull-into-descriptor-bytes-filled // https://streams.spec.whatwg.org/#pull-into-descriptor-bytes-filled
// A nonnegative integer number of bytes that have been written into the buffer so far // A nonnegative integer number of bytes that have been written into the buffer so far
u32 bytes_filled; u64 bytes_filled;
// https://streams.spec.whatwg.org/#pull-into-descriptor-element-size // https://streams.spec.whatwg.org/#pull-into-descriptor-element-size
// A positive integer representing the number of bytes that can be written into the buffer at a time, using views of the type described by the view constructor // A positive integer representing the number of bytes that can be written into the buffer at a time, using views of the type described by the view constructor
u32 element_size; u64 element_size;
// https://streams.spec.whatwg.org/#pull-into-descriptor-view-constructor // https://streams.spec.whatwg.org/#pull-into-descriptor-view-constructor
// A typed array constructor or %DataView%, which will be used for constructing a view with which to write into the buffer // A typed array constructor or %DataView%, which will be used for constructing a view with which to write into the buffer
@ -62,11 +62,11 @@ struct ReadableByteStreamQueueEntry {
// https://streams.spec.whatwg.org/#readable-byte-stream-queue-entry-byte-offset // https://streams.spec.whatwg.org/#readable-byte-stream-queue-entry-byte-offset
// A nonnegative integer number giving the byte offset derived from the view originally supplied by the underlying byte source // A nonnegative integer number giving the byte offset derived from the view originally supplied by the underlying byte source
u32 byte_offset; u64 byte_offset;
// https://streams.spec.whatwg.org/#readable-byte-stream-queue-entry-byte-length // https://streams.spec.whatwg.org/#readable-byte-stream-queue-entry-byte-length
// A nonnegative integer number giving the byte length derived from the view originally supplied by the underlying byte source // A nonnegative integer number giving the byte length derived from the view originally supplied by the underlying byte source
u32 byte_length; u64 byte_length;
}; };
// https://streams.spec.whatwg.org/#readablebytestreamcontroller // https://streams.spec.whatwg.org/#readablebytestreamcontroller
@ -83,8 +83,8 @@ public:
WebIDL::ExceptionOr<void> close(); WebIDL::ExceptionOr<void> close();
void error(JS::Value error); void error(JS::Value error);
Optional<u32> const& auto_allocate_chunk_size() { return m_auto_allocate_chunk_size; } Optional<u64> const& auto_allocate_chunk_size() { return m_auto_allocate_chunk_size; }
void set_auto_allocate_chunk_size(Optional<u32> value) { m_auto_allocate_chunk_size = value; } void set_auto_allocate_chunk_size(Optional<u64> value) { m_auto_allocate_chunk_size = value; }
auto& cancel_algorithm() { return m_cancel_algorithm; } auto& cancel_algorithm() { return m_cancel_algorithm; }
void set_cancel_algorithm(Optional<CancelAlgorithm> value) { m_cancel_algorithm = move(value); } void set_cancel_algorithm(Optional<CancelAlgorithm> value) { m_cancel_algorithm = move(value); }
@ -129,7 +129,7 @@ private:
// https://streams.spec.whatwg.org/#readablebytestreamcontroller-autoallocatechunksize // https://streams.spec.whatwg.org/#readablebytestreamcontroller-autoallocatechunksize
// A positive integer, when the automatic buffer allocation feature is enabled. In that case, this value specifies the size of buffer to allocate. It is undefined otherwise. // A positive integer, when the automatic buffer allocation feature is enabled. In that case, this value specifies the size of buffer to allocate. It is undefined otherwise.
Optional<u32> m_auto_allocate_chunk_size; Optional<u64> m_auto_allocate_chunk_size;
// https://streams.spec.whatwg.org/#readablebytestreamcontroller-byobrequest // https://streams.spec.whatwg.org/#readablebytestreamcontroller-byobrequest
// A ReadableStreamBYOBRequest instance representing the current BYOB pull request, or null if there are no pending requests // A ReadableStreamBYOBRequest instance representing the current BYOB pull request, or null if there are no pending requests

View file

@ -36,7 +36,7 @@ JS::ThrowCompletionOr<UnderlyingSource> UnderlyingSource::from_value(JS::VM& vm,
} }
if (TRY(object.has_property("autoAllocateChunkSize"))) if (TRY(object.has_property("autoAllocateChunkSize")))
underlying_source.auto_allocate_chunk_size = TRY(TRY(object.get("autoAllocateChunkSize")).to_bigint_int64(vm)); underlying_source.auto_allocate_chunk_size = TRY(TRY(object.get("autoAllocateChunkSize")).to_bigint_uint64(vm));
return underlying_source; return underlying_source;
} }

View file

@ -23,7 +23,7 @@ struct UnderlyingSource {
JS::Handle<WebIDL::CallbackType> pull; JS::Handle<WebIDL::CallbackType> pull;
JS::Handle<WebIDL::CallbackType> cancel; JS::Handle<WebIDL::CallbackType> cancel;
Optional<ReadableStreamType> type; Optional<ReadableStreamType> type;
Optional<i64> auto_allocate_chunk_size; Optional<u64> auto_allocate_chunk_size;
static JS::ThrowCompletionOr<UnderlyingSource> from_value(JS::VM&, JS::Value); static JS::ThrowCompletionOr<UnderlyingSource> from_value(JS::VM&, JS::Value);
}; };