mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01: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:
parent
242466167d
commit
9f37d3c114
@ -119,7 +119,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
|
||||
|
38
src/env.h
38
src/env.h
@ -665,6 +665,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);
|
||||
|
Loading…
Reference in New Issue
Block a user