Skip to content

Commit

Permalink
src: refactor tracing_agent into v8_platform
Browse files Browse the repository at this point in the history
Move tracing_agent global into the v8_platform struct, renaming it to
tracing_agent_; CHECK(tracing_agent_ == nullptr) in StartTracingAgent()
to detect double calls; and relace another tracing_agent->Stop() call
with a call to StopTracingAgent().
  • Loading branch information
mykmelez committed Feb 2, 2017
1 parent 0e9c0cb commit b93584b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ static uv_async_t dispatch_debug_messages_async;

static Mutex node_isolate_mutex;
static v8::Isolate* node_isolate;
static tracing::Agent* tracing_agent;

static node::DebugOptions debug_options;

Expand Down Expand Up @@ -229,15 +228,17 @@ static struct {
#endif // HAVE_INSPECTOR

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

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

v8::Platform* platform_;
tracing::Agent* tracing_agent_;
#else // !NODE_USE_V8_PLATFORM
void Initialize(int thread_pool_size) {}
void PumpMessageLoop(Isolate* isolate) {}
Expand Down Expand Up @@ -3401,7 +3402,7 @@ void SetupProcessObject(Environment* env,
void SignalExit(int signo) {
uv_tty_reset_mode();
if (trace_enabled) {
tracing_agent->Stop();
v8_platform.StopTracingAgent();
}
#ifdef __FreeBSD__
// FreeBSD has a nasty bug, see RegisterSignalHandler for details
Expand Down

0 comments on commit b93584b

Please sign in to comment.