/* * Copyright (c) 2024, Tim Flynn * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Web::Fetch::Fetching { class FetchedDataReceiver final : public JS::Cell { JS_CELL(FetchedDataReceiver, JS::Cell); JS_DECLARE_ALLOCATOR(FetchedDataReceiver); public: virtual ~FetchedDataReceiver() override; void set_pending_promise(JS::NonnullGCPtr); void on_data_received(ReadonlyBytes); private: FetchedDataReceiver(JS::NonnullGCPtr, JS::NonnullGCPtr); virtual void visit_edges(Visitor& visitor) override; JS::NonnullGCPtr m_fetch_params; JS::NonnullGCPtr m_stream; JS::GCPtr m_pending_promise; ByteBuffer m_buffer; }; }