1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-17 07:27:35 +00:00

LibWeb: Add AO readable_stream_default_controller_has_backpressure()

This commit is contained in:
Kenneth Myhra 2023-07-07 19:30:07 +02:00 committed by Andreas Kling
parent 2d0a2756b4
commit d2236e5ca5
2 changed files with 12 additions and 0 deletions

View file

@ -542,6 +542,17 @@ void readable_stream_default_controller_close(ReadableStreamDefaultController& c
} }
} }
// https://streams.spec.whatwg.org/#rs-default-controller-has-backpressure
bool readable_stream_default_controller_has_backpressure(ReadableStreamDefaultController& controller)
{
// 1. If ! ReadableStreamDefaultControllerShouldCallPull(controller) is true, return false.
if (readable_stream_default_controller_should_call_pull(controller))
return false;
// 2. Otherwise, return true.
return true;
}
// https://streams.spec.whatwg.org/#readable-stream-default-controller-enqueue // https://streams.spec.whatwg.org/#readable-stream-default-controller-enqueue
WebIDL::ExceptionOr<void> readable_stream_default_controller_enqueue(ReadableStreamDefaultController& controller, JS::Value chunk) WebIDL::ExceptionOr<void> readable_stream_default_controller_enqueue(ReadableStreamDefaultController& controller, JS::Value chunk)
{ {

View file

@ -55,6 +55,7 @@ WebIDL::ExceptionOr<void> readable_stream_default_reader_release(ReadableStreamD
WebIDL::ExceptionOr<void> set_up_readable_stream_default_reader(ReadableStreamDefaultReader&, ReadableStream&); WebIDL::ExceptionOr<void> set_up_readable_stream_default_reader(ReadableStreamDefaultReader&, ReadableStream&);
WebIDL::ExceptionOr<void> set_up_readable_stream_byob_reader(ReadableStreamBYOBReader&, ReadableStream&); WebIDL::ExceptionOr<void> set_up_readable_stream_byob_reader(ReadableStreamBYOBReader&, ReadableStream&);
void readable_stream_default_controller_close(ReadableStreamDefaultController&); void readable_stream_default_controller_close(ReadableStreamDefaultController&);
bool readable_stream_default_controller_has_backpressure(ReadableStreamDefaultController&);
WebIDL::ExceptionOr<void> readable_stream_default_controller_enqueue(ReadableStreamDefaultController&, JS::Value chunk); WebIDL::ExceptionOr<void> readable_stream_default_controller_enqueue(ReadableStreamDefaultController&, JS::Value chunk);
WebIDL::ExceptionOr<void> readable_stream_default_controller_can_pull_if_needed(ReadableStreamDefaultController&); WebIDL::ExceptionOr<void> readable_stream_default_controller_can_pull_if_needed(ReadableStreamDefaultController&);
bool readable_stream_default_controller_should_call_pull(ReadableStreamDefaultController&); bool readable_stream_default_controller_should_call_pull(ReadableStreamDefaultController&);