From 2e2efdd048b71ae9dd8a5d65477d7927f3dee6be Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Wed, 20 Mar 2019 19:45:28 +0800 Subject: [PATCH] src: move TrackingTraceStateObserver out of Environment PR-URL: https://github.com/nodejs/node/pull/26824 Refs: https://github.com/nodejs/node/issues/26776 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- src/env.cc | 2 +- src/env.h | 38 +++++++++++++++++++------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/env.cc b/src/env.cc index 73a8e6e773f58c..2e56d216aa203d 100644 --- a/src/env.cc +++ b/src/env.cc @@ -146,7 +146,7 @@ void InitThreadLocalOnce() { CHECK_EQ(0, uv_key_create(&Environment::thread_local_env)); } -void Environment::TrackingTraceStateObserver::UpdateTraceCategoryState() { +void TrackingTraceStateObserver::UpdateTraceCategoryState() { if (!env_->owns_process_state()) { // Ideally, we’d have a consistent story that treats all threads/Environment // instances equally here. However, tracing is essentially global, and this diff --git a/src/env.h b/src/env.h index 7ac325abbc77cc..fe925e0a57af7d 100644 --- a/src/env.h +++ b/src/env.h @@ -660,6 +660,25 @@ class TickInfo { AliasedBuffer fields_; }; +class TrackingTraceStateObserver : + public v8::TracingController::TraceStateObserver { + public: + explicit TrackingTraceStateObserver(Environment* env) : env_(env) {} + + void OnTraceEnabled() override { + UpdateTraceCategoryState(); + } + + void OnTraceDisabled() override { + UpdateTraceCategoryState(); + } + + private: + void UpdateTraceCategoryState(); + + Environment* env_; +}; + class Environment { public: Environment(const Environment&) = delete; @@ -979,25 +998,6 @@ class Environment { // This needs to be available for the JS-land setImmediate(). void ToggleImmediateRef(bool ref); - class TrackingTraceStateObserver : - public v8::TracingController::TraceStateObserver { - public: - explicit TrackingTraceStateObserver(Environment* env) : env_(env) {} - - void OnTraceEnabled() override { - UpdateTraceCategoryState(); - } - - void OnTraceDisabled() override { - UpdateTraceCategoryState(); - } - - private: - void UpdateTraceCategoryState(); - - Environment* env_; - }; - class ShouldNotAbortOnUncaughtScope { public: explicit inline ShouldNotAbortOnUncaughtScope(Environment* env);