Skip to content

Commit

Permalink
worker: set up child Isolate inside Worker thread
Browse files Browse the repository at this point in the history
Refs: nodejs#24016

PR-URL: nodejs#26011
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
  • Loading branch information
addaleax committed Feb 11, 2019
1 parent 58ba8bf commit 5bc6e49
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 172 deletions.
14 changes: 8 additions & 6 deletions src/inspector_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -885,12 +885,14 @@ bool Agent::IsActive() {
return io_ != nullptr || client_->IsActive();
}

void Agent::AddWorkerInspector(int thread_id,
const std::string& url,
Agent* agent) {
CHECK_NOT_NULL(client_);
agent->parent_handle_ =
client_->getWorkerManager()->NewParentHandle(thread_id, url);
void Agent::SetParentHandle(
std::unique_ptr<ParentInspectorHandle> parent_handle) {
parent_handle_ = std::move(parent_handle);
}

std::unique_ptr<ParentInspectorHandle> Agent::GetParentHandle(
int thread_id, const std::string& url) {
return client_->getWorkerManager()->NewParentHandle(thread_id, url);
}

void Agent::WaitForConnect() {
Expand Down
4 changes: 3 additions & 1 deletion src/inspector_agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ class Agent {
void EnableAsyncHook();
void DisableAsyncHook();

void AddWorkerInspector(int thread_id, const std::string& url, Agent* agent);
void SetParentHandle(std::unique_ptr<ParentInspectorHandle> parent_handle);
std::unique_ptr<ParentInspectorHandle> GetParentHandle(
int thread_id, const std::string& url);

// Called to create inspector sessions that can be used from the main thread.
// The inspector responds by using the delegate to send messages back.
Expand Down
Loading

0 comments on commit 5bc6e49

Please sign in to comment.