WakeupEmbedThread();
uv_thread_join(&embed_thread_);
uv_sem_destroy(&embed_sem_);
+ uv_timer_stop(&idle_timer_);
}
void NodeBindings::Initialize() {
#endif
}
+ // Init idle GC.
+ uv_timer_init(uv_default_loop(), &idle_timer_);
+ uv_timer_start(&idle_timer_, IdleCallback, 5000, 5000);
+
// Open node's error reporting system for browser process.
node::g_standalone_mode = is_browser_;
}
}
+// static
+void NodeBindings::IdleCallback(uv_timer_t*, int) {
+ v8::V8::IdleNotification();
+}
+
} // namespace atom
// Thread to poll uv events.
static void EmbedThreadRunner(void *arg);
+ // Do idle GC.
+ static void IdleCallback(uv_timer_t*, int);
+
// Whether the libuv loop has ended.
bool embed_closed_;
// Dummy handle to make uv's loop not quit.
uv_async_t dummy_uv_handle_;
+ // Timer to do idle GC.
+ uv_timer_t idle_timer_;
+
// Thread for polling events.
uv_thread_t embed_thread_;