Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Ostroukhov <eostroukhov@gmail.com>2019-07-26 20:40:54 +0300
committerEugene Ostroukhov <eostroukhov@gmail.com>2019-09-16 19:01:55 +0300
commit3d841fe20d732111094c3f62febd5a6b8b483b91 (patch)
tree197e5397ecd069b315f9e76b1d2ce942f35cfa9b /src/inspector_agent.cc
parent70abb4ffe40c8526c5415c02c20b7b3a3cdbacd2 (diff)
inspector: new API - Session.connectToMainThread
This API is designed to enable worker threads use Inspector protocol on main thread (and other workers through NodeWorker domain). Note that worker can cause dead lock by suspending itself. I will work on a new API that will allow workers to be hidden from the inspector. Fixes: https://github.com/nodejs/node/issues/28828 PR-URL: https://github.com/nodejs/node/pull/28870 Reviewed-By: Aleksei Koziatinskii <ak239spb@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'src/inspector_agent.cc')
-rw-r--r--src/inspector_agent.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc
index 1f4c42d62ca..424b09d6e1d 100644
--- a/src/inspector_agent.cc
+++ b/src/inspector_agent.cc
@@ -828,6 +828,17 @@ std::unique_ptr<InspectorSession> Agent::Connect(
new SameThreadInspectorSession(session_id, client_));
}
+std::unique_ptr<InspectorSession> Agent::ConnectToMainThread(
+ std::unique_ptr<InspectorSessionDelegate> delegate,
+ bool prevent_shutdown) {
+ CHECK_NOT_NULL(parent_handle_);
+ CHECK_NOT_NULL(client_);
+ auto thread_safe_delegate =
+ client_->getThreadHandle()->MakeDelegateThreadSafe(std::move(delegate));
+ return parent_handle_->Connect(std::move(thread_safe_delegate),
+ prevent_shutdown);
+}
+
void Agent::WaitForDisconnect() {
CHECK_NOT_NULL(client_);
bool is_worker = parent_handle_ != nullptr;