Browse Source

fix: initialize tracing controller before starting platform (#14499)

Jeremy Apthorp 6 years ago
parent
commit
829b230b85
1 changed files with 4 additions and 3 deletions
  1. 4 3
      atom/browser/javascript_environment.cc

+ 4 - 3
atom/browser/javascript_environment.cc

@@ -49,11 +49,12 @@ bool JavascriptEnvironment::Initialize() {
 
   // The V8Platform of gin relies on Chromium's task schedule, which has not
   // been started at this point, so we have to rely on Node's V8Platform.
+  auto* tracing_controller = new v8::TracingController();
+  node::tracing::TraceEventHelper::SetTracingController(tracing_controller);
   platform_ = node::CreatePlatform(
-      base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0), nullptr);
+      base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0),
+      tracing_controller);
   v8::V8::InitializePlatform(platform_);
-  node::tracing::TraceEventHelper::SetTracingController(
-      new v8::TracingController());
   gin::IsolateHolder::Initialize(
       gin::IsolateHolder::kNonStrictMode, gin::IsolateHolder::kStableV8Extras,
       gin::ArrayBufferAllocator::SharedInstance(),