Add process.activateUvLoop() API.

This commit is contained in:
Cheng Zhao 2013-07-09 20:38:44 +08:00
parent 4c71fbb68b
commit 25d9c1a14d
3 changed files with 19 additions and 1 deletions

View file

@ -10,10 +10,20 @@
namespace atom {
namespace {
static uv_async_t dummy_uv_handle;
void UvNoOp(uv_async_t* handle, int status) {
}
} // namespace
// Defined in atom_extensions.cc.
node::node_module_struct* GetBuiltinModule(const char *name, bool is_browser);
AtomBindings::AtomBindings() {
uv_async_init(uv_default_loop(), &dummy_uv_handle, UvNoOp);
}
AtomBindings::~AtomBindings() {
@ -24,6 +34,7 @@ void AtomBindings::BindTo(v8::Handle<v8::Object> process) {
node::SetMethod(process, "atomBinding", Binding);
node::SetMethod(process, "crash", Crash);
node::SetMethod(process, "activateUvLoop", ActivateUVLoop);
}
// static
@ -79,4 +90,10 @@ v8::Handle<v8::Value> AtomBindings::Crash(const v8::Arguments& args) {
return v8::Undefined();
}
// static
v8::Handle<v8::Value> AtomBindings::ActivateUVLoop(const v8::Arguments& args) {
uv_async_send(&dummy_uv_handle);
return v8::Undefined();
}
} // namespace atom

View file

@ -22,6 +22,7 @@ class AtomBindings {
private:
static v8::Handle<v8::Value> Binding(const v8::Arguments& args);
static v8::Handle<v8::Value> Crash(const v8::Arguments& args);
static v8::Handle<v8::Value> ActivateUVLoop(const v8::Arguments& args);
DISALLOW_COPY_AND_ASSIGN(AtomBindings);
};

2
vendor/node vendored

@ -1 +1 @@
Subproject commit 13b5a98d46ce4604d5e4b984c41d896d436a8d4c
Subproject commit 4b4c40a51dfc3033f904756797d18b11b75e045c