This repository was archived by the owner on Aug 31, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed
Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -284,6 +284,7 @@ inline Environment::Environment(IsolateData* isolate_data,
284284 v8::Local<v8::Context> context)
285285 : isolate_(context->GetIsolate ()),
286286 isolate_data_(isolate_data),
287+ profiler_idle_notifier_started_(false ),
287288 async_hooks_(context->GetIsolate ()),
288289 timer_base_(uv_now(isolate_data->event_loop ())),
289290 using_domains_(false ),
@@ -337,6 +338,10 @@ inline Environment::~Environment() {
337338 free (performance_state_);
338339}
339340
341+ inline bool Environment::profiler_idle_notifier_started () const {
342+ return profiler_idle_notifier_started_;
343+ }
344+
340345inline v8::Isolate* Environment::isolate () const {
341346 return isolate_;
342347}
Original file line number Diff line number Diff line change @@ -111,6 +111,11 @@ void Environment::CleanupHandles() {
111111}
112112
113113void Environment::StartProfilerIdleNotifier () {
114+ if (profiler_idle_notifier_started_)
115+ return ;
116+
117+ profiler_idle_notifier_started_ = true ;
118+
114119 uv_prepare_start (&idle_prepare_handle_, [](uv_prepare_t * handle) {
115120 Environment* env = ContainerOf (&Environment::idle_prepare_handle_, handle);
116121 env->isolate ()->GetCpuProfiler ()->SetIdle (true );
@@ -123,6 +128,7 @@ void Environment::StartProfilerIdleNotifier() {
123128}
124129
125130void Environment::StopProfilerIdleNotifier () {
131+ profiler_idle_notifier_started_ = false ;
126132 uv_prepare_stop (&idle_prepare_handle_);
127133 uv_check_stop (&idle_check_handle_);
128134}
Original file line number Diff line number Diff line change @@ -543,6 +543,7 @@ class Environment {
543543
544544 void StartProfilerIdleNotifier ();
545545 void StopProfilerIdleNotifier ();
546+ inline bool profiler_idle_notifier_started () const ;
546547
547548 inline v8::Isolate* isolate () const ;
548549 inline uv_loop_t * event_loop () const ;
@@ -703,6 +704,7 @@ class Environment {
703704 uv_timer_t destroy_async_ids_timer_handle_;
704705 uv_prepare_t idle_prepare_handle_;
705706 uv_check_t idle_check_handle_;
707+ bool profiler_idle_notifier_started_;
706708
707709 AsyncHooks async_hooks_;
708710 DomainFlag domain_flag_;
You can’t perform that action at this time.
0 commit comments