Skip to content

Commit

Permalink
src: move TrackingTraceStateObserver out of Environment
Browse files Browse the repository at this point in the history
PR-URL: nodejs#26824
Refs: nodejs#26776
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
joyeecheung authored and targos committed Mar 27, 2019
1 parent 9d600a3 commit 2e2efdd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 19 additions & 19 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2e2efdd

Please sign in to comment.