/* * Copyright (c) 2022, Linus Groh * Copyright (c) 2023, Matthew Olsson * Copyright (c) 2023-2025, Shannon Booth * Copyright (c) 2023-2024, Kenneth Myhra * Copyright (c) 2025, Tim Flynn * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Web::Streams { // 5.5.1. Working with writable streams, https://streams.spec.whatwg.org/#ws-abstract-ops WebIDL::ExceptionOr> acquire_writable_stream_default_writer(WritableStream&); WebIDL::ExceptionOr> create_writable_stream(JS::Realm& realm, GC::Ref start_algorithm, GC::Ref write_algorithm, GC::Ref close_algorithm, GC::Ref abort_algorithm, double high_water_mark, GC::Ref size_algorithm); void initialize_writable_stream(WritableStream&); bool is_writable_stream_locked(WritableStream const&); WebIDL::ExceptionOr set_up_writable_stream_default_writer(WritableStreamDefaultWriter&, WritableStream&); GC::Ref writable_stream_abort(WritableStream&, JS::Value reason); GC::Ref writable_stream_close(WritableStream&); // 5.5.2. Interfacing with controllers, https://streams.spec.whatwg.org/#ws-abstract-ops-used-by-controllers GC::Ref writable_stream_add_write_request(WritableStream&); bool writable_stream_close_queued_or_in_flight(WritableStream const&); void writable_stream_deal_with_rejection(WritableStream&, JS::Value error); void writable_stream_finish_erroring(WritableStream&); void writable_stream_finish_in_flight_close(WritableStream&); void writable_stream_finish_in_flight_close_with_error(WritableStream&, JS::Value error); void writable_stream_finish_in_flight_write(WritableStream&); void writable_stream_finish_in_flight_write_with_error(WritableStream&, JS::Value error); bool writable_stream_has_operation_marked_in_flight(WritableStream const&); void writable_stream_mark_close_request_in_flight(WritableStream&); void writable_stream_mark_first_write_request_in_flight(WritableStream&); void writable_stream_reject_close_and_closed_promise_if_needed(WritableStream&); void writable_stream_start_erroring(WritableStream&, JS::Value reason); void writable_stream_update_backpressure(WritableStream&, bool backpressure); // 5.5.3. Writers, https://streams.spec.whatwg.org/#ws-writer-abstract-ops GC::Ref writable_stream_default_writer_abort(WritableStreamDefaultWriter&, JS::Value reason); GC::Ref writable_stream_default_writer_close(WritableStreamDefaultWriter&); GC::Ref writable_stream_default_writer_close_with_error_propagation(WritableStreamDefaultWriter&); void writable_stream_default_writer_ensure_closed_promise_rejected(WritableStreamDefaultWriter&, JS::Value error); void writable_stream_default_writer_ensure_ready_promise_rejected(WritableStreamDefaultWriter&, JS::Value error); Optional writable_stream_default_writer_get_desired_size(WritableStreamDefaultWriter const&); void writable_stream_default_writer_release(WritableStreamDefaultWriter&); GC::Ref writable_stream_default_writer_write(WritableStreamDefaultWriter&, JS::Value chunk); // 5.5.4. Default controllers, https://streams.spec.whatwg.org/#ws-default-controller-abstract-ops WebIDL::ExceptionOr set_up_writable_stream_default_controller(WritableStream&, WritableStreamDefaultController&, GC::Ref, GC::Ref, GC::Ref, GC::Ref, double high_water_mark, GC::Ref); WebIDL::ExceptionOr set_up_writable_stream_default_controller_from_underlying_sink(WritableStream&, JS::Value underlying_sink_value, UnderlyingSink&, double high_water_mark, GC::Ref size_algorithm); void writable_stream_default_controller_advance_queue_if_needed(WritableStreamDefaultController&); void writable_stream_default_controller_clear_algorithms(WritableStreamDefaultController&); void writable_stream_default_controller_close(WritableStreamDefaultController&); void writable_stream_default_controller_error(WritableStreamDefaultController&, JS::Value error); void writable_stream_default_controller_error_if_needed(WritableStreamDefaultController&, JS::Value error); bool writable_stream_default_controller_get_backpressure(WritableStreamDefaultController const&); JS::Value writable_stream_default_controller_get_chunk_size(WritableStreamDefaultController&, JS::Value chunk); double writable_stream_default_controller_get_desired_size(WritableStreamDefaultController const&); void writable_stream_default_controller_process_close(WritableStreamDefaultController&); void writable_stream_default_controller_process_write(WritableStreamDefaultController&, JS::Value chunk); void writable_stream_default_controller_write(WritableStreamDefaultController&, JS::Value chunk, JS::Value chunk_size); }