mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
WebContent: Turn it into a MultiInstance service :^)
Port the WebContent service to the new MultiInstance mechanism that Sergey added. This means that every new WebContentView gets its very own segregated WebContent process.
This commit is contained in:
parent
ed351c7493
commit
59537cf257
Notes:
sideshowbarker
2024-07-19 05:28:02 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/59537cf257c
5 changed files with 10 additions and 17 deletions
|
@ -13,6 +13,8 @@ SocketPermissions=660
|
|||
Lazy=1
|
||||
User=webcontent
|
||||
BootModes=graphical
|
||||
MultiInstance=1
|
||||
AcceptSocketConnections=1
|
||||
|
||||
[LookupServer]
|
||||
Socket=/tmp/portal/lookup
|
||||
|
|
|
@ -37,8 +37,9 @@ WebContentClient::WebContentClient(WebContentView& view)
|
|||
|
||||
void WebContentClient::handshake()
|
||||
{
|
||||
auto response = send_sync<Messages::WebContentServer::Greet>();
|
||||
auto response = send_sync<Messages::WebContentServer::Greet>(getpid());
|
||||
set_my_client_id(response->client_id());
|
||||
set_server_pid(response->server_pid());
|
||||
}
|
||||
|
||||
void WebContentClient::handle(const Messages::WebContentClient::DidPaint& message)
|
||||
|
|
|
@ -62,9 +62,10 @@ const Web::Page& ClientConnection::page() const
|
|||
return m_page_host->page();
|
||||
}
|
||||
|
||||
OwnPtr<Messages::WebContentServer::GreetResponse> ClientConnection::handle(const Messages::WebContentServer::Greet&)
|
||||
OwnPtr<Messages::WebContentServer::GreetResponse> ClientConnection::handle(const Messages::WebContentServer::Greet& message)
|
||||
{
|
||||
return make<Messages::WebContentServer::GreetResponse>(client_id());
|
||||
set_client_pid(message.client_pid());
|
||||
return make<Messages::WebContentServer::GreetResponse>(client_id(), getpid());
|
||||
}
|
||||
|
||||
void ClientConnection::handle(const Messages::WebContentServer::UpdateSystemTheme& message)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
endpoint WebContentServer = 89
|
||||
{
|
||||
Greet() => (i32 client_id)
|
||||
Greet(i32 client_pid) => (i32 client_id, i32 server_pid)
|
||||
|
||||
UpdateSystemTheme(i32 shbuf_id) =|
|
||||
|
||||
|
|
|
@ -49,18 +49,7 @@ int main(int, char**)
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto server = Core::LocalServer::construct();
|
||||
bool ok = server->take_over_from_system_server();
|
||||
ASSERT(ok);
|
||||
server->on_ready_to_accept = [&] {
|
||||
auto client_socket = server->accept();
|
||||
if (!client_socket) {
|
||||
dbg() << "WebContent: accept failed.";
|
||||
return;
|
||||
}
|
||||
static int s_next_client_id = 0;
|
||||
int client_id = ++s_next_client_id;
|
||||
IPC::new_client_connection<WebContent::ClientConnection>(*client_socket, client_id);
|
||||
};
|
||||
auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server();
|
||||
IPC::new_client_connection<WebContent::ClientConnection>(*socket, 1);
|
||||
return event_loop.exec();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue