diff --git a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp index 1e265e5911..80b4ace809 100644 --- a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp +++ b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp @@ -602,7 +602,7 @@ bool readable_stream_default_controller_should_call_pull(ReadableStreamDefaultCo VERIFY(desired_size.has_value()); // 7. If desiredSize > 0, return true. - if (desired_size.release_value() > 0) + if (desired_size.release_value() > 0.0) return true; // 8. Return false. @@ -643,7 +643,7 @@ void readable_stream_default_controller_error(ReadableStreamDefaultController& c } // https://streams.spec.whatwg.org/#readable-stream-default-controller-get-desired-size -Optional readable_stream_default_controller_get_desired_size(ReadableStreamDefaultController& controller) +Optional readable_stream_default_controller_get_desired_size(ReadableStreamDefaultController& controller) { auto stream = controller.stream(); @@ -655,7 +655,7 @@ Optional readable_stream_default_controller_get_desired_size(ReadableStre // 3. If state is "closed", return 0. if (stream->is_closed()) - return 0.0f; + return 0.0; // 4. Return controller.[[strategyHWM]] − controller.[[queueTotalSize]]. return controller.strategy_hwm() - controller.queue_total_size(); @@ -942,7 +942,7 @@ WebIDL::ExceptionOr readable_byte_stream_controller_fill_read_request_from auto& realm = controller.realm(); // 1. Assert: controller.[[queueTotalSize]] > 0. - VERIFY(controller.queue_total_size() > 0); + VERIFY(controller.queue_total_size() > 0.0); // 2. Let entry be controller.[[queue]][0]. // 3. Remove entry from controller.[[queue]]. @@ -988,7 +988,7 @@ WebIDL::ExceptionOr readable_byte_stream_controller_handle_queue_drain(Rea VERIFY(controller.stream()->state() == ReadableStream::State::Readable); // 2. If controller.[[queueTotalSize]] is 0 and controller.[[closeRequested]] is true, - if (controller.queue_total_size() == 0 && controller.close_requested()) { + if (controller.queue_total_size() == 0.0 && controller.close_requested()) { // 1. Perform ! ReadableByteStreamControllerClearAlgorithms(controller). readable_byte_stream_controller_clear_algorithms(controller); diff --git a/Userland/Libraries/LibWeb/Streams/AbstractOperations.h b/Userland/Libraries/LibWeb/Streams/AbstractOperations.h index fce18bffc1..9f045c8254 100644 --- a/Userland/Libraries/LibWeb/Streams/AbstractOperations.h +++ b/Userland/Libraries/LibWeb/Streams/AbstractOperations.h @@ -52,7 +52,7 @@ bool readable_stream_default_controller_should_call_pull(ReadableStreamDefaultCo void readable_stream_default_controller_clear_algorithms(ReadableStreamDefaultController&); void readable_stream_default_controller_error(ReadableStreamDefaultController&, JS::Value error); -Optional readable_stream_default_controller_get_desired_size(ReadableStreamDefaultController&); +Optional readable_stream_default_controller_get_desired_size(ReadableStreamDefaultController&); bool readable_stream_default_controller_can_close_or_enqueue(ReadableStreamDefaultController&); WebIDL::ExceptionOr set_up_readable_stream_default_controller(ReadableStream&, ReadableStreamDefaultController&, StartAlgorithm&&, PullAlgorithm&&, CancelAlgorithm&&, double high_water_mark, SizeAlgorithm&&); WebIDL::ExceptionOr set_up_readable_stream_default_controller_from_underlying_source(ReadableStream&, JS::Value underlying_source_value, UnderlyingSource, double high_water_mark, SizeAlgorithm&&); diff --git a/Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.h b/Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.h index b8f09f3442..6449100623 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.h +++ b/Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.h @@ -105,14 +105,14 @@ public: SinglyLinkedList& queue() { return m_queue; } - u32 queue_total_size() const { return m_queue_total_size; } - void set_queue_total_size(u32 size) { m_queue_total_size = size; } + double queue_total_size() const { return m_queue_total_size; } + void set_queue_total_size(double size) { m_queue_total_size = size; } bool started() const { return m_started; } void set_started(bool value) { m_started = value; } - u32 strategy_hwm() const { return m_strategy_hwm; } - void set_strategy_hwm(u32 value) { m_strategy_hwm = value; } + double strategy_hwm() const { return m_strategy_hwm; } + void set_strategy_hwm(double value) { m_strategy_hwm = value; } JS::GCPtr stream() const { return m_stream; } JS::GCPtr stream() { return m_stream; } @@ -165,7 +165,7 @@ private: // https://streams.spec.whatwg.org/#readablestreamdefaultcontroller-queuetotalsize // The total size of all the chunks stored in [[queue]] - u32 m_queue_total_size { 0 }; + double m_queue_total_size { 0 }; // https://streams.spec.whatwg.org/#readablestreamdefaultcontroller-started // A boolean flag indicating whether the underlying source has finished starting @@ -173,7 +173,7 @@ private: // https://streams.spec.whatwg.org/#readablestreamdefaultcontroller-strategyhwm // A number supplied to the constructor as part of the stream’s queuing strategy, indicating the point at which the stream will apply backpressure to its underlying source - u32 m_strategy_hwm { 0 }; + double m_strategy_hwm { 0 }; // https://streams.spec.whatwg.org/#readablestreamdefaultcontroller-stream // The ReadableStream instance controlled diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultController.cpp b/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultController.cpp index f6d8c92e66..8bc90c56ab 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultController.cpp +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultController.cpp @@ -22,7 +22,7 @@ ReadableStreamDefaultController::ReadableStreamDefaultController(JS::Realm& real } // https://streams.spec.whatwg.org/#rs-default-controller-desired-size -Optional ReadableStreamDefaultController::desired_size() +Optional ReadableStreamDefaultController::desired_size() { // 1. Return ! ReadableStreamDefaultControllerGetDesiredSize(this). return readable_stream_default_controller_get_desired_size(*this); diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultController.h b/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultController.h index bb03e0e2e9..b62c8f2669 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultController.h +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultController.h @@ -25,7 +25,7 @@ public: explicit ReadableStreamDefaultController(JS::Realm&); virtual ~ReadableStreamDefaultController() override = default; - Optional desired_size(); + Optional desired_size(); WebIDL::ExceptionOr close(); WebIDL::ExceptionOr enqueue(JS::Value chunk); @@ -54,8 +54,8 @@ public: bool started() const { return m_started; } void set_started(bool value) { m_started = value; } - size_t strategy_hwm() const { return m_strategy_hwm; } - void set_strategy_hwm(size_t value) { m_strategy_hwm = value; } + double strategy_hwm() const { return m_strategy_hwm; } + void set_strategy_hwm(double value) { m_strategy_hwm = value; } auto& strategy_size_algorithm() { return m_strategy_size_algorithm; } void set_strategy_size_algorithm(Optional value) { m_strategy_size_algorithm = move(value); } @@ -106,7 +106,7 @@ private: // https://streams.spec.whatwg.org/#readablestreamdefaultcontroller-strategyhwm // A number supplied to the constructor as part of the stream’s queuing strategy, indicating the point at which the stream will apply backpressure to its underlying source - size_t m_strategy_hwm { 0 }; + double m_strategy_hwm { 0 }; // https://streams.spec.whatwg.org/#readablestreamdefaultcontroller-strategysizealgorithm // An algorithm to calculate the size of enqueued chunks, as part of the stream’s queuing strategy