mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:47:34 +00:00
ImageDecoder: Remove unnecessary client map
ImageDecoder processes only serve a single client, so we don't need to keep a map of them.
This commit is contained in:
parent
8c8bf9433f
commit
314a687eeb
3 changed files with 5 additions and 9 deletions
|
@ -12,12 +12,9 @@
|
||||||
|
|
||||||
namespace ImageDecoder {
|
namespace ImageDecoder {
|
||||||
|
|
||||||
static HashMap<int, RefPtr<ClientConnection>> s_connections;
|
ClientConnection::ClientConnection(NonnullRefPtr<Core::LocalSocket> socket)
|
||||||
|
: IPC::ClientConnection<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint>(*this, move(socket), 1)
|
||||||
ClientConnection::ClientConnection(NonnullRefPtr<Core::LocalSocket> socket, int client_id)
|
|
||||||
: IPC::ClientConnection<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint>(*this, move(socket), client_id)
|
|
||||||
{
|
{
|
||||||
s_connections.set(client_id, *this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientConnection::~ClientConnection()
|
ClientConnection::~ClientConnection()
|
||||||
|
@ -26,8 +23,7 @@ ClientConnection::~ClientConnection()
|
||||||
|
|
||||||
void ClientConnection::die()
|
void ClientConnection::die()
|
||||||
{
|
{
|
||||||
s_connections.remove(client_id());
|
Core::EventLoop::current().quit(0);
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Messages::ImageDecoderServer::DecodeImageResponse ClientConnection::decode_image(Core::AnonymousBuffer const& encoded_buffer)
|
Messages::ImageDecoderServer::DecodeImageResponse ClientConnection::decode_image(Core::AnonymousBuffer const& encoded_buffer)
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
virtual void die() override;
|
virtual void die() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>);
|
||||||
|
|
||||||
virtual Messages::ImageDecoderServer::DecodeImageResponse decode_image(Core::AnonymousBuffer const&) override;
|
virtual Messages::ImageDecoderServer::DecodeImageResponse decode_image(Core::AnonymousBuffer const&) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
||||||
TRY(Core::System::unveil(nullptr, nullptr));
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
|
|
||||||
auto socket = TRY(Core::LocalSocket::take_over_accepted_socket_from_system_server());
|
auto socket = TRY(Core::LocalSocket::take_over_accepted_socket_from_system_server());
|
||||||
IPC::new_client_connection<ImageDecoder::ClientConnection>(move(socket), 1);
|
auto client = IPC::new_client_connection<ImageDecoder::ClientConnection>(move(socket));
|
||||||
TRY(Core::System::pledge("stdio recvfd sendfd"));
|
TRY(Core::System::pledge("stdio recvfd sendfd"));
|
||||||
return event_loop.exec();
|
return event_loop.exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue