forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FetchedDataReceiver.h
37 lines (27 loc) · 987 Bytes
/
FetchedDataReceiver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* Copyright (c) 2024, Tim Flynn <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/ByteBuffer.h>
#include <LibJS/Heap/Cell.h>
#include <LibJS/Heap/CellAllocator.h>
#include <LibWeb/Forward.h>
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<WebIDL::Promise>);
void on_data_received(ReadonlyBytes);
private:
FetchedDataReceiver(JS::NonnullGCPtr<Infrastructure::FetchParams const>, JS::NonnullGCPtr<Streams::ReadableStream>);
virtual void visit_edges(Visitor& visitor) override;
JS::NonnullGCPtr<Infrastructure::FetchParams const> m_fetch_params;
JS::NonnullGCPtr<Streams::ReadableStream> m_stream;
JS::GCPtr<WebIDL::Promise> m_pending_promise;
ByteBuffer m_buffer;
};
}