mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:07:35 +00:00
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. :^)
This commit is contained in:
parent
4d777a9bf4
commit
1dad47c0f9
1 changed files with 11 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -31,6 +31,7 @@
|
||||||
#include <WebContent/ClientConnection.h>
|
#include <WebContent/ClientConnection.h>
|
||||||
#include <WebContent/PageHost.h>
|
#include <WebContent/PageHost.h>
|
||||||
#include <WebContent/WebContentClientEndpoint.h>
|
#include <WebContent/WebContentClientEndpoint.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
namespace WebContent {
|
namespace WebContent {
|
||||||
|
|
||||||
|
@ -81,6 +82,15 @@ void ClientConnection::handle(const Messages::WebContentServer::UpdateSystemThem
|
||||||
void ClientConnection::handle(const Messages::WebContentServer::LoadURL& message)
|
void ClientConnection::handle(const Messages::WebContentServer::LoadURL& message)
|
||||||
{
|
{
|
||||||
dbgln<SPAM_DEBUG>("handle: WebContentServer::LoadURL: url={}", message.url());
|
dbgln<SPAM_DEBUG>("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());
|
page().load(message.url());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue