mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWebView: Defer creating services until after application init
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
In particular, we need to defer creating the process manager until after we have decided whether or not to create a UI-specific event loop. If we create the process manager sooner, its event loop signal registration does not work, and we don't handle child processes exiting.
This commit is contained in:
parent
39da2d9a2f
commit
df0dc32006
Notes:
github-actions[bot]
2025-06-11 12:27:34 +00:00
Author: https://github.com/trflynn89
Commit: df0dc32006
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5061
3 changed files with 29 additions and 28 deletions
|
@ -56,28 +56,6 @@ Application::Application(Optional<ByteString> ladybird_binary_path)
|
|||
VERIFY(!s_the);
|
||||
s_the = this;
|
||||
|
||||
m_settings_observer = make<ApplicationSettingsObserver>();
|
||||
|
||||
// No need to monitor the system time zone if the TZ environment variable is set, as it overrides system preferences.
|
||||
if (!Core::Environment::has("TZ"sv)) {
|
||||
if (auto time_zone_watcher = Core::TimeZoneWatcher::create(); time_zone_watcher.is_error()) {
|
||||
warnln("Unable to monitor system time zone: {}", time_zone_watcher.error());
|
||||
} else {
|
||||
m_time_zone_watcher = time_zone_watcher.release_value();
|
||||
|
||||
m_time_zone_watcher->on_time_zone_changed = []() {
|
||||
WebContentClient::for_each_client([&](WebView::WebContentClient& client) {
|
||||
client.async_system_time_zone_changed();
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
m_process_manager.on_process_exited = [this](Process&& process) {
|
||||
process_did_exit(move(process));
|
||||
};
|
||||
|
||||
platform_init(move(ladybird_binary_path));
|
||||
}
|
||||
|
||||
|
@ -336,6 +314,13 @@ void Application::launch_spare_web_content_process()
|
|||
|
||||
ErrorOr<void> Application::launch_services()
|
||||
{
|
||||
m_settings_observer = make<ApplicationSettingsObserver>();
|
||||
|
||||
m_process_manager = make<ProcessManager>();
|
||||
m_process_manager->on_process_exited = [this](Process&& process) {
|
||||
process_did_exit(move(process));
|
||||
};
|
||||
|
||||
if (m_browser_options.disable_sql_database == DisableSQLDatabase::No) {
|
||||
m_database = Database::create().release_value_but_fixme_should_propagate_errors();
|
||||
m_cookie_jar = CookieJar::create(*m_database).release_value_but_fixme_should_propagate_errors();
|
||||
|
@ -343,6 +328,22 @@ ErrorOr<void> Application::launch_services()
|
|||
m_cookie_jar = CookieJar::create();
|
||||
}
|
||||
|
||||
// No need to monitor the system time zone if the TZ environment variable is set, as it overrides system preferences.
|
||||
if (!Core::Environment::has("TZ"sv)) {
|
||||
if (auto time_zone_watcher = Core::TimeZoneWatcher::create(); time_zone_watcher.is_error()) {
|
||||
warnln("Unable to monitor system time zone: {}", time_zone_watcher.error());
|
||||
} else {
|
||||
m_time_zone_watcher = time_zone_watcher.release_value();
|
||||
|
||||
m_time_zone_watcher->on_time_zone_changed = []() {
|
||||
WebContentClient::for_each_client([&](WebView::WebContentClient& client) {
|
||||
client.async_system_time_zone_changed();
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
TRY(launch_request_server());
|
||||
TRY(launch_image_decoder_server());
|
||||
return {};
|
||||
|
@ -476,19 +477,19 @@ NonnullOwnPtr<Core::EventLoop> Application::create_platform_event_loop()
|
|||
|
||||
void Application::add_child_process(WebView::Process&& process)
|
||||
{
|
||||
m_process_manager.add_process(move(process));
|
||||
m_process_manager->add_process(move(process));
|
||||
}
|
||||
|
||||
#if defined(AK_OS_MACH)
|
||||
void Application::set_process_mach_port(pid_t pid, Core::MachPort&& port)
|
||||
{
|
||||
m_process_manager.set_process_mach_port(pid, move(port));
|
||||
m_process_manager->set_process_mach_port(pid, move(port));
|
||||
}
|
||||
#endif
|
||||
|
||||
Optional<Process&> Application::find_process(pid_t pid)
|
||||
{
|
||||
return m_process_manager.find_process(pid);
|
||||
return m_process_manager->find_process(pid);
|
||||
}
|
||||
|
||||
void Application::process_did_exit(Process&& process)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue