mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
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 <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
bc69a81276
commit
7e7f07755c
2 files changed
+20
-20
No files matched your search
+1
-1
@@ -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
|
||||
|
||||
@@ -660,6 +660,25 @@ class TickInfo {
|
||||
AliasedBuffer<uint8_t, v8::Uint8Array> 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);
|
||||
|
||||
Reference in new issue
Block a user