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-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:
|
|
|
|
|
ResourceLoader() {}
|
2019-10-10 22:07:08 +02:00
|
|
|
|
|
|
|
|
int m_pending_loads { 0 };
|
2019-10-08 19:37:15 +02:00
|
|
|
};
|