diff options
author | Trevor Norris <trev.norris@gmail.com> | 2014-12-09 04:55:48 +0100 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2014-12-09 17:57:13 +0100 |
commit | 5d17b16ecceb61c2c9946d8f59093561a8912142 (patch) | |
tree | 78d0793bf52c22b230dd2a23e099bb55d9ad17dd /src/async-wrap-inl.h | |
parent | 0d60ab3efedd8b2fca607cc5ede7f866be412a0e (diff) | |
download | node-new-5d17b16ecceb61c2c9946d8f59093561a8912142.tar.gz |
async-wrap: move MakeCallback to .cc
MakeCallback is too large a function to be inlined. Likewise, only
having header files will not allow for any part of AsyncWrap to be
exposed cleanly via NODE_MODULE_CONTEXT_AWARE_BUILTIN().
PR-URL: https://github.com/joyent/node/pull/8110
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
Reviewed-by: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
Diffstat (limited to 'src/async-wrap-inl.h')
-rw-r--r-- | src/async-wrap-inl.h | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/src/async-wrap-inl.h b/src/async-wrap-inl.h index d64aeab2c7..38a5c7fd23 100644 --- a/src/async-wrap-inl.h +++ b/src/async-wrap-inl.h @@ -46,134 +46,6 @@ inline uint32_t AsyncWrap::provider_type() const { } -// I hate you domains. -inline v8::Handle<v8::Value> AsyncWrap::MakeDomainCallback( - const v8::Handle<v8::Function> cb, - int argc, - v8::Handle<v8::Value>* argv) { - CHECK_EQ(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); - - 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>(); - if (enter->IsFunction()) { - enter->Call(domain, 0, nullptr); - 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_domain) { - v8::Local<v8::Function> exit = - domain->Get(env()->exit_string()).As<v8::Function>(); - if (exit->IsFunction()) { - exit->Call(domain, 0, nullptr); - 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) { - env()->isolate()->RunMicrotasks(); - } - - 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, nullptr); - - 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); - - CHECK_EQ(env()->context(), env()->isolate()->GetCurrentContext()); - - v8::Local<v8::Object> context = object(); - v8::Local<v8::Object> process = env()->process_object(); - - v8::TryCatch try_catch; - try_catch.SetVerbose(true); - - v8::Local<v8::Value> ret = cb->Call(context, argc, argv); - - 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) { - env()->isolate()->RunMicrotasks(); - } - - 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, nullptr); - - 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::String> symbol, int argc, |