Exit WebContent immediately when either browser-side IPC peer disconnects. Plumb Unix process exit status through LibWebView so the browser process can tell clean owner-driven shutdown apart from renderer crashes. This keeps nonzero exits and signal deaths reported as crashes, while letting status 0 exits disappear without making test-web report the page as crashed.
27 lines
546 B
C++
27 lines
546 B
C++
/*
|
|
* Copyright (c) 2025, ayeteadoe <ayeteadoe@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Function.h>
|
|
#include <AK/HashTable.h>
|
|
|
|
namespace WebView {
|
|
|
|
class ProcessMonitor {
|
|
public:
|
|
ProcessMonitor(Function<void(pid_t, Optional<int> exit_status)> exit_handler);
|
|
~ProcessMonitor();
|
|
|
|
void add_process(pid_t pid);
|
|
|
|
private:
|
|
Function<void(pid_t, Optional<int> exit_status)> m_on_process_exit;
|
|
HashTable<pid_t> m_monitored_processes;
|
|
[[maybe_unused]] int m_signal_handle { -1 };
|
|
};
|
|
|
|
}
|