mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03:00
Ladybird: Register SQLServer with the task manager
This commit is contained in:
parent
278fc8e57f
commit
b83babdf8b
Notes:
sideshowbarker
2024-07-16 21:45:42 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/b83babdf8b Pull-request: https://github.com/SerenityOS/serenity/pull/24074 Reviewed-by: https://github.com/ADKaster ✅
@ -187,7 +187,16 @@ ErrorOr<NonnullRefPtr<Protocol::RequestClient>> launch_request_server_process(Re
|
||||
|
||||
ErrorOr<NonnullRefPtr<SQL::SQLClient>> launch_sql_server_process(ReadonlySpan<ByteString> candidate_sql_server_paths)
|
||||
{
|
||||
auto [client, _] = TRY(Core::launch_singleton_process<SQL::SQLClient>("SQLServer"sv, candidate_sql_server_paths));
|
||||
Vector<ByteString> arguments;
|
||||
|
||||
if (auto server = mach_server_name(); server.has_value()) {
|
||||
arguments.append("--mach-server-name"sv);
|
||||
arguments.append(server.value());
|
||||
}
|
||||
|
||||
auto [client, pid] = TRY(Core::launch_singleton_process<SQL::SQLClient>("SQLServer"sv, candidate_sql_server_paths, arguments));
|
||||
WebView::ProcessManager::the().add_process(WebView::ProcessType::SQLServer, pid);
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
|
||||
* Copyright (c) 2022-2024, Tim Flynn <trflynn89@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@ -13,14 +13,20 @@
|
||||
#include <LibMain/Main.h>
|
||||
#include <SQLServer/ConnectionFromClient.h>
|
||||
|
||||
#if defined(AK_OS_MACOS)
|
||||
# include <LibCore/Platform/ProcessStatisticsMach.h>
|
||||
#endif
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
AK::set_rich_debug_enabled(true);
|
||||
|
||||
ByteString pid_file;
|
||||
StringView pid_file;
|
||||
StringView mach_server_name;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(pid_file, "Path to the PID file for the SQLServer singleton process", "pid-file", 'p', "pid_file");
|
||||
args_parser.add_option(mach_server_name, "Mach server name", "mach-server-name", 0, "mach_server_name");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
VERIFY(!pid_file.is_empty());
|
||||
@ -30,6 +36,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
|
||||
Core::EventLoop loop;
|
||||
|
||||
#if defined(AK_OS_MACOS)
|
||||
if (!mach_server_name.is_empty())
|
||||
Core::Platform::register_with_mach_server(mach_server_name);
|
||||
#endif
|
||||
|
||||
auto server = TRY(IPC::MultiServer<SQLServer::ConnectionFromClient>::try_create());
|
||||
u64 connection_count { 0 };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user