forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtarget_agent.h
More file actions
59 lines (47 loc) · 1.9 KB
/
Copy pathtarget_agent.h
File metadata and controls
59 lines (47 loc) · 1.9 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef SRC_INSPECTOR_TARGET_AGENT_H_
#define SRC_INSPECTOR_TARGET_AGENT_H_
#include <memory>
#include <string_view>
#include "inspector/target_manager.h"
#include "inspector/worker_inspector.h"
#include "node/inspector/protocol/Target.h"
namespace node {
namespace inspector {
class TargetInspector;
namespace protocol {
class TargetAgent : public Target::Backend,
public std::enable_shared_from_this<TargetAgent> {
public:
void Wire(UberDispatcher* dispatcher);
void createAndAttachIfNecessary(std::shared_ptr<MainThreadHandle> worker,
const std::string& title,
const std::string& url);
DispatchResponse getTargets(
std::unique_ptr<protocol::Array<Target::TargetInfo>>* out_targetInfos)
override;
DispatchResponse setAutoAttach(bool auto_attach,
bool wait_for_debugger_on_start) override;
void listenWorker(std::weak_ptr<WorkerManager> worker_manager);
void reset();
private:
int getNextTargetId();
int getNextSessionId();
void targetCreated(const std::string_view target_id,
const std::string_view type,
const std::string_view title,
const std::string_view url);
void attachedToTarget(std::shared_ptr<MainThreadHandle> worker,
const std::string& target_id,
const std::string& type,
const std::string& title,
const std::string& url);
std::shared_ptr<Target::Frontend> frontend_;
std::weak_ptr<WorkerManager> worker_manager_;
std::unique_ptr<WorkerManagerEventHandle> worker_event_handle_ = nullptr;
std::unique_ptr<TargetManager> target_manager_ =
std::make_unique<TargetManager>();
};
} // namespace protocol
} // namespace inspector
} // namespace node
#endif // SRC_INSPECTOR_TARGET_AGENT_H_