From f28066b930da85561c6a1409539ea88ef44e3f79 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 4 Mar 2015 14:42:31 -0800 Subject: The library now compiles with Node 0.11+ and all versions of io.js --- src/node/ext/channel.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/node/ext/channel.cc') 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 Channel::constructor; +NanCallback *Channel::constructor; Persistent Channel::fun_tpl; Channel::Channel(grpc_channel *channel, NanUtf8String *host) @@ -74,14 +73,15 @@ Channel::~Channel() { void Channel::Init(Handle exports) { NanScope(); - Local tpl = FunctionTemplate::New(New); + Local tpl = NanNew(New); tpl->SetClassName(NanNew("Channel")); tpl->InstanceTemplate()->SetInternalFieldCount(1); NanSetPrototypeTemplate(tpl, "close", - FunctionTemplate::New(Close)->GetFunction()); + NanNew(Close)->GetFunction()); NanAssignPersistent(fun_tpl, tpl); - NanAssignPersistent(constructor, tpl->GetFunction()); - exports->Set(NanNew("Channel"), constructor); + Handle ctr = tpl->GetFunction(); + constructor = new NanCallback(ctr); + exports->Set(NanNew("Channel"), ctr); } bool Channel::HasInstance(Handle val) { @@ -170,7 +170,7 @@ NAN_METHOD(Channel::New) { } else { const int argc = 2; Local argv[argc] = {args[0], args[1]}; - NanReturnValue(constructor->NewInstance(argc, argv)); + NanReturnValue(constructor->GetFunction()->NewInstance(argc, argv)); } } -- cgit v1.2.3