Skip to content

Commit

Permalink
src: don't call tracing_agent->Start w/nullptr
Browse files Browse the repository at this point in the history
node::tracing::Agent::Start can't accept a nullptr argument
to its platform parameter, so don't call it when Node is compiled
with NODE_USE_V8_PLATFORM=0.
  • Loading branch information
mykmelez committed Feb 1, 2017
1 parent e619725 commit 0e9c0cb
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,16 @@ static struct {
}
#endif // HAVE_INSPECTOR

void StartTracingAgent() {
tracing_agent = new tracing::Agent();
tracing_agent->Start(platform_, trace_enabled_categories);
}

void StopTracingAgent() {
tracing_agent->Stop();
}

v8::Platform* platform_;
#else // !NODE_USE_V8_PLATFORM
void Initialize(int thread_pool_size) {}
void PumpMessageLoop(Isolate* isolate) {}
Expand All @@ -237,9 +247,13 @@ static struct {
env->ThrowError("Node compiled with NODE_USE_V8_PLATFORM=0");
return false; // make compiler happy
}
#endif // !NODE_USE_V8_PLATFORM

v8::Platform* platform_;
void StartTracingAgent() {
fprintf(stderr, "Node compiled with NODE_USE_V8_PLATFORM=0, "
"so event tracing is not available.\n");
}
void StopTracingAgent() {}
#endif // !NODE_USE_V8_PLATFORM
} v8_platform;

#ifdef __POSIX__
Expand Down Expand Up @@ -4534,15 +4548,14 @@ int Start(int argc, char** argv) {
if (trace_enabled) {
fprintf(stderr, "Warning: Trace event is an experimental feature "
"and could change at any time.\n");
tracing_agent = new tracing::Agent();
tracing_agent->Start(v8_platform.platform_, trace_enabled_categories);
v8_platform.StartTracingAgent();
}
V8::Initialize();
v8_initialized = true;
const int exit_code =
Start(uv_default_loop(), argc, argv, exec_argc, exec_argv);
if (trace_enabled) {
tracing_agent->Stop();
v8_platform.StopTracingAgent();
}
v8_initialized = false;
V8::Dispose();
Expand Down

0 comments on commit 0e9c0cb

Please sign in to comment.