1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:47:44 +00:00

WebContent: Remove unnecessary client map

WebContent processes only serve a single client, so we don't need to
keep a map of them.
This commit is contained in:
Andreas Kling 2021-11-29 17:29:23 +01:00
parent 314a687eeb
commit 6cb3092b42
3 changed files with 5 additions and 10 deletions

View file

@ -29,13 +29,10 @@
namespace WebContent { namespace WebContent {
static HashMap<int, RefPtr<ClientConnection>> s_connections; ClientConnection::ClientConnection(NonnullRefPtr<Core::LocalSocket> socket)
: IPC::ClientConnection<WebContentClientEndpoint, WebContentServerEndpoint>(*this, move(socket), 1)
ClientConnection::ClientConnection(NonnullRefPtr<Core::LocalSocket> socket, int client_id)
: IPC::ClientConnection<WebContentClientEndpoint, WebContentServerEndpoint>(*this, move(socket), client_id)
, m_page_host(PageHost::create(*this)) , m_page_host(PageHost::create(*this))
{ {
s_connections.set(client_id, *this);
m_paint_flush_timer = Core::Timer::create_single_shot(0, [this] { flush_pending_paint_requests(); }); m_paint_flush_timer = Core::Timer::create_single_shot(0, [this] { flush_pending_paint_requests(); });
} }
@ -45,9 +42,7 @@ ClientConnection::~ClientConnection()
void ClientConnection::die() void ClientConnection::die()
{ {
s_connections.remove(client_id()); Core::EventLoop::current().quit(0);
if (s_connections.is_empty())
Core::EventLoop::current().quit(0);
} }
Web::Page& ClientConnection::page() Web::Page& ClientConnection::page()

View file

@ -32,7 +32,7 @@ public:
void initialize_js_console(Badge<PageHost>); void initialize_js_console(Badge<PageHost>);
private: private:
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id); explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>);
Web::Page& page(); Web::Page& page();
const Web::Page& page() const; const Web::Page& page() const;

View file

@ -22,6 +22,6 @@ 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<WebContent::ClientConnection>(move(socket), 1); auto client = IPC::new_client_connection<WebContent::ClientConnection>(move(socket));
return event_loop.exec(); return event_loop.exec();
} }