2019-10-08 19:37:15 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Function.h>
|
|
|
|
#include <AK/URL.h>
|
2019-10-08 19:40:48 +02:00
|
|
|
#include <LibCore/CObject.h>
|
2019-10-08 19:37:15 +02:00
|
|
|
|
2019-11-24 14:24:09 +01:00
|
|
|
namespace LibProtocol {
|
|
|
|
class Client;
|
|
|
|
}
|
|
|
|
|
2019-10-08 19:40:48 +02:00
|
|
|
class ResourceLoader : public CObject {
|
|
|
|
C_OBJECT(ResourceLoader)
|
2019-10-08 19:37:15 +02:00
|
|
|
public:
|
|
|
|
static ResourceLoader& the();
|
|
|
|
|
|
|
|
void load(const URL&, Function<void(const ByteBuffer&)>);
|
|
|
|
|
2019-10-10 22:07:08 +02:00
|
|
|
Function<void()> on_load_counter_change;
|
|
|
|
|
|
|
|
int pending_loads() const { return m_pending_loads; }
|
|
|
|
|
2019-10-08 19:37:15 +02:00
|
|
|
private:
|
2019-11-24 14:24:09 +01:00
|
|
|
ResourceLoader();
|
2019-10-10 22:07:08 +02:00
|
|
|
|
|
|
|
int m_pending_loads { 0 };
|
2019-11-24 14:24:09 +01:00
|
|
|
|
|
|
|
LibProtocol::Client& protocol_client() { return *m_protocol_client; }
|
|
|
|
RefPtr<LibProtocol::Client> m_protocol_client;
|
2019-10-08 19:37:15 +02:00
|
|
|
};
|