From 582c0d5a092b04616fef4b11b0fd893c181356f1 Mon Sep 17 00:00:00 2001 From: Kelvin Jin Date: Mon, 10 Dec 2018 20:44:18 +0000 Subject: trace_events: fix trace events JS API writing The Trace Events JS API isn't functional if none of --trace-events-enabled or --trace-event-categories is passed as a CLI argument. This commit fixes that. In addition, we currently don't test the trace_events JS API in the casewhere no CLI args are provided. This commit adds that test. Fixes https://github.com/nodejs/node/issues/24944 PR-URL: https://github.com/nodejs/node/pull/24945 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Ali Ijaz Sheikh --- src/tracing/agent.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/tracing') diff --git a/src/tracing/agent.h b/src/tracing/agent.h index 2e95e38582..0039cc3679 100644 --- a/src/tracing/agent.h +++ b/src/tracing/agent.h @@ -59,6 +59,8 @@ class AgentWriterHandle { inline void Enable(const std::set& categories); inline void Disable(const std::set& categories); + inline bool IsDefaultHandle(); + inline Agent* agent() { return agent_; } inline v8::TracingController* GetTracingController(); @@ -175,6 +177,10 @@ void AgentWriterHandle::Disable(const std::set& categories) { if (agent_ != nullptr) agent_->Disable(id_, categories); } +bool AgentWriterHandle::IsDefaultHandle() { + return agent_ != nullptr && id_ == Agent::kDefaultHandleId; +} + inline v8::TracingController* AgentWriterHandle::GetTracingController() { return agent_ != nullptr ? agent_->GetTracingController() : nullptr; } -- cgit v1.2.3