src: pass node_isolate to Integer::New

This commit is contained in:
Ben Noordhuis committed 2013-01-07 17:39:57 +01:00
1 parent 412b3cee05
commit 6573fc3502
20 files changed
+183 -159

No files matched your search

+26 -19
View File
@@ -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)); uv_inet_ntop(host->h_addrtype, host->h_addr_list[i], ip, sizeof(ip));
Local<String> address = String::New(ip); Local<String> address = String::New(ip);
addresses->Set(Integer::New(i), address); addresses->Set(Integer::New(i, node_isolate), address);
} }
return scope.Close(addresses); return scope.Close(addresses);
@@ -216,7 +216,7 @@ static Local<Array> HostentToNames(struct hostent* host) {
for (int i = 0; host->h_aliases[i]; ++i) { for (int i = 0; host->h_aliases[i]; ++i) {
Local<String> address = String::New(host->h_aliases[i]); Local<String> address = String::New(host->h_aliases[i]);
names->Set(Integer::New(i), address); names->Set(Integer::New(i, node_isolate), address);
} }
return scope.Close(names); return scope.Close(names);
@@ -337,13 +337,13 @@ class QueryWrap {
void CallOnComplete(Local<Value> answer) { void CallOnComplete(Local<Value> answer) {
HandleScope scope; HandleScope scope;
Local<Value> argv[2] = { Integer::New(0), answer }; Local<Value> argv[2] = { Integer::New(0, node_isolate), answer };
MakeCallback(object_, oncomplete_sym, ARRAY_SIZE(argv), argv); MakeCallback(object_, oncomplete_sym, ARRAY_SIZE(argv), argv);
} }
void CallOnComplete(Local<Value> answer, Local<Value> family) { void CallOnComplete(Local<Value> answer, Local<Value> family) {
HandleScope scope; HandleScope scope;
Local<Value> argv[3] = { Integer::New(0), answer, family }; Local<Value> argv[3] = { Integer::New(0, node_isolate), answer, family };
MakeCallback(object_, oncomplete_sym, ARRAY_SIZE(argv), argv); MakeCallback(object_, oncomplete_sym, ARRAY_SIZE(argv), argv);
} }
@@ -352,7 +352,7 @@ class QueryWrap {
SetAresErrno(status); SetAresErrno(status);
HandleScope scope; HandleScope scope;
Local<Value> argv[1] = { Integer::New(-1) }; Local<Value> argv[1] = { Integer::New(-1, node_isolate) };
MakeCallback(object_, oncomplete_sym, ARRAY_SIZE(argv), argv); MakeCallback(object_, oncomplete_sym, ARRAY_SIZE(argv), argv);
} }
@@ -491,8 +491,9 @@ class QueryMxWrap: public QueryWrap {
mx_current = mx_current->next) { mx_current = mx_current->next) {
Local<Object> mx_record = Object::New(); Local<Object> mx_record = Object::New();
mx_record->Set(exchange_symbol, String::New(mx_current->host)); mx_record->Set(exchange_symbol, String::New(mx_current->host));
mx_record->Set(priority_symbol, Integer::New(mx_current->priority)); mx_record->Set(priority_symbol,
mx_records->Set(Integer::New(i++), mx_record); Integer::New(mx_current->priority, node_isolate));
mx_records->Set(Integer::New(i++, node_isolate), mx_record);
} }
ares_free_data(mx_start); ares_free_data(mx_start);
@@ -549,7 +550,7 @@ class QueryTxtWrap: public QueryWrap {
struct ares_txt_reply *current = txt_out; struct ares_txt_reply *current = txt_out;
for (int i = 0; current; ++i, current = current->next) { for (int i = 0; current; ++i, current = current->next) {
Local<String> txt = String::New(reinterpret_cast<char*>(current->txt)); Local<String> txt = String::New(reinterpret_cast<char*>(current->txt));
txt_records->Set(Integer::New(i), txt); txt_records->Set(Integer::New(i, node_isolate), txt);
} }
ares_free_data(txt_out); ares_free_data(txt_out);
@@ -593,10 +594,13 @@ class QuerySrvWrap: public QueryWrap {
srv_current = srv_current->next) { srv_current = srv_current->next) {
Local<Object> srv_record = Object::New(); Local<Object> srv_record = Object::New();
srv_record->Set(name_symbol, String::New(srv_current->host)); srv_record->Set(name_symbol, String::New(srv_current->host));
srv_record->Set(port_symbol, Integer::New(srv_current->port)); srv_record->Set(port_symbol,
srv_record->Set(priority_symbol, Integer::New(srv_current->priority)); Integer::New(srv_current->port, node_isolate));
srv_record->Set(weight_symbol, Integer::New(srv_current->weight)); srv_record->Set(priority_symbol,
srv_records->Set(Integer::New(i++), srv_record); Integer::New(srv_current->priority, node_isolate));
srv_record->Set(weight_symbol,
Integer::New(srv_current->weight, node_isolate));
srv_records->Set(Integer::New(i++, node_isolate), srv_record);
} }
ares_free_data(srv_start); ares_free_data(srv_start);
@@ -652,7 +656,7 @@ class GetHostByNameWrap: public QueryWrap {
HandleScope scope; HandleScope scope;
Local<Array> addresses = HostentToAddresses(host); Local<Array> addresses = HostentToAddresses(host);
Local<Integer> family = Integer::New(host->h_addrtype); Local<Integer> family = Integer::New(host->h_addrtype, node_isolate);
this->CallOnComplete(addresses, family); this->CallOnComplete(addresses, family);
} }
@@ -820,14 +824,14 @@ static Handle<Value> IsIP(const Arguments& args) {
char address_buffer[sizeof(struct in6_addr)]; char address_buffer[sizeof(struct in6_addr)];
if (uv_inet_pton(AF_INET, *ip, &address_buffer).code == UV_OK) { if (uv_inet_pton(AF_INET, *ip, &address_buffer).code == UV_OK) {
return scope.Close(v8::Integer::New(4)); return scope.Close(v8::Integer::New(4, node_isolate));
} }
if (uv_inet_pton(AF_INET6, *ip, &address_buffer).code == UV_OK) { if (uv_inet_pton(AF_INET6, *ip, &address_buffer).code == UV_OK) {
return scope.Close(v8::Integer::New(6)); return scope.Close(v8::Integer::New(6, node_isolate));
} }
return scope.Close(v8::Integer::New(0)); return scope.Close(v8::Integer::New(0, node_isolate));
} }
@@ -906,9 +910,12 @@ static void Initialize(Handle<Object> target) {
NODE_SET_METHOD(target, "getaddrinfo", GetAddrInfo); NODE_SET_METHOD(target, "getaddrinfo", GetAddrInfo);
NODE_SET_METHOD(target, "isIP", IsIP); NODE_SET_METHOD(target, "isIP", IsIP);
target->Set(String::NewSymbol("AF_INET"), Integer::New(AF_INET)); target->Set(String::NewSymbol("AF_INET"),
target->Set(String::NewSymbol("AF_INET6"), Integer::New(AF_INET6)); Integer::New(AF_INET, node_isolate));
target->Set(String::NewSymbol("AF_UNSPEC"), Integer::New(AF_UNSPEC)); target->Set(String::NewSymbol("AF_INET6"),
Integer::New(AF_INET6, node_isolate));
target->Set(String::NewSymbol("AF_UNSPEC"),
Integer::New(AF_UNSPEC, node_isolate));
oncomplete_sym = NODE_PSYMBOL("oncomplete"); oncomplete_sym = NODE_PSYMBOL("oncomplete");
} }
+2 -2
View File
@@ -110,7 +110,7 @@ Handle<Value> FSEventWrap::Start(const Arguments& args) {
SetErrno(uv_last_error(uv_default_loop())); SetErrno(uv_last_error(uv_default_loop()));
} }
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
@@ -150,7 +150,7 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename,
} }
Local<Value> argv[3] = { Local<Value> argv[3] = {
Integer::New(status), Integer::New(status, node_isolate),
eventStr, eventStr,
filename ? (Local<Value>)String::New(filename) : Local<Value>::New(v8::Null()) filename ? (Local<Value>)String::New(filename) : Local<Value>::New(v8::Null())
}; };
+25 -22
View File
@@ -720,7 +720,7 @@ Local<Value> ErrnoException(int errorno,
Local<Object> obj = e->ToObject(); Local<Object> obj = e->ToObject();
obj->Set(errno_symbol, Integer::New(errorno)); obj->Set(errno_symbol, Integer::New(errorno, node_isolate));
obj->Set(code_symbol, estring); obj->Set(code_symbol, estring);
if (path) obj->Set(errpath_symbol, String::New(path)); if (path) obj->Set(errpath_symbol, String::New(path));
if (syscall) obj->Set(syscall_symbol, String::NewSymbol(syscall)); if (syscall) obj->Set(syscall_symbol, String::NewSymbol(syscall));
@@ -792,7 +792,7 @@ Local<Value> UVException(int errorno,
Local<Object> obj = e->ToObject(); Local<Object> obj = e->ToObject();
// TODO errno should probably go // TODO errno should probably go
obj->Set(errno_symbol, Integer::New(errorno)); obj->Set(errno_symbol, Integer::New(errorno, node_isolate));
obj->Set(code_symbol, estring); obj->Set(code_symbol, estring);
if (path) obj->Set(errpath_symbol, path_str); if (path) obj->Set(errpath_symbol, path_str);
if (syscall) obj->Set(syscall_symbol, String::NewSymbol(syscall)); if (syscall) obj->Set(syscall_symbol, String::NewSymbol(syscall));
@@ -853,7 +853,7 @@ Local<Value> WinapiErrnoException(int errorno,
Local<Object> obj = e->ToObject(); Local<Object> obj = e->ToObject();
obj->Set(errno_symbol, Integer::New(errorno)); obj->Set(errno_symbol, Integer::New(errorno, node_isolate));
if (path) obj->Set(errpath_symbol, String::New(path)); if (path) obj->Set(errpath_symbol, String::New(path));
if (syscall) obj->Set(syscall_symbol, String::NewSymbol(syscall)); if (syscall) obj->Set(syscall_symbol, String::NewSymbol(syscall));
return e; return e;
@@ -944,7 +944,7 @@ MakeCallback(const Handle<Object> object,
Local<Array> argArray = Array::New(argc); Local<Array> argArray = Array::New(argc);
for (int i = 0; i < argc; i++) { for (int i = 0; i < argc; i++) {
argArray->Set(Integer::New(i), argv[i]); argArray->Set(Integer::New(i, node_isolate), argv[i]);
} }
Local<Value> object_l = Local<Value>::New(object); Local<Value> object_l = Local<Value>::New(object);
@@ -1501,14 +1501,14 @@ static gid_t gid_by_name(Handle<Value> value) {
static Handle<Value> GetUid(const Arguments& args) { static Handle<Value> GetUid(const Arguments& args) {
HandleScope scope; HandleScope scope;
int uid = getuid(); int uid = getuid();
return scope.Close(Integer::New(uid)); return scope.Close(Integer::New(uid, node_isolate));
} }
static Handle<Value> GetGid(const Arguments& args) { static Handle<Value> GetGid(const Arguments& args) {
HandleScope scope; HandleScope scope;
int gid = getgid(); int gid = getgid();
return scope.Close(Integer::New(gid)); return scope.Close(Integer::New(gid, node_isolate));
} }
@@ -1577,14 +1577,14 @@ static Handle<Value> GetGroups(const Arguments& args) {
gid_t egid = getegid(); gid_t egid = getegid();
for (int i = 0; i < ngroups; i++) { for (int i = 0; i < ngroups; i++) {
groups_list->Set(i, Integer::New(groups[i])); groups_list->Set(i, Integer::New(groups[i], node_isolate));
if (groups[i] == egid) seen_egid = true; if (groups[i] == egid) seen_egid = true;
} }
delete[] groups; delete[] groups;
if (seen_egid == false) { if (seen_egid == false) {
groups_list->Set(ngroups, Integer::New(egid)); groups_list->Set(ngroups, Integer::New(egid, node_isolate));
} }
return scope.Close(groups_list); return scope.Close(groups_list);
@@ -1721,9 +1721,11 @@ v8::Handle<v8::Value> MemoryUsage(const v8::Arguments& args) {
HeapStatistics v8_heap_stats; HeapStatistics v8_heap_stats;
V8::GetHeapStatistics(&v8_heap_stats); V8::GetHeapStatistics(&v8_heap_stats);
info->Set(heap_total_symbol, info->Set(heap_total_symbol,
Integer::NewFromUnsigned(v8_heap_stats.total_heap_size())); Integer::NewFromUnsigned(v8_heap_stats.total_heap_size(),
node_isolate));
info->Set(heap_used_symbol, info->Set(heap_used_symbol,
Integer::NewFromUnsigned(v8_heap_stats.used_heap_size())); Integer::NewFromUnsigned(v8_heap_stats.used_heap_size(),
node_isolate));
return scope.Close(info); return scope.Close(info);
} }
@@ -1742,7 +1744,7 @@ Handle<Value> Kill(const Arguments& args) {
if (err.code != UV_OK) { if (err.code != UV_OK) {
SetErrno(err); SetErrno(err);
return scope.Close(Integer::New(-1)); return scope.Close(Integer::New(-1, node_isolate));
} }
return Undefined(); return Undefined();
@@ -1775,8 +1777,8 @@ Handle<Value> Hrtime(const v8::Arguments& args) {
} }
Local<Array> tuple = Array::New(2); Local<Array> tuple = Array::New(2);
tuple->Set(0, Integer::NewFromUnsigned(t / NANOS_PER_SEC)); tuple->Set(0, Integer::NewFromUnsigned(t / NANOS_PER_SEC, node_isolate));
tuple->Set(1, Integer::NewFromUnsigned(t % NANOS_PER_SEC)); tuple->Set(1, Integer::NewFromUnsigned(t % NANOS_PER_SEC, node_isolate));
return scope.Close(tuple); return scope.Close(tuple);
} }
@@ -2048,7 +2050,7 @@ static Handle<Integer> EnvQuery(Local<String> property,
#ifdef __POSIX__ #ifdef __POSIX__
String::Utf8Value key(property); String::Utf8Value key(property);
if (getenv(*key)) { if (getenv(*key)) {
return scope.Close(Integer::New(None)); return scope.Close(Integer::New(0, node_isolate));
} }
#else // _WIN32 #else // _WIN32
String::Value key(property); String::Value key(property);
@@ -2059,9 +2061,10 @@ static Handle<Integer> EnvQuery(Local<String> property,
// Environment variables that start with '=' are hidden and read-only. // Environment variables that start with '=' are hidden and read-only.
return scope.Close(Integer::New(v8::ReadOnly || return scope.Close(Integer::New(v8::ReadOnly ||
v8::DontDelete || v8::DontDelete ||
v8::DontEnum)); v8::DontEnum,
node_isolate));
} else { } else {
return scope.Close(Integer::New(None)); return scope.Close(Integer::New(0, node_isolate));
} }
} }
#endif #endif
@@ -2163,7 +2166,7 @@ static Handle<Object> GetFeatures() {
static Handle<Value> DebugPortGetter(Local<String> property, static Handle<Value> DebugPortGetter(Local<String> property,
const AccessorInfo& info) { const AccessorInfo& info) {
HandleScope scope; HandleScope scope;
return scope.Close(Integer::NewFromUnsigned(debug_port)); return scope.Close(Integer::NewFromUnsigned(debug_port, node_isolate));
} }
@@ -2242,10 +2245,10 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
// process.argv // process.argv
Local<Array> arguments = Array::New(argc - option_end_index + 1); Local<Array> arguments = Array::New(argc - option_end_index + 1);
arguments->Set(Integer::New(0), String::New(argv[0])); arguments->Set(Integer::New(0, node_isolate), String::New(argv[0]));
for (j = 1, i = option_end_index; i < argc; j++, i++) { for (j = 1, i = option_end_index; i < argc; j++, i++) {
Local<String> arg = String::New(argv[i]); Local<String> arg = String::New(argv[i]);
arguments->Set(Integer::New(j), arg); arguments->Set(Integer::New(j, node_isolate), arg);
} }
// assign it // assign it
process->Set(String::NewSymbol("argv"), arguments); process->Set(String::NewSymbol("argv"), arguments);
@@ -2253,7 +2256,7 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
// process.execArgv // process.execArgv
Local<Array> execArgv = Array::New(option_end_index - 1); Local<Array> execArgv = Array::New(option_end_index - 1);
for (j = 1, i = 0; j < option_end_index; j++, i++) { for (j = 1, i = 0; j < option_end_index; j++, i++) {
execArgv->Set(Integer::New(i), String::New(argv[j])); execArgv->Set(Integer::New(i, node_isolate), String::New(argv[j]));
} }
// assign it // assign it
process->Set(String::NewSymbol("execArgv"), execArgv); process->Set(String::NewSymbol("execArgv"), execArgv);
@@ -2270,7 +2273,7 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
Local<Object> env = envTemplate->NewInstance(); Local<Object> env = envTemplate->NewInstance();
process->Set(String::NewSymbol("env"), env); process->Set(String::NewSymbol("env"), env);
process->Set(String::NewSymbol("pid"), Integer::New(getpid())); process->Set(String::NewSymbol("pid"), Integer::New(getpid(), node_isolate));
process->Set(String::NewSymbol("features"), GetFeatures()); process->Set(String::NewSymbol("features"), GetFeatures());
// -e, --eval // -e, --eval
@@ -2912,7 +2915,7 @@ void EmitExit(v8::Handle<v8::Object> process_l) {
Local<Value> emit_v = process_l->Get(String::New("emit")); Local<Value> emit_v = process_l->Get(String::New("emit"));
assert(emit_v->IsFunction()); assert(emit_v->IsFunction());
Local<Function> emit = Local<Function>::Cast(emit_v); Local<Function> emit = Local<Function>::Cast(emit_v);
Local<Value> args[] = { String::New("exit"), Integer::New(0) }; Local<Value> args[] = { String::New("exit"), Integer::New(0, node_isolate) };
TryCatch try_catch; TryCatch try_catch;
emit->Call(process_l, 2, args); emit->Call(process_l, 2, args);
if (try_catch.HasCaught()) { if (try_catch.HasCaught()) {
+21 -19
View File
@@ -126,7 +126,7 @@ Handle<Object> Buffer::New(Handle<String> string) {
Buffer* Buffer::New(size_t length) { Buffer* Buffer::New(size_t length) {
HandleScope scope; HandleScope scope;
Local<Value> arg = Integer::NewFromUnsigned(length); Local<Value> arg = Integer::NewFromUnsigned(length, node_isolate);
Local<Object> b = constructor_template->GetFunction()->NewInstance(1, &arg); Local<Object> b = constructor_template->GetFunction()->NewInstance(1, &arg);
if (b.IsEmpty()) return NULL; if (b.IsEmpty()) return NULL;
@@ -137,7 +137,7 @@ Buffer* Buffer::New(size_t length) {
Buffer* Buffer::New(const char* data, size_t length) { Buffer* Buffer::New(const char* data, size_t length) {
HandleScope scope; HandleScope scope;
Local<Value> arg = Integer::NewFromUnsigned(0); Local<Value> arg = Integer::NewFromUnsigned(0, node_isolate);
Local<Object> obj = constructor_template->GetFunction()->NewInstance(1, &arg); Local<Object> obj = constructor_template->GetFunction()->NewInstance(1, &arg);
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(obj); Buffer *buffer = ObjectWrap::Unwrap<Buffer>(obj);
@@ -151,7 +151,7 @@ Buffer* Buffer::New(char *data, size_t length,
free_callback callback, void *hint) { free_callback callback, void *hint) {
HandleScope scope; HandleScope scope;
Local<Value> arg = Integer::NewFromUnsigned(0); Local<Value> arg = Integer::NewFromUnsigned(0, node_isolate);
Local<Object> obj = constructor_template->GetFunction()->NewInstance(1, &arg); Local<Object> obj = constructor_template->GetFunction()->NewInstance(1, &arg);
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(obj); Buffer *buffer = ObjectWrap::Unwrap<Buffer>(obj);
@@ -228,7 +228,7 @@ void Buffer::Replace(char *data, size_t length,
handle_->SetIndexedPropertiesToExternalArrayData(data_, handle_->SetIndexedPropertiesToExternalArrayData(data_,
kExternalUnsignedByteArray, kExternalUnsignedByteArray,
length_); length_);
handle_->Set(length_symbol, Integer::NewFromUnsigned(length_)); handle_->Set(length_symbol, Integer::NewFromUnsigned(length_, node_isolate));
} }
@@ -414,7 +414,7 @@ Handle<Value> Buffer::Copy(const Arguments &args) {
// Copy 0 bytes; we're done // Copy 0 bytes; we're done
if (source_end == source_start) { if (source_end == source_start) {
return scope.Close(Integer::New(0)); return scope.Close(Integer::New(0, node_isolate));
} }
if (target_start >= target_length) { if (target_start >= target_length) {
@@ -441,7 +441,7 @@ Handle<Value> Buffer::Copy(const Arguments &args) {
(const void*)(source->data_ + source_start), (const void*)(source->data_ + source_start),
to_copy); to_copy);
return scope.Close(Integer::New(to_copy)); return scope.Close(Integer::New(to_copy, node_isolate));
} }
@@ -463,8 +463,8 @@ Handle<Value> Buffer::Utf8Write(const Arguments &args) {
if (length == 0) { if (length == 0) {
constructor_template->GetFunction()->Set(chars_written_sym, constructor_template->GetFunction()->Set(chars_written_sym,
Integer::New(0)); Integer::New(0, node_isolate));
return scope.Close(Integer::New(0)); return scope.Close(Integer::New(0, node_isolate));
} }
if (length > 0 && offset >= buffer->length_) { if (length > 0 && offset >= buffer->length_) {
@@ -487,9 +487,10 @@ Handle<Value> Buffer::Utf8Write(const Arguments &args) {
String::NO_NULL_TERMINATION)); String::NO_NULL_TERMINATION));
constructor_template->GetFunction()->Set(chars_written_sym, constructor_template->GetFunction()->Set(chars_written_sym,
Integer::New(char_written)); Integer::New(char_written,
node_isolate));
return scope.Close(Integer::New(written)); return scope.Close(Integer::New(written, node_isolate));
} }
@@ -525,9 +526,9 @@ Handle<Value> Buffer::Ucs2Write(const Arguments &args) {
String::NO_NULL_TERMINATION)); String::NO_NULL_TERMINATION));
constructor_template->GetFunction()->Set(chars_written_sym, constructor_template->GetFunction()->Set(chars_written_sym,
Integer::New(written)); Integer::New(written, node_isolate));
return scope.Close(Integer::New(written * 2)); return scope.Close(Integer::New(written * 2, node_isolate));
} }
@@ -564,9 +565,9 @@ Handle<Value> Buffer::AsciiWrite(const Arguments &args) {
String::NO_NULL_TERMINATION)); String::NO_NULL_TERMINATION));
constructor_template->GetFunction()->Set(chars_written_sym, constructor_template->GetFunction()->Set(chars_written_sym,
Integer::New(written)); Integer::New(written, node_isolate));
return scope.Close(Integer::New(written)); return scope.Close(Integer::New(written, node_isolate));
} }
@@ -629,9 +630,10 @@ Handle<Value> Buffer::Base64Write(const Arguments &args) {
} }
constructor_template->GetFunction()->Set(chars_written_sym, constructor_template->GetFunction()->Set(chars_written_sym,
Integer::New(dst - start)); Integer::New(dst - start,
node_isolate));
return scope.Close(Integer::New(dst - start)); return scope.Close(Integer::New(dst - start, node_isolate));
} }
@@ -663,9 +665,9 @@ Handle<Value> Buffer::BinaryWrite(const Arguments &args) {
int written = DecodeWrite(p, max_length, s, BINARY); int written = DecodeWrite(p, max_length, s, BINARY);
constructor_template->GetFunction()->Set(chars_written_sym, constructor_template->GetFunction()->Set(chars_written_sym,
Integer::New(written)); Integer::New(written, node_isolate));
return scope.Close(Integer::New(written)); return scope.Close(Integer::New(written, node_isolate));
} }
@@ -681,7 +683,7 @@ Handle<Value> Buffer::ByteLength(const Arguments &args) {
Local<String> s = args[0]->ToString(); Local<String> s = args[0]->ToString();
enum encoding e = ParseEncoding(args[1], UTF8); enum encoding e = ParseEncoding(args[1], UTF8);
return scope.Close(Integer::New(node::ByteLength(s, e))); return scope.Close(Integer::New(node::ByteLength(s, e), node_isolate));
} }
+12 -12
View File
@@ -1308,7 +1308,7 @@ Handle<Value> Connection::EncIn(const Arguments& args) {
ss->SetShutdownFlags(); ss->SetShutdownFlags();
} }
return scope.Close(Integer::New(bytes_written)); return scope.Close(Integer::New(bytes_written, node_isolate));
} }
@@ -1353,14 +1353,14 @@ Handle<Value> Connection::ClearOut(const Arguments& args) {
ss->HandleSSLError("SSL_connect:ClearOut", rv, kZeroIsAnError); ss->HandleSSLError("SSL_connect:ClearOut", rv, kZeroIsAnError);
} }
if (rv < 0) return scope.Close(Integer::New(rv)); if (rv < 0) return scope.Close(Integer::New(rv, node_isolate));
} }
int bytes_read = SSL_read(ss->ssl_, buffer_data + off, len); int bytes_read = SSL_read(ss->ssl_, buffer_data + off, len);
ss->HandleSSLError("SSL_read:ClearOut", bytes_read, kZeroIsNotAnError); ss->HandleSSLError("SSL_read:ClearOut", bytes_read, kZeroIsNotAnError);
ss->SetShutdownFlags(); ss->SetShutdownFlags();
return scope.Close(Integer::New(bytes_read)); return scope.Close(Integer::New(bytes_read, node_isolate));
} }
@@ -1370,7 +1370,7 @@ Handle<Value> Connection::ClearPending(const Arguments& args) {
Connection *ss = Connection::Unwrap(args); Connection *ss = Connection::Unwrap(args);
int bytes_pending = BIO_pending(ss->bio_read_); int bytes_pending = BIO_pending(ss->bio_read_);
return scope.Close(Integer::New(bytes_pending)); return scope.Close(Integer::New(bytes_pending, node_isolate));
} }
@@ -1380,7 +1380,7 @@ Handle<Value> Connection::EncPending(const Arguments& args) {
Connection *ss = Connection::Unwrap(args); Connection *ss = Connection::Unwrap(args);
int bytes_pending = BIO_pending(ss->bio_write_); int bytes_pending = BIO_pending(ss->bio_write_);
return scope.Close(Integer::New(bytes_pending)); return scope.Close(Integer::New(bytes_pending, node_isolate));
} }
@@ -1419,7 +1419,7 @@ Handle<Value> Connection::EncOut(const Arguments& args) {
ss->HandleBIOError(ss->bio_write_, "BIO_read:EncOut", bytes_read); ss->HandleBIOError(ss->bio_write_, "BIO_read:EncOut", bytes_read);
ss->SetShutdownFlags(); ss->SetShutdownFlags();
return scope.Close(Integer::New(bytes_read)); return scope.Close(Integer::New(bytes_read, node_isolate));
} }
@@ -1463,7 +1463,7 @@ Handle<Value> Connection::ClearIn(const Arguments& args) {
ss->HandleSSLError("SSL_connect:ClearIn", rv, kZeroIsAnError); ss->HandleSSLError("SSL_connect:ClearIn", rv, kZeroIsAnError);
} }
if (rv < 0) return scope.Close(Integer::New(rv)); if (rv < 0) return scope.Close(Integer::New(rv, node_isolate));
} }
int bytes_written = SSL_write(ss->ssl_, buffer_data + off, len); int bytes_written = SSL_write(ss->ssl_, buffer_data + off, len);
@@ -1471,7 +1471,7 @@ Handle<Value> Connection::ClearIn(const Arguments& args) {
ss->HandleSSLError("SSL_write:ClearIn", bytes_written, kZeroIsAnError); ss->HandleSSLError("SSL_write:ClearIn", bytes_written, kZeroIsAnError);
ss->SetShutdownFlags(); ss->SetShutdownFlags();
return scope.Close(Integer::New(bytes_written)); return scope.Close(Integer::New(bytes_written, node_isolate));
} }
@@ -1582,7 +1582,7 @@ Handle<Value> Connection::GetPeerCertificate(const Arguments& args) {
for (int i = 0; i < sk_ASN1_OBJECT_num(eku); i++) { for (int i = 0; i < sk_ASN1_OBJECT_num(eku); i++) {
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
OBJ_obj2txt(buf, sizeof(buf) - 1, sk_ASN1_OBJECT_value(eku, i), 1); OBJ_obj2txt(buf, sizeof(buf) - 1, sk_ASN1_OBJECT_value(eku, i), 1);
ext_key_usage->Set(Integer::New(i), String::New(buf)); ext_key_usage->Set(Integer::New(i, node_isolate), String::New(buf));
} }
sk_ASN1_OBJECT_pop_free(eku, ASN1_OBJECT_free); sk_ASN1_OBJECT_pop_free(eku, ASN1_OBJECT_free);
@@ -1711,10 +1711,10 @@ Handle<Value> Connection::Start(const Arguments& args) {
ss->HandleSSLError("SSL_connect:Start", rv, kZeroIsAnError); ss->HandleSSLError("SSL_connect:Start", rv, kZeroIsAnError);
} }
return scope.Close(Integer::New(rv)); return scope.Close(Integer::New(rv, node_isolate));
} }
return scope.Close(Integer::New(0)); return scope.Close(Integer::New(0, node_isolate));
} }
@@ -1728,7 +1728,7 @@ Handle<Value> Connection::Shutdown(const Arguments& args) {
ss->HandleSSLError("SSL_shutdown", rv, kZeroIsNotAnError); ss->HandleSSLError("SSL_shutdown", rv, kZeroIsNotAnError);
ss->SetShutdownFlags(); ss->SetShutdownFlags();
return scope.Close(Integer::New(rv)); return scope.Close(Integer::New(rv, node_isolate));
} }
+9 -9
View File
@@ -144,11 +144,11 @@ static void After(uv_fs_t *req) {
break; break;
case UV_FS_OPEN: case UV_FS_OPEN:
argv[1] = Integer::New(req->result); argv[1] = Integer::New(req->result, node_isolate);
break; break;
case UV_FS_WRITE: case UV_FS_WRITE:
argv[1] = Integer::New(req->result); argv[1] = Integer::New(req->result, node_isolate);
break; break;
case UV_FS_STAT: case UV_FS_STAT:
@@ -163,7 +163,7 @@ static void After(uv_fs_t *req) {
case UV_FS_READ: case UV_FS_READ:
// Buffer interface // Buffer interface
argv[1] = Integer::New(req->result); argv[1] = Integer::New(req->result, node_isolate);
break; break;
case UV_FS_READDIR: case UV_FS_READDIR:
@@ -175,7 +175,7 @@ static void After(uv_fs_t *req) {
for (int i = 0; i < nnames; i++) { for (int i = 0; i < nnames; i++) {
Local<String> name = String::New(namebuf); Local<String> name = String::New(namebuf);
names->Set(Integer::New(i), name); names->Set(Integer::New(i, node_isolate), name);
#ifndef NDEBUG #ifndef NDEBUG
namebuf += strlen(namebuf); namebuf += strlen(namebuf);
assert(*namebuf == '\0'); assert(*namebuf == '\0');
@@ -314,7 +314,7 @@ Local<Object> BuildStatsObject(const uv_statbuf_t* s) {
// and make sure that we bail out when V8 returns an empty handle. // and make sure that we bail out when V8 returns an empty handle.
#define X(name) \ #define X(name) \
{ \ { \
Local<Value> val = Integer::New(s->st_##name); \ Local<Value> val = Integer::New(s->st_##name, node_isolate); \
if (val.IsEmpty()) return Local<Object>(); \ if (val.IsEmpty()) return Local<Object>(); \
stats->Set(name##_symbol, val); \ stats->Set(name##_symbol, val); \
} }
@@ -620,7 +620,7 @@ static Handle<Value> ReadDir(const Arguments& args) {
for (int i = 0; i < nnames; i++) { for (int i = 0; i < nnames; i++) {
Local<String> name = String::New(namebuf); Local<String> name = String::New(namebuf);
names->Set(Integer::New(i), name); names->Set(Integer::New(i, node_isolate), name);
#ifndef NDEBUG #ifndef NDEBUG
namebuf += strlen(namebuf); namebuf += strlen(namebuf);
assert(*namebuf == '\0'); assert(*namebuf == '\0');
@@ -654,7 +654,7 @@ static Handle<Value> Open(const Arguments& args) {
} else { } else {
SYNC_CALL(open, *path, *path, flags, mode) SYNC_CALL(open, *path, *path, flags, mode)
int fd = SYNC_RESULT; int fd = SYNC_RESULT;
return scope.Close(Integer::New(fd)); return scope.Close(Integer::New(fd, node_isolate));
} }
} }
@@ -707,7 +707,7 @@ static Handle<Value> Write(const Arguments& args) {
ASYNC_CALL(write, cb, fd, buf, len, pos) ASYNC_CALL(write, cb, fd, buf, len, pos)
} else { } else {
SYNC_CALL(write, 0, fd, buf, len, pos) SYNC_CALL(write, 0, fd, buf, len, pos)
return scope.Close(Integer::New(SYNC_RESULT)); return scope.Close(Integer::New(SYNC_RESULT, node_isolate));
} }
} }
@@ -770,7 +770,7 @@ static Handle<Value> Read(const Arguments& args) {
ASYNC_CALL(read, cb, fd, buf, len, pos); ASYNC_CALL(read, cb, fd, buf, len, pos);
} else { } else {
SYNC_CALL(read, 0, fd, buf, len, pos) SYNC_CALL(read, 0, fd, buf, len, pos)
Local<Integer> bytesRead = Integer::New(SYNC_RESULT); Local<Integer> bytesRead = Integer::New(SYNC_RESULT, node_isolate);
return scope.Close(bytesRead); return scope.Close(bytesRead);
} }
} }
+16 -9
View File
@@ -269,12 +269,15 @@ public:
// STATUS // STATUS
if (parser_.type == HTTP_RESPONSE) { if (parser_.type == HTTP_RESPONSE) {
message_info->Set(status_code_sym, Integer::New(parser_.status_code)); message_info->Set(status_code_sym,
Integer::New(parser_.status_code, node_isolate));
} }
// VERSION // VERSION
message_info->Set(version_major_sym, Integer::New(parser_.http_major)); message_info->Set(version_major_sym,
message_info->Set(version_minor_sym, Integer::New(parser_.http_minor)); Integer::New(parser_.http_major, node_isolate));
message_info->Set(version_minor_sym,
Integer::New(parser_.http_minor, node_isolate));
message_info->Set(should_keep_alive_sym, message_info->Set(should_keep_alive_sym,
http_should_keep_alive(&parser_) ? True() : False()); http_should_keep_alive(&parser_) ? True() : False());
@@ -304,8 +307,8 @@ public:
Local<Value> argv[3] = { Local<Value> argv[3] = {
*current_buffer, *current_buffer,
Integer::New(at - current_buffer_data), Integer::New(at - current_buffer_data, node_isolate),
Integer::New(length) Integer::New(length, node_isolate)
}; };
Local<Value> r = Local<Function>::Cast(cb)->Call(handle_, 3, argv); Local<Value> r = Local<Function>::Cast(cb)->Call(handle_, 3, argv);
@@ -428,7 +431,7 @@ public:
// If there was an exception in one of the callbacks // If there was an exception in one of the callbacks
if (parser->got_exception_) return Local<Value>(); if (parser->got_exception_) return Local<Value>();
Local<Integer> nparsed_obj = Integer::New(nparsed); Local<Integer> nparsed_obj = Integer::New(nparsed, node_isolate);
// If there was a parse error in one of the callbacks // If there was a parse error in one of the callbacks
// TODO What if there is an error on EOF? // TODO What if there is an error on EOF?
if (!parser->parser_.upgrade && nparsed != len) { if (!parser->parser_.upgrade && nparsed != len) {
@@ -462,7 +465,7 @@ public:
Local<Value> e = Exception::Error(String::NewSymbol("Parse Error")); Local<Value> e = Exception::Error(String::NewSymbol("Parse Error"));
Local<Object> obj = e->ToObject(); Local<Object> obj = e->ToObject();
obj->Set(String::NewSymbol("bytesParsed"), Integer::New(0)); obj->Set(String::NewSymbol("bytesParsed"), Integer::New(0, node_isolate));
obj->Set(String::NewSymbol("code"), String::New(http_errno_name(err))); obj->Set(String::NewSymbol("code"), String::New(http_errno_name(err)));
return scope.Close(e); return scope.Close(e);
} }
@@ -558,8 +561,12 @@ void InitHttpParser(Handle<Object> target) {
t->SetClassName(String::NewSymbol("HTTPParser")); t->SetClassName(String::NewSymbol("HTTPParser"));
PropertyAttribute attrib = (PropertyAttribute) (ReadOnly | DontDelete); PropertyAttribute attrib = (PropertyAttribute) (ReadOnly | DontDelete);
t->Set(String::NewSymbol("REQUEST"), Integer::New(HTTP_REQUEST), attrib); t->Set(String::NewSymbol("REQUEST"),
t->Set(String::NewSymbol("RESPONSE"), Integer::New(HTTP_RESPONSE), attrib); Integer::New(HTTP_REQUEST, node_isolate),
attrib);
t->Set(String::NewSymbol("RESPONSE"),
Integer::New(HTTP_RESPONSE, node_isolate),
attrib);
NODE_SET_PROTOTYPE_METHOD(t, "execute", Parser::Execute); NODE_SET_PROTOTYPE_METHOD(t, "execute", Parser::Execute);
NODE_SET_PROTOTYPE_METHOD(t, "finish", Parser::Finish); NODE_SET_PROTOTYPE_METHOD(t, "finish", Parser::Finish);
+7 -6
View File
@@ -124,19 +124,20 @@ static Handle<Value> GetCPUInfo(const Arguments& args) {
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
Local<Object> times_info = Object::New(); Local<Object> times_info = Object::New();
times_info->Set(String::New("user"), times_info->Set(String::New("user"),
Integer::New(cpu_infos[i].cpu_times.user)); Integer::New(cpu_infos[i].cpu_times.user, node_isolate));
times_info->Set(String::New("nice"), times_info->Set(String::New("nice"),
Integer::New(cpu_infos[i].cpu_times.nice)); Integer::New(cpu_infos[i].cpu_times.nice, node_isolate));
times_info->Set(String::New("sys"), times_info->Set(String::New("sys"),
Integer::New(cpu_infos[i].cpu_times.sys)); Integer::New(cpu_infos[i].cpu_times.sys, node_isolate));
times_info->Set(String::New("idle"), times_info->Set(String::New("idle"),
Integer::New(cpu_infos[i].cpu_times.idle)); Integer::New(cpu_infos[i].cpu_times.idle, node_isolate));
times_info->Set(String::New("irq"), times_info->Set(String::New("irq"),
Integer::New(cpu_infos[i].cpu_times.irq)); Integer::New(cpu_infos[i].cpu_times.irq, node_isolate));
Local<Object> cpu_info = Object::New(); Local<Object> cpu_info = Object::New();
cpu_info->Set(String::New("model"), String::New(cpu_infos[i].model)); cpu_info->Set(String::New("model"), String::New(cpu_infos[i].model));
cpu_info->Set(String::New("speed"), Integer::New(cpu_infos[i].speed)); cpu_info->Set(String::New("speed"),
Integer::New(cpu_infos[i].speed, node_isolate));
cpu_info->Set(String::New("times"), times_info); cpu_info->Set(String::New("times"), times_info);
(*cpus)->Set(i,cpu_info); (*cpus)->Set(i,cpu_info);
} }
+1 -1
View File
@@ -79,7 +79,7 @@ void StatWatcher::Callback(uv_fs_poll_t* handle,
Local<Value> argv[3]; Local<Value> argv[3];
argv[0] = BuildStatsObject(curr); argv[0] = BuildStatsObject(curr);
argv[1] = BuildStatsObject(prev); argv[1] = BuildStatsObject(prev);
argv[2] = Integer::New(status); argv[2] = Integer::New(status, node_isolate);
if (status == -1) { if (status == -1) {
SetErrno(uv_last_error(wrap->watcher_->loop)); SetErrno(uv_last_error(wrap->watcher_->loop));
} }
+2 -2
View File
@@ -244,8 +244,8 @@ class ZCtx : public ObjectWrap {
return; return;
} }
Local<Integer> avail_out = Integer::New(ctx->strm_.avail_out); Local<Integer> avail_out = Integer::New(ctx->strm_.avail_out, node_isolate);
Local<Integer> avail_in = Integer::New(ctx->strm_.avail_in); Local<Integer> avail_in = Integer::New(ctx->strm_.avail_in, node_isolate);
ctx->write_in_progress_ = false; ctx->write_in_progress_ = false;
+3 -3
View File
@@ -146,7 +146,7 @@ Handle<Value> PipeWrap::Bind(const Arguments& args) {
// Error starting the pipe. // Error starting the pipe.
if (r) SetErrno(uv_last_error(uv_default_loop())); if (r) SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
@@ -177,7 +177,7 @@ Handle<Value> PipeWrap::Listen(const Arguments& args) {
// Error starting the pipe. // Error starting the pipe.
if (r) SetErrno(uv_last_error(uv_default_loop())); if (r) SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
@@ -238,7 +238,7 @@ void PipeWrap::AfterConnect(uv_connect_t* req, int status) {
} }
Local<Value> argv[5] = { Local<Value> argv[5] = {
Integer::New(status), Integer::New(status, node_isolate),
Local<Value>::New(wrap->object_), Local<Value>::New(wrap->object_),
Local<Value>::New(req_wrap->object_), Local<Value>::New(req_wrap->object_),
Local<Value>::New(Boolean::New(readable)), Local<Value>::New(Boolean::New(readable)),
+5 -4
View File
@@ -250,7 +250,8 @@ class ProcessWrap : public HandleWrap {
else { else {
wrap->SetHandle((uv_handle_t*)&wrap->process_); wrap->SetHandle((uv_handle_t*)&wrap->process_);
assert(wrap->process_.data == wrap); assert(wrap->process_.data == wrap);
wrap->object_->Set(String::New("pid"), Integer::New(wrap->process_.pid)); wrap->object_->Set(String::New("pid"),
Integer::New(wrap->process_.pid, node_isolate));
} }
if (options.args) { if (options.args) {
@@ -265,7 +266,7 @@ class ProcessWrap : public HandleWrap {
delete[] options.stdio; delete[] options.stdio;
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
static Handle<Value> Kill(const Arguments& args) { static Handle<Value> Kill(const Arguments& args) {
@@ -279,7 +280,7 @@ class ProcessWrap : public HandleWrap {
if (r) SetErrno(uv_last_error(uv_default_loop())); if (r) SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
static void OnExit(uv_process_t* handle, int exit_status, int term_signal) { static void OnExit(uv_process_t* handle, int exit_status, int term_signal) {
@@ -290,7 +291,7 @@ class ProcessWrap : public HandleWrap {
assert(&wrap->process_ == handle); assert(&wrap->process_ == handle);
Local<Value> argv[2] = { Local<Value> argv[2] = {
Integer::New(exit_status), Integer::New(exit_status, node_isolate),
String::New(signo_string(term_signal)) String::New(signo_string(term_signal))
}; };
+3 -3
View File
@@ -97,7 +97,7 @@ class SignalWrap : public HandleWrap {
if (r) SetErrno(uv_last_error(uv_default_loop())); if (r) SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
static Handle<Value> Stop(const Arguments& args) { static Handle<Value> Stop(const Arguments& args) {
@@ -109,7 +109,7 @@ class SignalWrap : public HandleWrap {
if (r) SetErrno(uv_last_error(uv_default_loop())); if (r) SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
static void OnSignal(uv_signal_t* handle, int signum) { static void OnSignal(uv_signal_t* handle, int signum) {
@@ -118,7 +118,7 @@ class SignalWrap : public HandleWrap {
SignalWrap* wrap = container_of(handle, SignalWrap, handle_); SignalWrap* wrap = container_of(handle, SignalWrap, handle_);
assert(wrap); assert(wrap);
Local<Value> argv[1] = { Integer::New(signum) }; Local<Value> argv[1] = { Integer::New(signum, node_isolate) };
MakeCallback(wrap->object_, onsignal_sym, ARRAY_SIZE(argv), argv); MakeCallback(wrap->object_, onsignal_sym, ARRAY_SIZE(argv), argv);
} }
+1 -1
View File
@@ -71,7 +71,7 @@ void SlabAllocator::Initialize() {
static Local<Object> NewSlab(unsigned int size) { static Local<Object> NewSlab(unsigned int size) {
HandleScope scope; HandleScope scope;
Local<Value> arg = Integer::NewFromUnsigned(ROUND_UP(size, 16)); Local<Value> arg = Integer::NewFromUnsigned(ROUND_UP(size, 16), node_isolate);
Local<Object> buf = Buffer::constructor_template Local<Object> buf = Buffer::constructor_template
->GetFunction() ->GetFunction()
->NewInstance(1, &arg); ->NewInstance(1, &arg);
+8 -7
View File
@@ -124,7 +124,8 @@ void StreamWrap::SetHandle(uv_handle_t* h) {
void StreamWrap::UpdateWriteQueueSize() { void StreamWrap::UpdateWriteQueueSize() {
HandleScope scope; HandleScope scope;
object_->Set(write_queue_size_sym, Integer::New(stream_->write_queue_size)); object_->Set(write_queue_size_sym,
Integer::New(stream_->write_queue_size, node_isolate));
} }
@@ -145,7 +146,7 @@ Handle<Value> StreamWrap::ReadStart(const Arguments& args) {
// Error starting the tcp. // Error starting the tcp.
if (r) SetErrno(uv_last_error(uv_default_loop())); if (r) SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
@@ -159,7 +160,7 @@ Handle<Value> StreamWrap::ReadStop(const Arguments& args) {
// Error starting the tcp. // Error starting the tcp.
if (r) SetErrno(uv_last_error(uv_default_loop())); if (r) SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
@@ -204,8 +205,8 @@ void StreamWrap::OnReadCommon(uv_stream_t* handle, ssize_t nread,
int argc = 3; int argc = 3;
Local<Value> argv[4] = { Local<Value> argv[4] = {
slab, slab,
Integer::NewFromUnsigned(buf.base - Buffer::Data(slab)), Integer::NewFromUnsigned(buf.base - Buffer::Data(slab), node_isolate),
Integer::NewFromUnsigned(nread) Integer::NewFromUnsigned(nread, node_isolate)
}; };
Local<Object> pending_obj; Local<Object> pending_obj;
@@ -474,7 +475,7 @@ void StreamWrap::AfterWrite(uv_write_t* req, int status) {
wrap->UpdateWriteQueueSize(); wrap->UpdateWriteQueueSize();
Local<Value> argv[] = { Local<Value> argv[] = {
Integer::New(status), Integer::New(status, node_isolate),
Local<Value>::New(wrap->object_), Local<Value>::New(wrap->object_),
Local<Value>::New(req_wrap->object_) Local<Value>::New(req_wrap->object_)
}; };
@@ -522,7 +523,7 @@ void StreamWrap::AfterShutdown(uv_shutdown_t* req, int status) {
} }
Local<Value> argv[3] = { Local<Value> argv[3] = {
Integer::New(status), Integer::New(status, node_isolate),
Local<Value>::New(wrap->object_), Local<Value>::New(wrap->object_),
Local<Value>::New(req_wrap->object_) Local<Value>::New(req_wrap->object_)
}; };
+6 -6
View File
@@ -260,7 +260,7 @@ Handle<Value> TCPWrap::Bind(const Arguments& args) {
// Error starting the tcp. // Error starting the tcp.
if (r) SetErrno(uv_last_error(uv_default_loop())); if (r) SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
@@ -278,7 +278,7 @@ Handle<Value> TCPWrap::Bind6(const Arguments& args) {
// Error starting the tcp. // Error starting the tcp.
if (r) SetErrno(uv_last_error(uv_default_loop())); if (r) SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
@@ -294,7 +294,7 @@ Handle<Value> TCPWrap::Listen(const Arguments& args) {
// Error starting the tcp. // Error starting the tcp.
if (r) SetErrno(uv_last_error(uv_default_loop())); if (r) SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
@@ -347,7 +347,7 @@ void TCPWrap::AfterConnect(uv_connect_t* req, int status) {
} }
Local<Value> argv[5] = { Local<Value> argv[5] = {
Integer::New(status), Integer::New(status, node_isolate),
Local<Value>::New(wrap->object_), Local<Value>::New(wrap->object_),
Local<Value>::New(req_wrap->object_), Local<Value>::New(req_wrap->object_),
Local<Value>::New(v8::True()), Local<Value>::New(v8::True()),
@@ -448,7 +448,7 @@ Local<Object> AddressToJS(const sockaddr* addr) {
port = ntohs(a6->sin6_port); port = ntohs(a6->sin6_port);
info->Set(address_sym, String::New(ip)); info->Set(address_sym, String::New(ip));
info->Set(family_sym, ipv6_sym); info->Set(family_sym, ipv6_sym);
info->Set(port_sym, Integer::New(port)); info->Set(port_sym, Integer::New(port, node_isolate));
break; break;
case AF_INET: case AF_INET:
@@ -457,7 +457,7 @@ Local<Object> AddressToJS(const sockaddr* addr) {
port = ntohs(a4->sin_port); port = ntohs(a4->sin_port);
info->Set(address_sym, String::New(ip)); info->Set(address_sym, String::New(ip));
info->Set(family_sym, ipv4_sym); info->Set(family_sym, ipv4_sym);
info->Set(port_sym, Integer::New(port)); info->Set(port_sym, Integer::New(port, node_isolate));
break; break;
default: default:
+6 -6
View File
@@ -102,7 +102,7 @@ class TimerWrap : public HandleWrap {
if (r) SetErrno(uv_last_error(uv_default_loop())); if (r) SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
static Handle<Value> Stop(const Arguments& args) { static Handle<Value> Stop(const Arguments& args) {
@@ -114,7 +114,7 @@ class TimerWrap : public HandleWrap {
if (r) SetErrno(uv_last_error(uv_default_loop())); if (r) SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
static Handle<Value> Again(const Arguments& args) { static Handle<Value> Again(const Arguments& args) {
@@ -126,7 +126,7 @@ class TimerWrap : public HandleWrap {
if (r) SetErrno(uv_last_error(uv_default_loop())); if (r) SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
static Handle<Value> SetRepeat(const Arguments& args) { static Handle<Value> SetRepeat(const Arguments& args) {
@@ -138,7 +138,7 @@ class TimerWrap : public HandleWrap {
uv_timer_set_repeat(&wrap->handle_, repeat); uv_timer_set_repeat(&wrap->handle_, repeat);
return scope.Close(Integer::New(0)); return scope.Close(Integer::New(0, node_isolate));
} }
static Handle<Value> GetRepeat(const Arguments& args) { static Handle<Value> GetRepeat(const Arguments& args) {
@@ -150,7 +150,7 @@ class TimerWrap : public HandleWrap {
if (repeat < 0) SetErrno(uv_last_error(uv_default_loop())); if (repeat < 0) SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(repeat)); return scope.Close(Integer::New(repeat, node_isolate));
} }
static void OnTimeout(uv_timer_t* handle, int status) { static void OnTimeout(uv_timer_t* handle, int status) {
@@ -159,7 +159,7 @@ class TimerWrap : public HandleWrap {
TimerWrap* wrap = static_cast<TimerWrap*>(handle->data); TimerWrap* wrap = static_cast<TimerWrap*>(handle->data);
assert(wrap); assert(wrap);
Local<Value> argv[1] = { Integer::New(status) }; Local<Value> argv[1] = { Integer::New(status, node_isolate) };
MakeCallback(wrap->object_, ontimeout_sym, ARRAY_SIZE(argv), argv); MakeCallback(wrap->object_, ontimeout_sym, ARRAY_SIZE(argv), argv);
} }
+3 -3
View File
@@ -136,8 +136,8 @@ Handle<Value> TTYWrap::GetWindowSize(const Arguments& args) {
} }
Local<v8::Array> a = v8::Array::New(2); Local<v8::Array> a = v8::Array::New(2);
a->Set(0, Integer::New(width)); a->Set(0, Integer::New(width, node_isolate));
a->Set(1, Integer::New(height)); a->Set(1, Integer::New(height, node_isolate));
return scope.Close(a); return scope.Close(a);
} }
@@ -154,7 +154,7 @@ Handle<Value> TTYWrap::SetRawMode(const Arguments& args) {
SetErrno(uv_last_error(uv_default_loop())); SetErrno(uv_last_error(uv_default_loop()));
} }
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
+8 -8
View File
@@ -140,7 +140,7 @@ Handle<Value> UDPWrap::DoBind(const Arguments& args, int family) {
if (r) if (r)
SetErrno(uv_last_error(uv_default_loop())); SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
@@ -157,12 +157,12 @@ Handle<Value> UDPWrap::Bind6(const Arguments& args) {
#define X(name, fn) \ #define X(name, fn) \
Handle<Value> UDPWrap::name(const Arguments& args) { \ Handle<Value> UDPWrap::name(const Arguments& args) { \
HandleScope scope; \ HandleScope scope; \
UNWRAP(UDPWrap) \ UNWRAP(UDPWrap) \
assert(args.Length() == 1); \ assert(args.Length() == 1); \
int flag = args[0]->Int32Value(); \ int flag = args[0]->Int32Value(); \
int r = fn(&wrap->handle_, flag); \ int r = fn(&wrap->handle_, flag); \
if (r) SetErrno(uv_last_error(uv_default_loop())); \ if (r) SetErrno(uv_last_error(uv_default_loop())); \
return scope.Close(Integer::New(r)); \ return scope.Close(Integer::New(r, node_isolate)); \
} }
X(SetTTL, uv_udp_set_ttl) X(SetTTL, uv_udp_set_ttl)
@@ -194,7 +194,7 @@ Handle<Value> UDPWrap::SetMembership(const Arguments& args,
if (r) if (r)
SetErrno(uv_last_error(uv_default_loop())); SetErrno(uv_last_error(uv_default_loop()));
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
@@ -294,7 +294,7 @@ Handle<Value> UDPWrap::RecvStop(const Arguments& args) {
int r = uv_udp_recv_stop(&wrap->handle_); int r = uv_udp_recv_stop(&wrap->handle_);
return scope.Close(Integer::New(r)); return scope.Close(Integer::New(r, node_isolate));
} }
@@ -336,7 +336,7 @@ void UDPWrap::OnSend(uv_udp_send_t* req, int status) {
} }
Local<Value> argv[4] = { Local<Value> argv[4] = {
Integer::New(status), Integer::New(status, node_isolate),
Local<Value>::New(wrap->object_), Local<Value>::New(wrap->object_),
Local<Value>::New(req_wrap->object_), Local<Value>::New(req_wrap->object_),
req_wrap->object_->GetHiddenValue(buffer_sym), req_wrap->object_->GetHiddenValue(buffer_sym),
@@ -377,8 +377,8 @@ void UDPWrap::OnRecv(uv_udp_t* handle,
Local<Value> argv[] = { Local<Value> argv[] = {
Local<Object>::New(wrap->object_), Local<Object>::New(wrap->object_),
slab, slab,
Integer::NewFromUnsigned(buf.base - Buffer::Data(slab)), Integer::NewFromUnsigned(buf.base - Buffer::Data(slab), node_isolate),
Integer::NewFromUnsigned(nread), Integer::NewFromUnsigned(nread, node_isolate),
AddressToJS(addr) AddressToJS(addr)
}; };
MakeCallback(wrap->object_, onmessage_sym, ARRAY_SIZE(argv), argv); MakeCallback(wrap->object_, onmessage_sym, ARRAY_SIZE(argv), argv);
+19 -17
View File
@@ -32,6 +32,7 @@ namespace {
using node::ThrowRangeError; using node::ThrowRangeError;
using node::ThrowTypeError; using node::ThrowTypeError;
using node::ThrowError; using node::ThrowError;
using node::node_isolate;
struct BatchedMethods { struct BatchedMethods {
const char* name; const char* name;
@@ -109,7 +110,7 @@ class ArrayBuffer {
args.This()->SetAlignedPointerInInternalField(0, buf); args.This()->SetAlignedPointerInInternalField(0, buf);
args.This()->Set(v8::String::New("byteLength"), args.This()->Set(v8::String::New("byteLength"),
v8::Integer::NewFromUnsigned(num_bytes), v8::Integer::NewFromUnsigned(num_bytes, node_isolate),
(v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete)); (v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete));
// NOTE(deanm): This is not in the spec, you shouldn't be able to index // NOTE(deanm): This is not in the spec, you shouldn't be able to index
@@ -151,7 +152,7 @@ class ArrayBuffer {
unsigned int slice_length = end - begin; unsigned int slice_length = end - begin;
v8::Local<v8::Value> argv[] = { v8::Local<v8::Value> argv[] = {
v8::Integer::New(slice_length)}; v8::Integer::New(slice_length, node_isolate)};
v8::Local<v8::Object> buffer = ArrayBuffer::GetTemplate()-> v8::Local<v8::Object> buffer = ArrayBuffer::GetTemplate()->
GetFunction()->NewInstance(1, argv); GetFunction()->NewInstance(1, argv);
@@ -269,7 +270,7 @@ class TypedArray {
// TODO(deanm): Handle integer overflow. // TODO(deanm): Handle integer overflow.
v8::Local<v8::Value> argv[1] = { v8::Local<v8::Value> argv[1] = {
v8::Integer::NewFromUnsigned(length * TBytes)}; v8::Integer::NewFromUnsigned(length * TBytes, node_isolate)};
buffer = ArrayBuffer::GetTemplate()-> buffer = ArrayBuffer::GetTemplate()->
GetFunction()->NewInstance(1, argv); GetFunction()->NewInstance(1, argv);
if (buffer.IsEmpty()) return v8::Undefined(); // constructor failed if (buffer.IsEmpty()) return v8::Undefined(); // constructor failed
@@ -297,7 +298,7 @@ class TypedArray {
length = args[0]->Uint32Value(); length = args[0]->Uint32Value();
// TODO(deanm): Handle integer overflow. // TODO(deanm): Handle integer overflow.
v8::Local<v8::Value> argv[1] = { v8::Local<v8::Value> argv[1] = {
v8::Integer::NewFromUnsigned(length * TBytes)}; v8::Integer::NewFromUnsigned(length * TBytes, node_isolate)};
buffer = ArrayBuffer::GetTemplate()-> buffer = ArrayBuffer::GetTemplate()->
GetFunction()->NewInstance(1, argv); GetFunction()->NewInstance(1, argv);
@@ -313,13 +314,14 @@ class TypedArray {
buffer, buffer,
(v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete)); (v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete));
args.This()->Set(v8::String::New("length"), args.This()->Set(v8::String::New("length"),
v8::Integer::NewFromUnsigned(length), v8::Integer::NewFromUnsigned(length, node_isolate),
(v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete)); (v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete));
args.This()->Set(v8::String::New("byteOffset"), args.This()->Set(v8::String::New("byteOffset"),
v8::Integer::NewFromUnsigned(byte_offset), v8::Integer::NewFromUnsigned(byte_offset, node_isolate),
(v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete)); (v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete));
args.This()->Set(v8::String::New("byteLength"), args.This()->Set(v8::String::New("byteLength"),
v8::Integer::NewFromUnsigned(length * TBytes), v8::Integer::NewFromUnsigned(length * TBytes,
node_isolate),
(v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete)); (v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete));
return args.This(); return args.This();
@@ -428,8 +430,8 @@ class TypedArray {
// Call through to the ArrayBuffer, byteOffset, length constructor. // Call through to the ArrayBuffer, byteOffset, length constructor.
v8::Local<v8::Value> argv[] = { v8::Local<v8::Value> argv[] = {
args.This()->Get(v8::String::New("buffer")), args.This()->Get(v8::String::New("buffer")),
v8::Integer::New(byte_offset), v8::Integer::New(byte_offset, node_isolate),
v8::Integer::New(end - begin)}; v8::Integer::New(end - begin, node_isolate)};
return TypedArray<TBytes, TEAType>::GetTemplate()-> return TypedArray<TBytes, TEAType>::GetTemplate()->
GetFunction()->NewInstance(3, argv); GetFunction()->NewInstance(3, argv);
} }
@@ -469,32 +471,32 @@ v8::Handle<v8::Value> cTypeToValue(T) {
template <> template <>
v8::Handle<v8::Value> cTypeToValue(unsigned char val) { v8::Handle<v8::Value> cTypeToValue(unsigned char val) {
return v8::Integer::NewFromUnsigned(val); return v8::Integer::NewFromUnsigned(val, node_isolate);
} }
template <> template <>
v8::Handle<v8::Value> cTypeToValue(signed char val) { v8::Handle<v8::Value> cTypeToValue(signed char val) {
return v8::Integer::New(val); return v8::Integer::New(val, node_isolate);
} }
template <> template <>
v8::Handle<v8::Value> cTypeToValue(unsigned short val) { v8::Handle<v8::Value> cTypeToValue(unsigned short val) {
return v8::Integer::NewFromUnsigned(val); return v8::Integer::NewFromUnsigned(val, node_isolate);
} }
template <> template <>
v8::Handle<v8::Value> cTypeToValue(short val) { v8::Handle<v8::Value> cTypeToValue(short val) {
return v8::Integer::New(val); return v8::Integer::New(val, node_isolate);
} }
template <> template <>
v8::Handle<v8::Value> cTypeToValue(unsigned int val) { v8::Handle<v8::Value> cTypeToValue(unsigned int val) {
return v8::Integer::NewFromUnsigned(val); return v8::Integer::NewFromUnsigned(val, node_isolate);
} }
template <> template <>
v8::Handle<v8::Value> cTypeToValue(int val) { v8::Handle<v8::Value> cTypeToValue(int val) {
return v8::Integer::New(val); return v8::Integer::New(val, node_isolate);
} }
template <> template <>
@@ -650,10 +652,10 @@ class DataView {
buffer, buffer,
(v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete)); (v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete));
args.This()->Set(v8::String::New("byteOffset"), args.This()->Set(v8::String::New("byteOffset"),
v8::Integer::NewFromUnsigned(byte_offset), v8::Integer::NewFromUnsigned(byte_offset, node_isolate),
(v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete)); (v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete));
args.This()->Set(v8::String::New("byteLength"), args.This()->Set(v8::String::New("byteLength"),
v8::Integer::NewFromUnsigned(byte_length), v8::Integer::NewFromUnsigned(byte_length, node_isolate),
(v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete)); (v8::PropertyAttribute)(v8::ReadOnly|v8::DontDelete));
return args.This(); return args.This();
} }