mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-29 14:32:55 +00:00
This large commit also refactors LibWebView's process handling to use a top-level Application class that uses a new WebView::Process class to encapsulate the IPC-centric nature of each helper process.
51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibCore/EventLoop.h>
|
|
#include <LibWebView/Process.h>
|
|
#include <LibWebView/ProcessManager.h>
|
|
|
|
namespace WebView {
|
|
|
|
class Application {
|
|
AK_MAKE_NONCOPYABLE(Application);
|
|
|
|
public:
|
|
Application(int argc, char** argv);
|
|
virtual ~Application();
|
|
|
|
int exec();
|
|
|
|
static Application& the() { return *s_the; }
|
|
|
|
Core::EventLoop& event_loop() { return m_event_loop; }
|
|
|
|
void add_child_process(Process&&);
|
|
|
|
// FIXME: Should these methods be part of Application, instead of deferring to ProcessManager?
|
|
#if defined(AK_OS_MACH)
|
|
void set_process_mach_port(pid_t, Core::MachPort&&);
|
|
#endif
|
|
Optional<Process&> find_process(pid_t);
|
|
|
|
// FIXME: Should we just expose the ProcessManager via a getter?
|
|
void update_process_statistics();
|
|
String generate_process_statistics_html();
|
|
|
|
protected:
|
|
virtual void process_did_exit(Process&&);
|
|
|
|
private:
|
|
static Application* s_the;
|
|
|
|
Core::EventLoop m_event_loop;
|
|
ProcessManager m_process_manager;
|
|
bool m_in_shutdown { false };
|
|
};
|
|
|
|
}
|