summaryrefslogtreecommitdiff
path: root/Userland/Services/InspectorServer/InspectableProcess.h
blob: 1945e32c5ca5b862f62981350d6f98396fc779a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibCore/Stream.h>

namespace InspectorServer {

class InspectableProcess {
public:
    InspectableProcess(pid_t, NonnullOwnPtr<Core::Stream::LocalSocket>);
    ~InspectableProcess() = default;

    void send_request(JsonObject const& request);
    DeprecatedString wait_for_response();

    static InspectableProcess* from_pid(pid_t);

private:
    pid_t m_pid { 0 };
    NonnullOwnPtr<Core::Stream::LocalSocket> m_socket;
};

extern HashMap<pid_t, NonnullOwnPtr<InspectorServer::InspectableProcess>> g_processes;

}