Skip to content

Commit

Permalink
RequestServer: Remove download progress updates that nobody used
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Sep 19, 2024
1 parent f0fc516 commit 853a75c
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 29 deletions.
7 changes: 0 additions & 7 deletions Userland/Libraries/LibRequests/Request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ bool Request::stop()
{
on_headers_received = nullptr;
on_finish = nullptr;
on_progress = nullptr;
on_certificate_requested = nullptr;

m_internal_buffered_data = nullptr;
Expand Down Expand Up @@ -88,12 +87,6 @@ void Request::did_finish(Badge<RequestClient>, bool success, u64 total_size)
on_finish(success, total_size);
}

void Request::did_progress(Badge<RequestClient>, Optional<u64> total_size, u64 downloaded_size)
{
if (on_progress)
on_progress(total_size, downloaded_size);
}

void Request::did_receive_headers(Badge<RequestClient>, HTTP::HeaderMap const& response_headers, Optional<u32> response_code)
{
if (on_headers_received)
Expand Down
2 changes: 0 additions & 2 deletions Userland/Libraries/LibRequests/Request.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ class Request : public RefCounted<Request> {
// mutually exclusive with `set_buffered_request_finished_callback`.
void set_unbuffered_request_callbacks(HeadersReceived, DataReceived, RequestFinished);

Function<void(Optional<u64> total_size, u64 downloaded_size)> on_progress;
Function<CertificateAndKey()> on_certificate_requested;

void did_finish(Badge<RequestClient>, bool success, u64 total_size);
void did_progress(Badge<RequestClient>, Optional<u64> total_size, u64 downloaded_size);
void did_receive_headers(Badge<RequestClient>, HTTP::HeaderMap const& response_headers, Optional<u32> response_code);
void did_request_certificates(Badge<RequestClient>);

Expand Down
7 changes: 0 additions & 7 deletions Userland/Libraries/LibRequests/RequestClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ void RequestClient::request_finished(i32 request_id, bool success, u64 total_siz
m_requests.remove(request_id);
}

void RequestClient::request_progress(i32 request_id, Optional<u64> const& total_size, u64 downloaded_size)
{
if (auto request = const_cast<Request*>(m_requests.get(request_id).value_or(nullptr))) {
request->did_progress({}, total_size, downloaded_size);
}
}

void RequestClient::headers_became_available(i32 request_id, HTTP::HeaderMap const& response_headers, Optional<u32> const& status_code)
{
auto request = const_cast<Request*>(m_requests.get(request_id).value_or(nullptr));
Expand Down
1 change: 0 additions & 1 deletion Userland/Libraries/LibRequests/RequestClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class RequestClient final
virtual void die() override;

virtual void request_started(i32, IPC::File const&) override;
virtual void request_progress(i32, Optional<u64> const&, u64) override;
virtual void request_finished(i32, bool, u64) override;
virtual void certificate_requested(i32) override;
virtual void headers_became_available(i32, HTTP::HeaderMap const&, Optional<u32> const&) override;
Expand Down
6 changes: 0 additions & 6 deletions Userland/Libraries/LibWebView/RequestServerAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ ErrorOr<NonnullRefPtr<RequestServerRequestAdapter>> RequestServerRequestAdapter:
RequestServerRequestAdapter::RequestServerRequestAdapter(NonnullRefPtr<Requests::Request> request)
: m_request(request)
{
request->on_progress = [weak_this = make_weak_ptr()](Optional<u64> total_size, u64 downloaded_size) {
if (auto strong_this = weak_this.strong_ref())
if (strong_this->on_progress)
strong_this->on_progress(total_size, downloaded_size);
};

request->on_certificate_requested = [weak_this = make_weak_ptr()]() {
if (auto strong_this = weak_this.strong_ref()) {
if (strong_this->on_certificate_requested) {
Expand Down
5 changes: 0 additions & 5 deletions Userland/Services/RequestServer/ConnectionFromClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ size_t ConnectionFromClient::on_data_received(void* buffer, size_t size, size_t

request->downloaded_so_far += total_size;

request->client->async_request_progress(
request->request_id,
content_length_for_ipc,
request->downloaded_so_far);

return total_size;
}

Expand Down
1 change: 0 additions & 1 deletion Userland/Services/RequestServer/RequestClient.ipc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
endpoint RequestClient
{
request_started(i32 request_id, IPC::File fd) =|
request_progress(i32 request_id, Optional<u64> total_size, u64 downloaded_size) =|
request_finished(i32 request_id, bool success, u64 total_size) =|
headers_became_available(i32 request_id, HTTP::HeaderMap response_headers, Optional<u32> status_code) =|

Expand Down

0 comments on commit 853a75c

Please sign in to comment.