LibIPC: Remove socket path from IPC Client connections

We don't need these for Ladybird, and they are the only users of
some LibCore functions we can remove as well.
This commit is contained in:
Andrew Kaster 2024-11-21 12:46:45 -07:00 committed by Andreas Kling
parent 310cdc35f0
commit 1549d393b9
Notes: github-actions[bot] 2024-11-26 10:01:57 +00:00
5 changed files with 4 additions and 18 deletions

View file

@ -11,20 +11,6 @@
namespace IPC {
#define IPC_CLIENT_CONNECTION(klass, socket_path) \
C_OBJECT_ABSTRACT(klass) \
public: \
template<typename Klass = klass, class... Args> \
static ErrorOr<NonnullRefPtr<klass>> try_create(Args&&... args) \
{ \
auto parsed_socket_path = TRY(Core::SessionManagement::parse_path_with_sid(socket_path)); \
auto socket = TRY(Core::LocalSocket::connect(move(parsed_socket_path))); \
/* We want to rate-limit our clients */ \
TRY(socket->set_blocking(true)); \
\
return adopt_nonnull_ref_or_enomem(new (nothrow) Klass(IPC::Transport(move(socket)), forward<Args>(args)...)); \
}
template<typename ClientEndpoint, typename ServerEndpoint>
class ConnectionToServer : public IPC::Connection<ClientEndpoint, ServerEndpoint>
, public ClientEndpoint::Stub

View file

@ -29,7 +29,7 @@ struct DecodedImage {
class Client final
: public IPC::ConnectionToServer<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint>
, public ImageDecoderClientEndpoint {
IPC_CLIENT_CONNECTION(Client, "/tmp/session/%sid/portal/image"sv);
C_OBJECT_ABSTRACT(Client);
public:
Client(IPC::Transport);

View file

@ -21,7 +21,7 @@ class Request;
class RequestClient final
: public IPC::ConnectionToServer<RequestClientEndpoint, RequestServerEndpoint>
, public RequestClientEndpoint {
IPC_CLIENT_CONNECTION(RequestClient, "/tmp/session/%sid/portal/request"sv)
C_OBJECT_ABSTRACT(RequestClient)
public:
explicit RequestClient(IPC::Transport);

View file

@ -16,7 +16,7 @@ namespace Web::HTML {
class WebWorkerClient final
: public IPC::ConnectionToServer<WebWorkerClientEndpoint, WebWorkerServerEndpoint>
, public WebWorkerClientEndpoint {
IPC_CLIENT_CONNECTION(WebWorkerClient, "/tmp/session/%sid/portal/webworker"sv);
C_OBJECT_ABSTRACT(WebWorkerClient);
public:
explicit WebWorkerClient(IPC::Transport);

View file

@ -26,7 +26,7 @@ class ViewImplementation;
class WebContentClient final
: public IPC::ConnectionToServer<WebContentClientEndpoint, WebContentServerEndpoint>
, public WebContentClientEndpoint {
IPC_CLIENT_CONNECTION(WebContentClient, "/tmp/session/%sid/portal/webcontent"sv);
C_OBJECT_ABSTRACT(WebContentClient);
public:
static Optional<ViewImplementation&> view_for_pid_and_page_id(pid_t pid, u64 page_id);