From eb21aa65d131f6fb382ad80d672e5a7ffb1a21e1 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 3 May 2021 13:55:29 +0200 Subject: Userland: Make IPC results with one return value available directly This changes client methods so that they return the IPC response's return value directly - instead of the response struct - for IPC methods which only have a single return value. --- Userland/Libraries/LibProtocol/RequestClient.cpp | 9 ++------- Userland/Libraries/LibProtocol/RequestClient.h | 1 - Userland/Libraries/LibProtocol/WebSocketClient.cpp | 7 +++---- 3 files changed, 5 insertions(+), 12 deletions(-) (limited to 'Userland/Libraries/LibProtocol') diff --git a/Userland/Libraries/LibProtocol/RequestClient.cpp b/Userland/Libraries/LibProtocol/RequestClient.cpp index 8c25c1ea27..cbf3d6cc36 100644 --- a/Userland/Libraries/LibProtocol/RequestClient.cpp +++ b/Userland/Libraries/LibProtocol/RequestClient.cpp @@ -21,11 +21,6 @@ void RequestClient::handshake() greet(); } -bool RequestClient::is_supported_protocol(const String& protocol) -{ - return IPCProxy::is_supported_protocol(protocol).supported(); -} - template RefPtr RequestClient::start_request(const String& method, const String& url, const HashMap& request_headers, ReadonlyBytes request_body) { @@ -49,14 +44,14 @@ bool RequestClient::stop_request(Badge, Request& request) { if (!m_requests.contains(request.id())) return false; - return IPCProxy::stop_request(request.id()).success(); + return IPCProxy::stop_request(request.id()); } bool RequestClient::set_certificate(Badge, Request& request, String certificate, String key) { if (!m_requests.contains(request.id())) return false; - return IPCProxy::set_certificate(request.id(), move(certificate), move(key)).success(); + return IPCProxy::set_certificate(request.id(), move(certificate), move(key)); } void RequestClient::request_finished(i32 request_id, bool success, u32 total_size) diff --git a/Userland/Libraries/LibProtocol/RequestClient.h b/Userland/Libraries/LibProtocol/RequestClient.h index 1dfe45bf7f..a07a5d0f6b 100644 --- a/Userland/Libraries/LibProtocol/RequestClient.h +++ b/Userland/Libraries/LibProtocol/RequestClient.h @@ -23,7 +23,6 @@ class RequestClient public: virtual void handshake() override; - bool is_supported_protocol(const String&); template> RefPtr start_request(const String& method, const String& url, const HashMap& request_headers = {}, ReadonlyBytes request_body = {}); diff --git a/Userland/Libraries/LibProtocol/WebSocketClient.cpp b/Userland/Libraries/LibProtocol/WebSocketClient.cpp index e8607d7e2b..4b07f2198d 100644 --- a/Userland/Libraries/LibProtocol/WebSocketClient.cpp +++ b/Userland/Libraries/LibProtocol/WebSocketClient.cpp @@ -25,8 +25,7 @@ RefPtr WebSocketClient::connect(const URL& url, const String& origin, IPC::Dictionary header_dictionary; for (auto& it : request_headers) header_dictionary.add(it.key, it.value); - auto response = IPCProxy::connect(url, origin, protocols, extensions, header_dictionary); - auto connection_id = response.connection_id(); + auto connection_id = IPCProxy::connect(url, origin, protocols, extensions, header_dictionary); if (connection_id < 0) return nullptr; auto connection = WebSocket::create_from_id({}, *this, connection_id); @@ -38,7 +37,7 @@ u32 WebSocketClient::ready_state(Badge, WebSocket& connection) { if (!m_connections.contains(connection.id())) return (u32)WebSocket::ReadyState::Closed; - return IPCProxy::ready_state(connection.id()).ready_state(); + return IPCProxy::ready_state(connection.id()); } void WebSocketClient::send(Badge, WebSocket& connection, ByteBuffer data, bool is_text) @@ -59,7 +58,7 @@ bool WebSocketClient::set_certificate(Badge, WebSocket& connection, S { if (!m_connections.contains(connection.id())) return false; - return IPCProxy::set_certificate(connection.id(), move(certificate), move(key)).success(); + return IPCProxy::set_certificate(connection.id(), move(certificate), move(key)); } void WebSocketClient::connected(i32 connection_id) -- cgit v1.2.3