1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +00:00

LibWeb/Streams: Make ReadIntoRequest GC-allocated

This ports the same change which was made in 9c3e9e8981 to
ReadRequest, although nothing actually implements this interface yet.
This commit is contained in:
Shannon Booth 2023-09-23 13:30:39 +12:00 committed by Andrew Kaster
parent acda17ccc4
commit d81b0e3c86
2 changed files with 7 additions and 3 deletions

View file

@ -45,6 +45,8 @@ void ReadableStreamBYOBReader::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
ReadableStreamGenericReaderMixin::visit_edges(visitor);
for (auto& request : m_read_into_requests)
visitor.visit(request);
}
}

View file

@ -16,7 +16,9 @@
namespace Web::Streams {
// https://streams.spec.whatwg.org/#read-into-request
class ReadIntoRequest : public RefCounted<ReadIntoRequest> {
class ReadIntoRequest : public JS::Cell {
JS_CELL(ReadIntoRequest, JS::Cell);
public:
virtual ~ReadIntoRequest() = default;
@ -43,7 +45,7 @@ public:
void release_lock();
Vector<NonnullRefPtr<ReadIntoRequest>>& read_into_requests() { return m_read_into_requests; }
Vector<JS::NonnullGCPtr<ReadIntoRequest>>& read_into_requests() { return m_read_into_requests; }
private:
explicit ReadableStreamBYOBReader(JS::Realm&);
@ -52,7 +54,7 @@ private:
// https://streams.spec.whatwg.org/#readablestreambyobreader-readintorequests
// A list of read-into requests, used when a consumer requests chunks sooner than they are available
Vector<NonnullRefPtr<ReadIntoRequest>> m_read_into_requests;
Vector<JS::NonnullGCPtr<ReadIntoRequest>> m_read_into_requests;
};
}