mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:07:34 +00:00
LibWeb: Add ReadableBSControllerProcessPullIntoDescriptorsUsingQueue
This commit is contained in:
parent
737dc6ce4e
commit
1443715775
2 changed files with 30 additions and 0 deletions
|
@ -1848,6 +1848,35 @@ void readable_byte_stream_controller_commit_pull_into_descriptor(ReadableStream&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://streams.spec.whatwg.org/#readable-byte-stream-controller-process-pull-into-descriptors-using-queue
|
||||||
|
void readable_byte_stream_controller_process_pull_into_descriptors_using_queue(ReadableByteStreamController& controller)
|
||||||
|
{
|
||||||
|
// 1. Assert: controller.[[closeRequested]] is false.
|
||||||
|
VERIFY(!controller.close_requested());
|
||||||
|
|
||||||
|
// 2. While controller.[[pendingPullIntos]] is not empty,
|
||||||
|
while (!controller.pending_pull_intos().is_empty()) {
|
||||||
|
// 1. If controller.[[queueTotalSize]] is 0, return.
|
||||||
|
if (controller.queue_total_size() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// 2. Let pullIntoDescriptor be controller.[[pendingPullIntos]][0].
|
||||||
|
auto& pull_into_descriptor = controller.pending_pull_intos().first();
|
||||||
|
|
||||||
|
// 3. If ! ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) is true,
|
||||||
|
if (readable_byte_stream_controller_fill_pull_into_descriptor_from_queue(controller, pull_into_descriptor)) {
|
||||||
|
// NOTE: We store the returned pull into descriptor here as the 'shift pending pull into' will remove
|
||||||
|
// the first entry into the list which we have a reference to above.
|
||||||
|
|
||||||
|
// 1. Perform ! ReadableByteStreamControllerShiftPendingPullInto(controller).
|
||||||
|
auto descriptor = readable_byte_stream_controller_shift_pending_pull_into(controller);
|
||||||
|
|
||||||
|
// 2. Perform ! ReadableByteStreamControllerCommitPullIntoDescriptor(controller.[[stream]], pullIntoDescriptor).
|
||||||
|
readable_byte_stream_controller_commit_pull_into_descriptor(*controller.stream(), descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// https://streams.spec.whatwg.org/#abstract-opdef-readablebytestreamcontrollerprocessreadrequestsusingqueue
|
// https://streams.spec.whatwg.org/#abstract-opdef-readablebytestreamcontrollerprocessreadrequestsusingqueue
|
||||||
WebIDL::ExceptionOr<void> readable_byte_stream_controller_process_read_requests_using_queue(ReadableByteStreamController& controller)
|
WebIDL::ExceptionOr<void> readable_byte_stream_controller_process_read_requests_using_queue(ReadableByteStreamController& controller)
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,6 +83,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::ArrayBuffer>> transfer_array_buffer(JS:
|
||||||
WebIDL::ExceptionOr<void> readable_byte_stream_controller_enqueue_detached_pull_into_queue(ReadableByteStreamController& controller, PullIntoDescriptor& pull_into_descriptor);
|
WebIDL::ExceptionOr<void> readable_byte_stream_controller_enqueue_detached_pull_into_queue(ReadableByteStreamController& controller, PullIntoDescriptor& pull_into_descriptor);
|
||||||
void readable_byte_stream_controller_commit_pull_into_descriptor(ReadableStream&, PullIntoDescriptor const&);
|
void readable_byte_stream_controller_commit_pull_into_descriptor(ReadableStream&, PullIntoDescriptor const&);
|
||||||
WebIDL::ExceptionOr<void> readable_byte_stream_controller_process_read_requests_using_queue(ReadableByteStreamController& controller);
|
WebIDL::ExceptionOr<void> readable_byte_stream_controller_process_read_requests_using_queue(ReadableByteStreamController& controller);
|
||||||
|
void readable_byte_stream_controller_process_pull_into_descriptors_using_queue(ReadableByteStreamController&);
|
||||||
void readable_byte_stream_controller_enqueue_chunk_to_queue(ReadableByteStreamController& controller, JS::NonnullGCPtr<JS::ArrayBuffer> buffer, u32 byte_offset, u32 byte_length);
|
void readable_byte_stream_controller_enqueue_chunk_to_queue(ReadableByteStreamController& controller, JS::NonnullGCPtr<JS::ArrayBuffer> buffer, u32 byte_offset, u32 byte_length);
|
||||||
WebIDL::ExceptionOr<void> readable_byte_stream_controller_enqueue_cloned_chunk_to_queue(ReadableByteStreamController& controller, JS::ArrayBuffer& buffer, u64 byte_offset, u64 byte_length);
|
WebIDL::ExceptionOr<void> readable_byte_stream_controller_enqueue_cloned_chunk_to_queue(ReadableByteStreamController& controller, JS::ArrayBuffer& buffer, u64 byte_offset, u64 byte_length);
|
||||||
PullIntoDescriptor readable_byte_stream_controller_shift_pending_pull_into(ReadableByteStreamController& controller);
|
PullIntoDescriptor readable_byte_stream_controller_shift_pending_pull_into(ReadableByteStreamController& controller);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue