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

LibWeb: Add ReadableStreamBYOBRequest interface

This commit is contained in:
Matthew Olsson 2023-04-10 18:37:27 -07:00 committed by Linus Groh
parent dc5f213fa0
commit c7aa4fa166
6 changed files with 79 additions and 0 deletions

View file

@ -0,0 +1,37 @@
/*
* Copyright (c) 2023, Matthew Olsson <mattco@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Runtime/TypedArray.h>
#include <LibWeb/Bindings/PlatformObject.h>
namespace Web::Streams {
// https://streams.spec.whatwg.org/#readablestreambyobrequest
class ReadableStreamBYOBRequest : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(ReadableStreamBYOBRequest, Bindings::PlatformObject);
public:
virtual ~ReadableStreamBYOBRequest() override = default;
JS::GCPtr<JS::TypedArrayBase> view();
private:
explicit ReadableStreamBYOBRequest(JS::Realm&);
virtual void visit_edges(Cell::Visitor&) override;
// https://streams.spec.whatwg.org/#readablestreambyobrequest-controller
// The parent ReadableByteStreamController instance
JS::GCPtr<JS::Object> 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.
JS::GCPtr<JS::TypedArrayBase> m_view;
};
}