diff --git a/deps/v8/include/libplatform/libplatform.h b/deps/v8/include/libplatform/libplatform.h index e945045629..39158e7bc8 100644 --- a/deps/v8/include/libplatform/libplatform.h +++ b/deps/v8/include/libplatform/libplatform.h @@ -30,12 +30,15 @@ enum class MessageLoopBehavior : bool { * If |idle_task_support| is enabled then the platform will accept idle * tasks (IdleTasksEnabled will return true) and will rely on the embedder * calling v8::platform::RunIdleTasks to process the idle tasks. + * If |tracing_controller| is nullptr, the default platform will create a + * v8::platform::TracingController instance and use it. */ V8_PLATFORM_EXPORT v8::Platform* CreateDefaultPlatform( int thread_pool_size = 0, IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled, InProcessStackDumping in_process_stack_dumping = - InProcessStackDumping::kEnabled); + InProcessStackDumping::kEnabled, + v8::TracingController* tracing_controller = nullptr); /** * Pumps the message loop for the given isolate. diff --git a/deps/v8/src/libplatform/default-platform.cc b/deps/v8/src/libplatform/default-platform.cc index fce946ad6f..86fdabce4f 100644 --- a/deps/v8/src/libplatform/default-platform.cc +++ b/deps/v8/src/libplatform/default-platform.cc @@ -29,15 +29,18 @@ void PrintStackTrace() { } // namespace -v8::Platform* CreateDefaultPlatform( - int thread_pool_size, IdleTaskSupport idle_task_support, - InProcessStackDumping in_process_stack_dumping) { +v8::Platform* CreateDefaultPlatform(int thread_pool_size, + IdleTaskSupport idle_task_support, + InProcessStackDumping in_process_stack_dumping, + v8::TracingController* tracing_controller) { if (in_process_stack_dumping == InProcessStackDumping::kEnabled) { v8::base::debug::EnableInProcessStackDumping(); } DefaultPlatform* platform = new DefaultPlatform(idle_task_support); platform->SetThreadPoolSize(thread_pool_size); platform->EnsureInitialized(); + if (tracing_controller != nullptr) + platform->SetTracingController(tracing_controller); return platform; } @@ -73,11 +76,6 @@ DefaultPlatform::DefaultPlatform(IdleTaskSupport idle_task_support) idle_task_support_(idle_task_support) {} DefaultPlatform::~DefaultPlatform() { - if (tracing_controller_) { - tracing_controller_->StopTracing(); - tracing_controller_.reset(); - } - base::LockGuard guard(&lock_); queue_.Terminate(); if (initialized_) { @@ -316,7 +314,7 @@ const char* DefaultPlatform::GetCategoryGroupName( } void DefaultPlatform::SetTracingController( - tracing::TracingController* tracing_controller) { + TracingController* tracing_controller) { tracing_controller_.reset(tracing_controller); } diff --git a/deps/v8/src/libplatform/default-platform.h b/deps/v8/src/libplatform/default-platform.h index 3d91433132..80ea4e85d4 100644 --- a/deps/v8/src/libplatform/default-platform.h +++ b/deps/v8/src/libplatform/default-platform.h @@ -27,10 +27,6 @@ class TaskQueue; class Thread; class WorkerThread; -namespace tracing { -class TracingController; -} - class V8_PLATFORM_EXPORT DefaultPlatform : public NON_EXPORTED_BASE(Platform) { public: explicit DefaultPlatform( @@ -72,7 +68,7 @@ class V8_PLATFORM_EXPORT DefaultPlatform : public NON_EXPORTED_BASE(Platform) { unsigned int flags) override; void UpdateTraceEventDuration(const uint8_t* category_enabled_flag, const char* name, uint64_t handle) override; - void SetTracingController(tracing::TracingController* tracing_controller); + void SetTracingController(TracingController* tracing_controller); void AddTraceStateObserver(TraceStateObserver* observer) override; void RemoveTraceStateObserver(TraceStateObserver* observer) override; @@ -103,7 +99,7 @@ class V8_PLATFORM_EXPORT DefaultPlatform : public NON_EXPORTED_BASE(Platform) { std::priority_queue, std::greater > > main_thread_delayed_queue_; - std::unique_ptr tracing_controller_; + std::unique_ptr tracing_controller_; DISALLOW_COPY_AND_ASSIGN(DefaultPlatform); };