Enable idle GC for both browser and renderer.

This commit is contained in:
Cheng Zhao 2013-07-29 20:50:03 +08:00
parent 4acbbd1ad7
commit 02de9c3b39
2 changed files with 16 additions and 0 deletions

View file

@ -42,6 +42,7 @@ NodeBindings::~NodeBindings() {
WakeupEmbedThread();
uv_thread_join(&embed_thread_);
uv_sem_destroy(&embed_sem_);
uv_timer_stop(&idle_timer_);
}
void NodeBindings::Initialize() {
@ -63,6 +64,10 @@ 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_;
@ -180,4 +185,9 @@ void NodeBindings::EmbedThreadRunner(void *arg) {
}
}
// static
void NodeBindings::IdleCallback(uv_timer_t*, int) {
v8::V8::IdleNotification();
}
} // namespace atom