0
0
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:
Joyee Cheung 2019-03-20 19:45:28 +08:00
parent 242466167d
commit 9f37d3c114
No known key found for this signature in database
GPG Key ID: 92B78A53C8303B8D
2 changed files with 20 additions and 20 deletions

View File

@ -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, wed have a consistent story that treats all threads/Environment
// instances equally here. However, tracing is essentially global, and this

View File

@ -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);