Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: use unique pointer for tracing_agent #17012

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ node::DebugOptions debug_options;
static struct {
#if NODE_USE_V8_PLATFORM
void Initialize(int thread_pool_size) {
tracing_agent_ =
trace_enabled ? new tracing::Agent() : nullptr;
tracing_agent_.reset(
trace_enabled ? new tracing::Agent() : nullptr);
platform_ = new NodePlatform(thread_pool_size,
trace_enabled ? tracing_agent_->GetTracingController() : nullptr);
V8::InitializePlatform(platform_);
Expand All @@ -276,8 +276,7 @@ static struct {
platform_->Shutdown();
delete platform_;
platform_ = nullptr;
delete tracing_agent_;
tracing_agent_ = nullptr;
tracing_agent_.reset(nullptr);
}

void DrainVMTasks(Isolate* isolate) {
Expand Down Expand Up @@ -314,7 +313,7 @@ static struct {
return platform_;
}

tracing::Agent* tracing_agent_;
std::unique_ptr<tracing::Agent> tracing_agent_;
NodePlatform* platform_;
#else // !NODE_USE_V8_PLATFORM
void Initialize(int thread_pool_size) {}
Expand Down