2024-03-25 18:29:14 -06:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
2024-04-04 14:10:08 -06:00
|
|
|
#pragma once
|
|
|
|
|
2024-03-25 18:29:14 -06:00
|
|
|
#include <AK/Types.h>
|
|
|
|
#include <AK/Vector.h>
|
|
|
|
#include <LibCore/EventReceiver.h>
|
2024-04-04 14:10:08 -06:00
|
|
|
#include <LibThreading/Mutex.h>
|
2024-03-25 18:29:14 -06:00
|
|
|
#include <LibWebView/Forward.h>
|
2024-04-03 05:05:20 -06:00
|
|
|
#include <LibWebView/Platform/ProcessStatistics.h>
|
2024-03-25 18:29:14 -06:00
|
|
|
|
|
|
|
namespace WebView {
|
|
|
|
|
|
|
|
ProcessType process_type_from_name(StringView);
|
|
|
|
StringView process_name_from_type(ProcessType type);
|
|
|
|
|
|
|
|
class ProcessManager {
|
|
|
|
public:
|
|
|
|
static ProcessManager& the();
|
|
|
|
static void initialize();
|
|
|
|
|
|
|
|
void add_process(WebView::ProcessType, pid_t);
|
|
|
|
void remove_process(pid_t);
|
|
|
|
|
2024-04-04 14:10:08 -06:00
|
|
|
#if defined(AK_OS_MACH)
|
|
|
|
void add_process(pid_t, Core::MachPort&&);
|
|
|
|
#endif
|
|
|
|
|
2024-03-25 18:29:14 -06:00
|
|
|
void update_all_processes();
|
2024-04-04 14:10:08 -06:00
|
|
|
Vector<ProcessInfo> const& processes() const { return m_statistics.processes; }
|
2024-03-25 18:29:14 -06:00
|
|
|
|
2024-03-26 11:38:12 -06:00
|
|
|
String generate_html();
|
|
|
|
|
2024-03-25 18:29:14 -06:00
|
|
|
private:
|
|
|
|
ProcessManager();
|
|
|
|
~ProcessManager();
|
|
|
|
|
2024-04-03 05:05:20 -06:00
|
|
|
ProcessStatistics m_statistics;
|
2024-04-04 14:10:08 -06:00
|
|
|
Threading::Mutex m_lock;
|
2024-03-25 18:29:14 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|