@@ -14,18 +14,20 @@ class WorkerStartedRequest : public Request {
14
14
uint64_t id,
15
15
const std::string& url,
16
16
std::shared_ptr<node::inspector::MainThreadHandle> worker_thread,
17
- bool waiting)
17
+ bool waiting,
18
+ const std::string& title_prefix)
18
19
: id_(id),
19
- info_ (BuildWorkerTitle(id), url, worker_thread),
20
+ info_ (BuildWorkerTitle(id, title_prefix ), url, worker_thread),
20
21
waiting_(waiting) {}
21
22
void Call (MainThreadInterface* thread) override {
22
23
auto manager = thread->inspector_agent ()->GetWorkerManager ();
23
24
manager->WorkerStarted (id_, info_, waiting_);
24
25
}
25
26
26
27
private:
27
- static std::string BuildWorkerTitle (int id) {
28
- return " Worker " + std::to_string (id);
28
+ static std::string BuildWorkerTitle (int id, const std::string& title_prefix) {
29
+ // std::cout << "title_prefix: " << title_prefix << std::endl;
30
+ return title_prefix + " Worker " + std::to_string (id);
29
31
}
30
32
31
33
uint64_t id_;
@@ -57,11 +59,13 @@ ParentInspectorHandle::ParentInspectorHandle(
57
59
uint64_t id,
58
60
const std::string& url,
59
61
std::shared_ptr<MainThreadHandle> parent_thread,
60
- bool wait_for_connect)
62
+ bool wait_for_connect,
63
+ const std::string& title_prefix)
61
64
: id_(id),
62
65
url_(url),
63
66
parent_thread_(parent_thread),
64
- wait_(wait_for_connect) {}
67
+ wait_(wait_for_connect),
68
+ title_prefix_(title_prefix) {}
65
69
66
70
ParentInspectorHandle::~ParentInspectorHandle () {
67
71
parent_thread_->Post (
@@ -71,7 +75,7 @@ ParentInspectorHandle::~ParentInspectorHandle() {
71
75
void ParentInspectorHandle::WorkerStarted (
72
76
std::shared_ptr<MainThreadHandle> worker_thread, bool waiting) {
73
77
std::unique_ptr<Request> request (
74
- new WorkerStartedRequest (id_, url_, worker_thread, waiting));
78
+ new WorkerStartedRequest (id_, url_, worker_thread, waiting, title_prefix_ ));
75
79
parent_thread_->Post (std::move (request));
76
80
}
77
81
@@ -97,9 +101,9 @@ void WorkerManager::WorkerStarted(uint64_t session_id,
97
101
}
98
102
99
103
std::unique_ptr<ParentInspectorHandle> WorkerManager::NewParentHandle (
100
- uint64_t thread_id, const std::string& url) {
104
+ uint64_t thread_id, const std::string& url, const std::string& title_prefix ) {
101
105
bool wait = !delegates_waiting_on_start_.empty ();
102
- return std::make_unique<ParentInspectorHandle>(thread_id, url, thread_, wait );
106
+ return std::make_unique<ParentInspectorHandle>(thread_id, url, thread_, wait , title_prefix );
103
107
}
104
108
105
109
void WorkerManager::RemoveAttachDelegate (int id) {
0 commit comments