/* * Copyright (c) 2023, Matthew Olsson * Copyright (c) 2023, Shannon Booth * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Web::Streams { // https://streams.spec.whatwg.org/#readablestreambyobrequest class ReadableStreamBYOBRequest : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(ReadableStreamBYOBRequest, Bindings::PlatformObject); GC_DECLARE_ALLOCATOR(ReadableStreamBYOBRequest); public: virtual ~ReadableStreamBYOBRequest() override = default; GC::Ptr view(); void set_controller(GC::Ptr value) { m_controller = value; } void set_view(GC::Ptr value) { m_view = value; } WebIDL::ExceptionOr respond(WebIDL::UnsignedLongLong bytes_written); WebIDL::ExceptionOr respond_with_new_view(GC::Root const& view); private: explicit ReadableStreamBYOBRequest(JS::Realm&); virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // https://streams.spec.whatwg.org/#readablestreambyobrequest-controller // The parent ReadableByteStreamController instance GC::Ptr m_controller; // https://streams.spec.whatwg.org/#readablestreambyobrequest-view // A typed array representing the destination region to which the controller can write generated data, or null after the BYOB request has been invalidated. GC::Ptr m_view; }; }