1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

ProtocolServer: Implement and handle download progress

Also updates `pro` to display download progress and speed on stderr
This commit is contained in:
AnotherTest 2020-05-03 09:01:06 +04:30 committed by Andreas Kling
parent c6825a96c7
commit 06cf9d3fb7
14 changed files with 97 additions and 22 deletions

View file

@ -44,6 +44,7 @@ public:
virtual ~NetworkJob() override;
Function<void(bool success)> on_finish;
Function<void(Optional<u32>, u32)> on_progress;
bool is_cancelled() const { return m_error == Error::Cancelled; }
bool has_error() const { return m_error != Error::None; }
@ -64,6 +65,7 @@ protected:
NetworkJob();
void did_finish(NonnullRefPtr<NetworkResponse>&&);
void did_fail(Error);
void did_progress(Optional<u32> total_size, u32 downloaded);
private:
RefPtr<NetworkResponse> m_response;