Skip to content

Commit

Permalink
src, test: downgrade to v8 3.14 api
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Feb 25, 2013
1 parent 03fe7fb commit 51f6e6a
Show file tree
Hide file tree
Showing 27 changed files with 382 additions and 396 deletions.
50 changes: 25 additions & 25 deletions src/cares_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static Local<Array> HostentToAddresses(struct hostent* host) {
uv_inet_ntop(host->h_addrtype, host->h_addr_list[i], ip, sizeof(ip));

Local<String> address = String::New(ip);
addresses->Set(Integer::New(i, node_isolate), address);
addresses->Set(Integer::New(i), address);
}

return scope.Close(addresses);
Expand All @@ -216,7 +216,7 @@ static Local<Array> HostentToNames(struct hostent* host) {

for (int i = 0; host->h_aliases[i]; ++i) {
Local<String> address = String::New(host->h_aliases[i]);
names->Set(Integer::New(i, node_isolate), address);
names->Set(Integer::New(i), address);
}

return scope.Close(names);
Expand Down Expand Up @@ -337,13 +337,13 @@ class QueryWrap {

void CallOnComplete(Local<Value> answer) {
HandleScope scope;
Local<Value> argv[2] = { Integer::New(0, node_isolate), answer };
Local<Value> argv[2] = { Integer::New(0), answer };
MakeCallback(object_, oncomplete_sym, ARRAY_SIZE(argv), argv);
}

void CallOnComplete(Local<Value> answer, Local<Value> family) {
HandleScope scope;
Local<Value> argv[3] = { Integer::New(0, node_isolate), answer, family };
Local<Value> argv[3] = { Integer::New(0), answer, family };
MakeCallback(object_, oncomplete_sym, ARRAY_SIZE(argv), argv);
}

Expand All @@ -352,7 +352,7 @@ class QueryWrap {
SetAresErrno(status);

HandleScope scope;
Local<Value> argv[1] = { Integer::New(-1, node_isolate) };
Local<Value> argv[1] = { Integer::New(-1) };
MakeCallback(object_, oncomplete_sym, ARRAY_SIZE(argv), argv);
}

Expand Down Expand Up @@ -492,8 +492,8 @@ class QueryMxWrap: public QueryWrap {
Local<Object> mx_record = Object::New();
mx_record->Set(exchange_symbol, String::New(mx_current->host));
mx_record->Set(priority_symbol,
Integer::New(mx_current->priority, node_isolate));
mx_records->Set(Integer::New(i++, node_isolate), mx_record);
Integer::New(mx_current->priority));
mx_records->Set(Integer::New(i++), mx_record);
}

ares_free_data(mx_start);
Expand Down Expand Up @@ -550,7 +550,7 @@ class QueryTxtWrap: public QueryWrap {
struct ares_txt_reply *current = txt_out;
for (int i = 0; current; ++i, current = current->next) {
Local<String> txt = String::New(reinterpret_cast<char*>(current->txt));
txt_records->Set(Integer::New(i, node_isolate), txt);
txt_records->Set(Integer::New(i), txt);
}

ares_free_data(txt_out);
Expand Down Expand Up @@ -595,12 +595,12 @@ class QuerySrvWrap: public QueryWrap {
Local<Object> srv_record = Object::New();
srv_record->Set(name_symbol, String::New(srv_current->host));
srv_record->Set(port_symbol,
Integer::New(srv_current->port, node_isolate));
Integer::New(srv_current->port));
srv_record->Set(priority_symbol,
Integer::New(srv_current->priority, node_isolate));
Integer::New(srv_current->priority));
srv_record->Set(weight_symbol,
Integer::New(srv_current->weight, node_isolate));
srv_records->Set(Integer::New(i++, node_isolate), srv_record);
Integer::New(srv_current->weight));
srv_records->Set(Integer::New(i++), srv_record);
}

ares_free_data(srv_start);
Expand Down Expand Up @@ -656,7 +656,7 @@ class GetHostByNameWrap: public QueryWrap {
HandleScope scope;

Local<Array> addresses = HostentToAddresses(host);
Local<Integer> family = Integer::New(host->h_addrtype, node_isolate);
Local<Integer> family = Integer::New(host->h_addrtype);

this->CallOnComplete(addresses, family);
}
Expand All @@ -677,15 +677,15 @@ static Handle<Value> Query(const Arguments& args) {
// We must cache the wrap's js object here, because cares might make the
// callback from the wrap->Send stack. This will destroy the wrap's internal
// object reference, causing wrap->GetObject() to return undefined.
Local<Object> object = Local<Object>::New(node_isolate, wrap->GetObject());
Local<Object> object = Local<Object>::New(wrap->GetObject());

String::Utf8Value name(args[0]);

int r = wrap->Send(*name);
if (r) {
SetAresErrno(r);
delete wrap;
return scope.Close(v8::Null(node_isolate));
return scope.Close(v8::Null());
} else {
return scope.Close(object);
}
Expand All @@ -706,7 +706,7 @@ static Handle<Value> QueryWithFamily(const Arguments& args) {
// We must cache the wrap's js object here, because cares might make the
// callback from the wrap->Send stack. This will destroy the wrap's internal
// object reference, causing wrap->GetObject() to return undefined.
Local<Object> object = Local<Object>::New(node_isolate, wrap->GetObject());
Local<Object> object = Local<Object>::New(wrap->GetObject());

String::Utf8Value name(args[0]);
int family = args[1]->Int32Value();
Expand All @@ -715,7 +715,7 @@ static Handle<Value> QueryWithFamily(const Arguments& args) {
if (r) {
SetAresErrno(r);
delete wrap;
return scope.Close(v8::Null(node_isolate));
return scope.Close(v8::Null());
} else {
return scope.Close(object);
}
Expand All @@ -732,7 +732,7 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
if (status) {
// Error
SetErrno(uv_last_error(uv_default_loop()));
argv[0] = Local<Value>::New(node_isolate, Null(node_isolate));
argv[0] = Local<Value>::New(Null());
} else {
// Success
struct addrinfo *address;
Expand Down Expand Up @@ -824,14 +824,14 @@ static Handle<Value> IsIP(const Arguments& args) {
char address_buffer[sizeof(struct in6_addr)];

if (uv_inet_pton(AF_INET, *ip, &address_buffer).code == UV_OK) {
return scope.Close(v8::Integer::New(4, node_isolate));
return scope.Close(v8::Integer::New(4));
}

if (uv_inet_pton(AF_INET6, *ip, &address_buffer).code == UV_OK) {
return scope.Close(v8::Integer::New(6, node_isolate));
return scope.Close(v8::Integer::New(6));
}

return scope.Close(v8::Integer::New(0, node_isolate));
return scope.Close(v8::Integer::New(0));
}


Expand Down Expand Up @@ -871,7 +871,7 @@ static Handle<Value> GetAddrInfo(const Arguments& args) {
if (r) {
SetErrno(uv_last_error(uv_default_loop()));
delete req_wrap;
return scope.Close(v8::Null(node_isolate));
return scope.Close(v8::Null());
} else {
return scope.Close(req_wrap->object_);
}
Expand Down Expand Up @@ -915,11 +915,11 @@ static void Initialize(Handle<Object> target) {
NODE_SET_METHOD(target, "isIP", IsIP);

target->Set(String::NewSymbol("AF_INET"),
Integer::New(AF_INET, node_isolate));
Integer::New(AF_INET));
target->Set(String::NewSymbol("AF_INET6"),
Integer::New(AF_INET6, node_isolate));
Integer::New(AF_INET6));
target->Set(String::NewSymbol("AF_UNSPEC"),
Integer::New(AF_UNSPEC, node_isolate));
Integer::New(AF_UNSPEC));

oncomplete_sym = NODE_PSYMBOL("oncomplete");
}
Expand Down
12 changes: 6 additions & 6 deletions src/fs_event_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Handle<Value> FSEventWrap::Start(const Arguments& args) {
SetErrno(uv_last_error(uv_default_loop()));
}

return scope.Close(Integer::New(r, node_isolate));
return scope.Close(Integer::New(r));
}


Expand All @@ -136,7 +136,7 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename,
// unreasonable, right? Still, we should revisit this before v1.0.
if (status) {
SetErrno(uv_last_error(uv_default_loop()));
eventStr = String::Empty(node_isolate);
eventStr = String::Empty();
}
else if (events & UV_RENAME) {
eventStr = String::New("rename");
Expand All @@ -150,10 +150,10 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename,
}

Local<Value> argv[3] = {
Integer::New(status, node_isolate),
Integer::New(status),
eventStr,
filename ? static_cast<Local<Value> >(String::New(filename))
: Local<Value>::New(node_isolate, v8::Null(node_isolate))
: Local<Value>::New(v8::Null())
};

if (onchange_sym.IsEmpty()) {
Expand All @@ -172,11 +172,11 @@ Handle<Value> FSEventWrap::Close(const Arguments& args) {
// and legal, HandleWrap::Close() deals with them the same way.
assert(!args.Holder().IsEmpty());
assert(args.Holder()->InternalFieldCount() > 0);
void* ptr = args.Holder()->GetAlignedPointerFromInternalField(0);
void* ptr = args.Holder()->GetPointerFromInternalField(0);
FSEventWrap* wrap = static_cast<FSEventWrap*>(ptr);

if (wrap == NULL || wrap->initialized_ == false) {
return Undefined(node_isolate);
return Undefined();
}
wrap->initialized_ = false;

Expand Down
14 changes: 7 additions & 7 deletions src/handle_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
assert(!args.Holder().IsEmpty()); \
assert(args.Holder()->InternalFieldCount() > 0); \
type* wrap = static_cast<type*>( \
args.Holder()->GetAlignedPointerFromInternalField(0));
args.Holder()->GetPointerFromInternalField(0));

namespace node {

Expand Down Expand Up @@ -66,7 +66,7 @@ Handle<Value> HandleWrap::Ref(const Arguments& args) {
wrap->unref_ = false;
}

return v8::Undefined(node_isolate);
return v8::Undefined();
}


Expand All @@ -80,15 +80,15 @@ Handle<Value> HandleWrap::Unref(const Arguments& args) {
wrap->unref_ = true;
}

return v8::Undefined(node_isolate);
return v8::Undefined();
}


Handle<Value> HandleWrap::Close(const Arguments& args) {
HandleScope scope;

HandleWrap *wrap = static_cast<HandleWrap*>(
args.Holder()->GetAlignedPointerFromInternalField(0));
args.Holder()->GetPointerFromInternalField(0));

// guard against uninitialized handle or double close
if (wrap && wrap->handle__) {
Expand All @@ -97,7 +97,7 @@ Handle<Value> HandleWrap::Close(const Arguments& args) {
wrap->handle__ = NULL;
}

return v8::Null(node_isolate);
return v8::Null();
}


Expand All @@ -112,7 +112,7 @@ HandleWrap::HandleWrap(Handle<Object> object, uv_handle_t* h) {
assert(object_.IsEmpty());
assert(object->InternalFieldCount() > 0);
object_ = v8::Persistent<v8::Object>::New(object);
object_->SetAlignedPointerInInternalField(0, this);
object_->SetPointerInInternalField(0, this);
ngx_queue_insert_tail(&handle_wrap_queue, &handle_wrap_queue_);
}

Expand All @@ -138,7 +138,7 @@ void HandleWrap::OnClose(uv_handle_t* handle) {
// But the handle pointer should be gone.
assert(wrap->handle__ == NULL);

wrap->object_->SetAlignedPointerInInternalField(0, NULL);
wrap->object_->SetPointerInInternalField(0, NULL);
wrap->object_.Dispose();
wrap->object_.Clear();

Expand Down
Loading

0 comments on commit 51f6e6a

Please sign in to comment.