LibWebView+WebContent: Notify UI process about WebContent PID explicitly

On Serenity, it's not trivial to extract the peer pid from a socket that
is created by SystemServer and then passed to a forked service process.
This patch adds an API to let the WebContent process notify the UI
directly, which makes the WebContent process show up in the Serenity
port's TaskManagerWidget. It seems that we will need to do something of
this sort in order to properly gather metrics on macOS as well, due to
the way that self mach ports work.
This commit is contained in:
Andrew Kaster 2024-03-27 11:53:07 -06:00 committed by Andrew Kaster
parent a6220501ab
commit fa8b64d59a
Notes: sideshowbarker 2024-07-17 23:00:03 +09:00
10 changed files with 63 additions and 2 deletions

View file

@ -5,6 +5,7 @@
*/
#include "WebContentClient.h"
#include "ProcessManager.h"
#include "ViewImplementation.h"
#include <LibWeb/Cookie/ParsedCookie.h>
@ -33,6 +34,12 @@ void WebContentClient::unregister_view(u64 page_id)
m_views.remove(page_id);
}
void WebContentClient::notify_process_information(WebView::ProcessHandle const& handle)
{
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::NotifyProcessInformation! pid={}", handle.pid);
ProcessManager::the().add_process(ProcessType::WebContent, handle.pid);
}
void WebContentClient::did_paint(u64 page_id, Gfx::IntRect const& rect, i32 bitmap_id)
{
if (auto view = view_for_page_id(page_id); view.has_value())