tracing: Update to use new Platform tracing apis

V8 modified the platform API to accept a tracing controller at platform
creation time that is required to be present for the lifetime of the
platform if tracing will every be enabled. This will simplify the
implementation of a v8::Platform subclass for node.

PR-URL: https://github.com/nodejs/node/pull/14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
Matt Loring authored and Anna Henningsen committed 2017-08-17 20:26:49 +02:00
1 parent fabe1b4e19
commit 5e5a52fc93
5 files changed
+34 -36

No files matched your search

+8 -7
View File
@@ -251,12 +251,15 @@ 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;
platform_ = v8::platform::CreateDefaultPlatform(
thread_pool_size,
v8::platform::IdleTaskSupport::kDisabled,
v8::platform::InProcessStackDumping::kDisabled);
thread_pool_size, v8::platform::IdleTaskSupport::kDisabled,
v8::platform::InProcessStackDumping::kDisabled,
trace_enabled ? tracing_agent_->GetTracingController() : nullptr);
V8::InitializePlatform(platform_);
tracing::TraceEventHelper::SetCurrentPlatform(platform_);
tracing::TraceEventHelper::SetTracingController(
trace_enabled ? tracing_agent_->GetTracingController() : nullptr);
}
void PumpMessageLoop(Isolate* isolate) {
@@ -283,9 +286,7 @@ static struct {
#endif // HAVE_INSPECTOR
void StartTracingAgent() {
CHECK(tracing_agent_ == nullptr);
tracing_agent_ = new tracing::Agent();
tracing_agent_->Start(platform_, trace_enabled_categories);
tracing_agent_->Start(trace_enabled_categories);
}
void StopTracingAgent() {