Serenity Operating System
1/*
2 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#pragma once
8
9#include "InspectorServerClient.h"
10
11namespace Inspector {
12
13class RemoteObjectGraphModel;
14class RemoteObject;
15
16class RemoteProcess {
17public:
18 static RemoteProcess& the();
19
20 explicit RemoteProcess(pid_t);
21 void update();
22
23 pid_t pid() const { return m_pid; }
24 DeprecatedString const& process_name() const { return m_process_name; }
25
26 RemoteObjectGraphModel& object_graph_model() { return *m_object_graph_model; }
27 Vector<NonnullOwnPtr<RemoteObject>> const& roots() const { return m_roots; }
28
29 void set_inspected_object(FlatPtr);
30
31 void set_property(FlatPtr object, StringView name, JsonValue const& value);
32
33 bool is_inspectable();
34
35 Function<void()> on_update;
36
37private:
38 void handle_get_all_objects_response(JsonObject const&);
39 void handle_identify_response(JsonObject const&);
40
41 pid_t m_pid { -1 };
42 DeprecatedString m_process_name;
43 NonnullRefPtr<RemoteObjectGraphModel> m_object_graph_model;
44 Vector<NonnullOwnPtr<RemoteObject>> m_roots;
45 RefPtr<InspectorServerClient> m_client;
46};
47
48}