diff options
author | Trevor Norris <trev.norris@gmail.com> | 2013-10-29 16:35:32 -0700 |
---|---|---|
committer | Trevor Norris <trev.norris@gmail.com> | 2013-10-31 16:34:35 -0700 |
commit | bc39bdd995d70238eea4a217386869d94c69f614 (patch) | |
tree | 85f53ad7a961af92db4751829305eac1f216b946 /src/async-wrap-inl.h | |
parent | fbe7eec1eca4f26a40e32f169d5b48b1a6d41334 (diff) | |
download | android-node-v8-bc39bdd995d70238eea4a217386869d94c69f614.tar.gz android-node-v8-bc39bdd995d70238eea4a217386869d94c69f614.tar.bz2 android-node-v8-bc39bdd995d70238eea4a217386869d94c69f614.zip |
domain: use AsyncListener API
The domain module has been switched over to use the domain module API as
much as currently possible. There are still some hooks in the
EventEmitter, but hopefully we can remove those in the future.
Diffstat (limited to 'src/async-wrap-inl.h')
-rw-r--r-- | src/async-wrap-inl.h | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/src/async-wrap-inl.h b/src/async-wrap-inl.h index 055e31ecf0..b342cabfe6 100644 --- a/src/async-wrap-inl.h +++ b/src/async-wrap-inl.h @@ -104,99 +104,10 @@ inline v8::Persistent<v8::Object>& AsyncWrap::persistent() { } -// I hate you domains. -inline v8::Handle<v8::Value> AsyncWrap::MakeDomainCallback( - const v8::Handle<v8::Function> cb, - int argc, - v8::Handle<v8::Value>* argv) { - assert(env()->context() == env()->isolate()->GetCurrentContext()); - - v8::Local<v8::Object> context = object(); - v8::Local<v8::Object> process = env()->process_object(); - v8::Local<v8::Value> domain_v = context->Get(env()->domain_string()); - v8::Local<v8::Object> domain; - - v8::TryCatch try_catch; - try_catch.SetVerbose(true); - - if (has_async_queue()) { - v8::Local<v8::Value> val = context.As<v8::Value>(); - env()->async_listener_load_function()->Call(process, 1, &val); - - if (try_catch.HasCaught()) - return v8::Undefined(env()->isolate()); - } - - bool has_domain = domain_v->IsObject(); - if (has_domain) { - domain = domain_v.As<v8::Object>(); - - if (domain->Get(env()->disposed_string())->IsTrue()) - return Undefined(env()->isolate()); - - v8::Local<v8::Function> enter = - domain->Get(env()->enter_string()).As<v8::Function>(); - assert(enter->IsFunction()); - enter->Call(domain, 0, NULL); - - if (try_catch.HasCaught()) - return Undefined(env()->isolate()); - } - - v8::Local<v8::Value> ret = cb->Call(context, argc, argv); - - if (try_catch.HasCaught()) { - return Undefined(env()->isolate()); - } - - if (has_async_queue()) { - v8::Local<v8::Value> val = context.As<v8::Value>(); - env()->async_listener_unload_function()->Call(process, 1, &val); - } - - if (has_domain) { - v8::Local<v8::Function> exit = - domain->Get(env()->exit_string()).As<v8::Function>(); - assert(exit->IsFunction()); - exit->Call(domain, 0, NULL); - - if (try_catch.HasCaught()) - return Undefined(env()->isolate()); - } - - Environment::TickInfo* tick_info = env()->tick_info(); - - if (tick_info->in_tick()) { - return ret; - } - - if (tick_info->length() == 0) { - tick_info->set_index(0); - return ret; - } - - tick_info->set_in_tick(true); - - env()->tick_callback_function()->Call(process, 0, NULL); - - tick_info->set_in_tick(false); - - if (try_catch.HasCaught()) { - tick_info->set_last_threw(true); - return Undefined(env()->isolate()); - } - - return ret; -} - - inline v8::Handle<v8::Value> AsyncWrap::MakeCallback( const v8::Handle<v8::Function> cb, int argc, v8::Handle<v8::Value>* argv) { - if (env()->using_domains()) - return MakeDomainCallback(cb, argc, argv); - assert(env()->context() == env()->isolate()->GetCurrentContext()); v8::Local<v8::Object> context = object(); |