ResourceLoader.h 602 B

1234567891011121314151617181920212223242526272829
  1. #pragma once
  2. #include <AK/Function.h>
  3. #include <AK/URL.h>
  4. #include <LibCore/CObject.h>
  5. namespace LibProtocol {
  6. class Client;
  7. }
  8. class ResourceLoader : public CObject {
  9. C_OBJECT(ResourceLoader)
  10. public:
  11. static ResourceLoader& the();
  12. void load(const URL&, Function<void(const ByteBuffer&)>);
  13. Function<void()> on_load_counter_change;
  14. int pending_loads() const { return m_pending_loads; }
  15. private:
  16. ResourceLoader();
  17. int m_pending_loads { 0 };
  18. LibProtocol::Client& protocol_client() { return *m_protocol_client; }
  19. RefPtr<LibProtocol::Client> m_protocol_client;
  20. };