summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibProtocol/RequestClient.cpp
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-05-02 19:54:34 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-03 21:14:06 +0200
commit065040872f62f608374da6709502033720442882 (patch)
treec9e974c1d32837df87ad334515a1535113fdc756 /Userland/Libraries/LibProtocol/RequestClient.cpp
parentd47f15ab8b8ff545864fed2a0e275674c1431549 (diff)
downloadserenity-065040872f62f608374da6709502033720442882.zip
Userland: Change IPC funcs to use plain arguments instead of a struct
Instead of having a single overloaded handle method each method gets its own unique method name now.
Diffstat (limited to 'Userland/Libraries/LibProtocol/RequestClient.cpp')
-rw-r--r--Userland/Libraries/LibProtocol/RequestClient.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/Userland/Libraries/LibProtocol/RequestClient.cpp b/Userland/Libraries/LibProtocol/RequestClient.cpp
index 16e5f0e300..0fb195c243 100644
--- a/Userland/Libraries/LibProtocol/RequestClient.cpp
+++ b/Userland/Libraries/LibProtocol/RequestClient.cpp
@@ -58,34 +58,34 @@ bool RequestClient::set_certificate(Badge<Request>, Request& request, String cer
return send_sync<Messages::RequestServer::SetCertificate>(request.id(), move(certificate), move(key))->success();
}
-void RequestClient::handle(const Messages::RequestClient::RequestFinished& message)
+void RequestClient::request_finished(i32 request_id, bool success, u32 total_size)
{
RefPtr<Request> request;
- if ((request = m_requests.get(message.request_id()).value_or(nullptr))) {
- request->did_finish({}, message.success(), message.total_size());
+ if ((request = m_requests.get(request_id).value_or(nullptr))) {
+ request->did_finish({}, success, total_size);
}
- m_requests.remove(message.request_id());
+ m_requests.remove(request_id);
}
-void RequestClient::handle(const Messages::RequestClient::RequestProgress& message)
+void RequestClient::request_progress(i32 request_id, const Optional<u32>& total_size, u32 downloaded_size)
{
- if (auto request = const_cast<Request*>(m_requests.get(message.request_id()).value_or(nullptr))) {
- request->did_progress({}, message.total_size(), message.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::handle(const Messages::RequestClient::HeadersBecameAvailable& message)
+void RequestClient::headers_became_available(i32 request_id, const IPC::Dictionary& response_headers, const Optional<u32>& status_code)
{
- if (auto request = const_cast<Request*>(m_requests.get(message.request_id()).value_or(nullptr))) {
+ if (auto request = const_cast<Request*>(m_requests.get(request_id).value_or(nullptr))) {
HashMap<String, String, CaseInsensitiveStringTraits> headers;
- message.response_headers().for_each_entry([&](auto& name, auto& value) { headers.set(name, value); });
- request->did_receive_headers({}, headers, message.status_code());
+ response_headers.for_each_entry([&](auto& name, auto& value) { headers.set(name, value); });
+ request->did_receive_headers({}, headers, status_code);
}
}
-void RequestClient::handle(const Messages::RequestClient::CertificateRequested& message)
+void RequestClient::certificate_requested(i32 request_id)
{
- if (auto request = const_cast<Request*>(m_requests.get(message.request_id()).value_or(nullptr))) {
+ if (auto request = const_cast<Request*>(m_requests.get(request_id).value_or(nullptr))) {
request->did_request_certificates({});
}
}