async_wrap: make Initialize a static class member
This is how it's done everywhere else in core. Make it follow suit. PR-URL: https://github.com/nodejs/node/pull/9753 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
517e3a6425
commit
cf5f4b85f5
@ -14,6 +14,7 @@ using v8::Function;
|
|||||||
using v8::FunctionCallbackInfo;
|
using v8::FunctionCallbackInfo;
|
||||||
using v8::HandleScope;
|
using v8::HandleScope;
|
||||||
using v8::HeapProfiler;
|
using v8::HeapProfiler;
|
||||||
|
using v8::Int32;
|
||||||
using v8::Integer;
|
using v8::Integer;
|
||||||
using v8::Isolate;
|
using v8::Isolate;
|
||||||
using v8::Local;
|
using v8::Local;
|
||||||
@ -155,9 +156,9 @@ static void SetupHooks(const FunctionCallbackInfo<Value>& args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void Initialize(Local<Object> target,
|
void AsyncWrap::Initialize(Local<Object> target,
|
||||||
Local<Value> unused,
|
Local<Value> unused,
|
||||||
Local<Context> context) {
|
Local<Context> context) {
|
||||||
Environment* env = Environment::GetCurrent(context);
|
Environment* env = Environment::GetCurrent(context);
|
||||||
Isolate* isolate = env->isolate();
|
Isolate* isolate = env->isolate();
|
||||||
HandleScope scope(isolate);
|
HandleScope scope(isolate);
|
||||||
@ -195,7 +196,7 @@ AsyncWrap::AsyncWrap(Environment* env,
|
|||||||
Local<Object> object,
|
Local<Object> object,
|
||||||
ProviderType provider,
|
ProviderType provider,
|
||||||
AsyncWrap* parent)
|
AsyncWrap* parent)
|
||||||
: BaseObject(env,object), bits_(static_cast<uint32_t>(provider) << 1),
|
: BaseObject(env, object), bits_(static_cast<uint32_t>(provider) << 1),
|
||||||
uid_(env->get_async_wrap_uid()) {
|
uid_(env->get_async_wrap_uid()) {
|
||||||
CHECK_NE(provider, PROVIDER_NONE);
|
CHECK_NE(provider, PROVIDER_NONE);
|
||||||
CHECK_GE(object->InternalFieldCount(), 1);
|
CHECK_GE(object->InternalFieldCount(), 1);
|
||||||
@ -361,4 +362,4 @@ Local<Value> AsyncWrap::MakeCallback(const Local<Function> cb,
|
|||||||
|
|
||||||
} // namespace node
|
} // namespace node
|
||||||
|
|
||||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(async_wrap, node::Initialize)
|
NODE_MODULE_CONTEXT_AWARE_BUILTIN(async_wrap, node::AsyncWrap::Initialize)
|
||||||
|
@ -56,6 +56,10 @@ class AsyncWrap : public BaseObject {
|
|||||||
|
|
||||||
virtual ~AsyncWrap();
|
virtual ~AsyncWrap();
|
||||||
|
|
||||||
|
static void Initialize(v8::Local<v8::Object> target,
|
||||||
|
v8::Local<v8::Value> unused,
|
||||||
|
v8::Local<v8::Context> context);
|
||||||
|
|
||||||
inline ProviderType provider_type() const;
|
inline ProviderType provider_type() const;
|
||||||
|
|
||||||
inline int64_t get_uid() const;
|
inline int64_t get_uid() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user