mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibWeb: Implement read a chunk concept for ReadableStreamDefaultReader
This commit is contained in:
parent
50f454fdd5
commit
34ecc59508
Notes:
sideshowbarker
2024-07-16 20:31:50 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/34ecc59508 Pull-request: https://github.com/SerenityOS/serenity/pull/24132 Reviewed-by: https://github.com/shannonbooth Reviewed-by: https://github.com/trflynn89
2 changed files with 9 additions and 0 deletions
|
@ -15,6 +15,7 @@
|
|||
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/ReadableStreamDefaultReaderPrototype.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/IncrementalReadLoopReadRequest.h>
|
||||
#include <LibWeb/Streams/AbstractOperations.h>
|
||||
#include <LibWeb/Streams/ReadableStream.h>
|
||||
#include <LibWeb/Streams/ReadableStreamDefaultReader.h>
|
||||
|
@ -187,6 +188,13 @@ JS::NonnullGCPtr<JS::Promise> ReadableStreamDefaultReader::read()
|
|||
return JS::NonnullGCPtr { verify_cast<JS::Promise>(*promise_capability->promise()) };
|
||||
}
|
||||
|
||||
void ReadableStreamDefaultReader::read_a_chunk(Fetch::Infrastructure::IncrementalReadLoopReadRequest& read_request)
|
||||
{
|
||||
// To read a chunk from a ReadableStreamDefaultReader reader, given a read request readRequest,
|
||||
// perform ! ReadableStreamDefaultReaderRead(reader, readRequest).
|
||||
readable_stream_default_reader_read(*this, read_request);
|
||||
}
|
||||
|
||||
// https://streams.spec.whatwg.org/#readablestreamdefaultreader-read-all-bytes
|
||||
void ReadableStreamDefaultReader::read_all_bytes(ReadLoopReadRequest::SuccessSteps success_steps, ReadLoopReadRequest::FailureSteps failure_steps)
|
||||
{
|
||||
|
|
|
@ -79,6 +79,7 @@ public:
|
|||
|
||||
JS::NonnullGCPtr<JS::Promise> read();
|
||||
|
||||
void read_a_chunk(Fetch::Infrastructure::IncrementalReadLoopReadRequest& read_request);
|
||||
void read_all_bytes(ReadLoopReadRequest::SuccessSteps, ReadLoopReadRequest::FailureSteps);
|
||||
void read_all_chunks(ReadLoopReadRequest::ChunkSteps, ReadLoopReadRequest::SuccessSteps, ReadLoopReadRequest::FailureSteps);
|
||||
JS::NonnullGCPtr<WebIDL::Promise> read_all_bytes_deprecated();
|
||||
|
|
Loading…
Add table
Reference in a new issue