From 1dad47c0f9fde14f9cdd421cc257a520fa658cb0 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 30 Jan 2021 23:43:18 +0100 Subject: [PATCH] WebContent: Set the main thread name based on the current page host We now show up as "WebContent: www.serenityos.org" in System Monitor, which is just super neat. :^) --- Userland/Services/WebContent/ClientConnection.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Userland/Services/WebContent/ClientConnection.cpp b/Userland/Services/WebContent/ClientConnection.cpp index 08af4b921e6..01af0de4ece 100644 --- a/Userland/Services/WebContent/ClientConnection.cpp +++ b/Userland/Services/WebContent/ClientConnection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Andreas Kling + * Copyright (c) 2020-2021, Andreas Kling * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,6 +31,7 @@ #include #include #include +#include namespace WebContent { @@ -81,6 +82,15 @@ void ClientConnection::handle(const Messages::WebContentServer::UpdateSystemThem void ClientConnection::handle(const Messages::WebContentServer::LoadURL& message) { dbgln("handle: WebContentServer::LoadURL: url={}", message.url()); + + String process_name; + if (message.url().host().is_empty()) + process_name = "WebContent"; + else + process_name = String::formatted("WebContent: {}", message.url().host()); + + pthread_setname_np(pthread_self(), process_name.characters()); + page().load(message.url()); }