★ wanayoo — archive 1999 https://github.com/nodejs/node/commit/314b47d1cfNouvelle recherche | Portail wanayoo
Skip to content
Permalink
Browse files

src: add Env::profiler_idle_notifier_started()

Refs: ayojs/ayo#93
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>

PR-URL: #20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
  • Loading branch information...
TimothyGu authored and targos committed Sep 25, 2017
1 parent 5209ff9 commit 314b47d1cf4d229d52e8626740d2625810f2a615
Showing with 12 additions and 0 deletions.
  1. +4 −0 src/env-inl.h
  2. +6 −0 src/env.cc
  3. +2 −0 src/env.h
@@ -322,6 +322,10 @@ inline Environment* Environment::GetThreadLocalEnv() {
return static_cast<Environment*>(uv_key_get(&thread_local_env));
}

inline bool Environment::profiler_idle_notifier_started() const {
return profiler_idle_notifier_started_;
}

inline v8::Isolate* Environment::isolate() const {
return isolate_;
}
@@ -263,6 +263,11 @@ void Environment::CleanupHandles() {
}

void Environment::StartProfilerIdleNotifier() {
if (profiler_idle_notifier_started_)
return;

profiler_idle_notifier_started_ = true;

uv_prepare_start(&idle_prepare_handle_, [](uv_prepare_t* handle) {
Environment* env = ContainerOf(&Environment::idle_prepare_handle_, handle);
env->isolate()->SetIdle(true);
@@ -275,6 +280,7 @@ void Environment::StartProfilerIdleNotifier() {
}

void Environment::StopProfilerIdleNotifier() {
profiler_idle_notifier_started_ = false;
uv_prepare_stop(&idle_prepare_handle_);
uv_check_stop(&idle_check_handle_);
}
@@ -615,6 +615,7 @@ class Environment {

void StartProfilerIdleNotifier();
void StopProfilerIdleNotifier();
inline bool profiler_idle_notifier_started() const;

inline v8::Isolate* isolate() const;
inline tracing::Agent* tracing_agent() const;
@@ -840,6 +841,7 @@ class Environment {
uv_idle_t immediate_idle_handle_;
uv_prepare_t idle_prepare_handle_;
uv_check_t idle_check_handle_;
bool profiler_idle_notifier_started_ = false;

AsyncHooks async_hooks_;
ImmediateInfo immediate_info_;

0 comments on commit 314b47d

Please sign in to comment.
You can’t perform that action at this time.