diff options
author | murgatroid99 <mlumish@google.com> | 2015-03-04 14:42:31 -0800 |
---|---|---|
committer | murgatroid99 <mlumish@google.com> | 2015-03-04 14:42:31 -0800 |
commit | f28066b930da85561c6a1409539ea88ef44e3f79 (patch) | |
tree | 328039b9dbb7ed8af0c3e569b0a44ec8e6dba1f5 /src/node/ext/channel.cc | |
parent | 5f875d29869de606432531ecdd630bc5aa6f9574 (diff) |
The library now compiles with Node 0.11+ and all versions of io.js
Diffstat (limited to 'src/node/ext/channel.cc')
-rw-r--r-- | src/node/ext/channel.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/node/ext/channel.cc b/src/node/ext/channel.cc index bc9461d7df..787e274973 100644 --- a/src/node/ext/channel.cc +++ b/src/node/ext/channel.cc @@ -45,7 +45,6 @@ namespace grpc { namespace node { -using v8::Arguments; using v8::Array; using v8::Exception; using v8::Function; @@ -59,7 +58,7 @@ using v8::Persistent; using v8::String; using v8::Value; -Persistent<Function> Channel::constructor; +NanCallback *Channel::constructor; Persistent<FunctionTemplate> Channel::fun_tpl; Channel::Channel(grpc_channel *channel, NanUtf8String *host) @@ -74,14 +73,15 @@ Channel::~Channel() { void Channel::Init(Handle<Object> exports) { NanScope(); - Local<FunctionTemplate> tpl = FunctionTemplate::New(New); + Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New); tpl->SetClassName(NanNew("Channel")); tpl->InstanceTemplate()->SetInternalFieldCount(1); NanSetPrototypeTemplate(tpl, "close", - FunctionTemplate::New(Close)->GetFunction()); + NanNew<FunctionTemplate>(Close)->GetFunction()); NanAssignPersistent(fun_tpl, tpl); - NanAssignPersistent(constructor, tpl->GetFunction()); - exports->Set(NanNew("Channel"), constructor); + Handle<Function> ctr = tpl->GetFunction(); + constructor = new NanCallback(ctr); + exports->Set(NanNew("Channel"), ctr); } bool Channel::HasInstance(Handle<Value> val) { @@ -170,7 +170,7 @@ NAN_METHOD(Channel::New) { } else { const int argc = 2; Local<Value> argv[argc] = {args[0], args[1]}; - NanReturnValue(constructor->NewInstance(argc, argv)); + NanReturnValue(constructor->GetFunction()->NewInstance(argc, argv)); } } |