File tree Expand file tree Collapse file tree 2 files changed +51
-22
lines changed
Expand file tree Collapse file tree 2 files changed +51
-22
lines changed Original file line number Diff line number Diff line change 2828
2929#include " v8.h"
3030
31+ using v8::Context;
3132using v8::Function;
3233using v8::Handle;
34+ using v8::HandleScope;
35+ using v8::Integer;
36+ using v8::Isolate;
3337using v8::Local;
3438using v8::Object;
3539using v8::TryCatch;
3640using v8::Value;
3741
3842namespace node {
3943
44+ static void Initialize (Handle<Object> target,
45+ Handle<Value> unused,
46+ Handle<Context> context) {
47+ Environment* env = Environment::GetCurrent (context);
48+ Isolate* isolate = env->isolate ();
49+ HandleScope scope (isolate);
50+
51+ Local<Object> async_providers = Object::New (isolate);
52+ #define V (PROVIDER ) \
53+ async_providers->Set (FIXED_ONE_BYTE_STRING (isolate, #PROVIDER), \
54+ Integer::New (isolate, AsyncWrap::PROVIDER_ ## PROVIDER));
55+ NODE_ASYNC_PROVIDER_TYPES (V)
56+ #undef V
57+ target->Set (FIXED_ONE_BYTE_STRING (isolate, " Providers" ), async_providers);
58+ }
59+
60+
4061Handle<Value> AsyncWrap::MakeCallback (const Handle<Function> cb,
4162 int argc,
4263 Handle<Value>* argv) {
@@ -114,3 +135,5 @@ Handle<Value> AsyncWrap::MakeCallback(const Handle<Function> cb,
114135}
115136
116137} // namespace node
138+
139+ NODE_MODULE_CONTEXT_AWARE_BUILTIN (async_wrap, node::Initialize)
Original file line number Diff line number Diff line change 2828
2929namespace node {
3030
31+ #define NODE_ASYNC_PROVIDER_TYPES (V ) \
32+ V (NONE) \
33+ V (CARES) \
34+ V (CONNECTWRAP) \
35+ V (CRYPTO) \
36+ V (FSEVENTWRAP) \
37+ V (FSREQWRAP) \
38+ V (GETADDRINFOREQWRAP) \
39+ V (GETNAMEINFOREQWRAP) \
40+ V (PIPEWRAP) \
41+ V (PROCESSWRAP) \
42+ V (QUERYWRAP) \
43+ V (REQWRAP) \
44+ V (SHUTDOWNWRAP) \
45+ V (SIGNALWRAP) \
46+ V (STATWATCHER) \
47+ V (TCPWRAP) \
48+ V (TIMERWRAP) \
49+ V (TLSWRAP) \
50+ V (TTYWRAP) \
51+ V (UDPWRAP) \
52+ V (WRITEWRAP) \
53+ V (ZLIB)
54+
3155class AsyncWrap : public BaseObject {
3256 public:
3357 enum ProviderType {
34- PROVIDER_NONE,
35- PROVIDER_CARES,
36- PROVIDER_CONNECTWRAP,
37- PROVIDER_CRYPTO,
38- PROVIDER_FSEVENTWRAP,
39- PROVIDER_FSREQWRAP,
40- PROVIDER_GETADDRINFOREQWRAP,
41- PROVIDER_GETNAMEINFOREQWRAP,
42- PROVIDER_PIPEWRAP,
43- PROVIDER_PROCESSWRAP,
44- PROVIDER_QUERYWRAP,
45- PROVIDER_REQWRAP,
46- PROVIDER_SHUTDOWNWRAP,
47- PROVIDER_SIGNALWRAP,
48- PROVIDER_STATWATCHER,
49- PROVIDER_TCPWRAP,
50- PROVIDER_TIMERWRAP,
51- PROVIDER_TLSWRAP,
52- PROVIDER_TTYWRAP,
53- PROVIDER_UDPWRAP,
54- PROVIDER_WRITEWRAP,
55- PROVIDER_ZLIB
58+ #define V (PROVIDER ) \
59+ PROVIDER_ ## PROVIDER,
60+ NODE_ASYNC_PROVIDER_TYPES (V)
61+ #undef V
5662 };
5763
5864 inline AsyncWrap (Environment* env,
You can’t perform that action at this time.
0 commit comments