aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-01-07 00:09:31 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2013-01-07 17:39:57 +0100
commit109f73b2c08a042bc2d788ba9df9469846dbc533 (patch)
tree3b77a127d9f6bdb566b6fd3f582e5cbcd79da8ee
parent01c3d0aa888e3a2bf709da760588df191479b922 (diff)
downloadandroid-node-v8-109f73b2c08a042bc2d788ba9df9469846dbc533.tar.gz
android-node-v8-109f73b2c08a042bc2d788ba9df9469846dbc533.tar.bz2
android-node-v8-109f73b2c08a042bc2d788ba9df9469846dbc533.zip
src: pass node_isolate to True() and False()
-rw-r--r--src/node.cc26
-rw-r--r--src/node_crypto.cc80
-rw-r--r--src/node_http_parser.cc7
-rw-r--r--src/node_os.cc6
-rw-r--r--src/tcp_wrap.cc4
-rw-r--r--src/tty_wrap.cc7
-rw-r--r--src/udp_wrap.cc4
7 files changed, 75 insertions, 59 deletions
diff --git a/src/node.cc b/src/node.cc
index f3a5d5bb98..d71937a17f 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -176,7 +176,7 @@ static void Tick(void) {
TryCatch try_catch;
// Let the tick callback know that this is coming from the spinner
- Handle<Value> argv[] = { True() };
+ Handle<Value> argv[] = { True(node_isolate) };
cb->Call(process, ARRAY_SIZE(argv), argv);
if (try_catch.HasCaught()) {
@@ -2078,9 +2078,9 @@ static Handle<Boolean> EnvDeleter(Local<String> property,
HandleScope scope;
#ifdef __POSIX__
String::Utf8Value key(property);
- if (!getenv(*key)) return False();
+ if (!getenv(*key)) return False(node_isolate);
unsetenv(*key); // can't check return value, it's void on some platforms
- return True();
+ return True(node_isolate);
#else
String::Value key(property);
WCHAR* key_ptr = reinterpret_cast<WCHAR*>(*key);
@@ -2091,7 +2091,7 @@ static Handle<Boolean> EnvDeleter(Local<String> property,
GetLastError() != ERROR_SUCCESS;
return scope.Close(Boolean::New(rv));
}
- return True();
+ return True(node_isolate);
#endif
}
@@ -2146,14 +2146,14 @@ static Handle<Object> GetFeatures() {
Local<Object> obj = Object::New();
obj->Set(String::NewSymbol("debug"),
#if defined(DEBUG) && DEBUG
- True()
+ True(node_isolate)
#else
- False()
+ False(node_isolate)
#endif
);
- obj->Set(String::NewSymbol("uv"), True());
- obj->Set(String::NewSymbol("ipv6"), True()); // TODO ping libuv
+ obj->Set(String::NewSymbol("uv"), True(node_isolate));
+ obj->Set(String::NewSymbol("ipv6"), True(node_isolate)); // TODO ping libuv
obj->Set(String::NewSymbol("tls_npn"), Boolean::New(use_npn));
obj->Set(String::NewSymbol("tls_sni"), Boolean::New(use_sni));
obj->Set(String::NewSymbol("tls"),
@@ -2283,22 +2283,22 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
// -p, --print
if (print_eval) {
- process->Set(String::NewSymbol("_print_eval"), True());
+ process->Set(String::NewSymbol("_print_eval"), True(node_isolate));
}
// -i, --interactive
if (force_repl) {
- process->Set(String::NewSymbol("_forceRepl"), True());
+ process->Set(String::NewSymbol("_forceRepl"), True(node_isolate));
}
// --no-deprecation
if (no_deprecation) {
- process->Set(String::NewSymbol("noDeprecation"), True());
+ process->Set(String::NewSymbol("noDeprecation"), True(node_isolate));
}
// --trace-deprecation
if (trace_deprecation) {
- process->Set(String::NewSymbol("traceDeprecation"), True());
+ process->Set(String::NewSymbol("traceDeprecation"), True(node_isolate));
}
size_t size = 2*PATH_MAX;
@@ -2911,7 +2911,7 @@ void AtExit(void (*cb)(void* arg), void* arg) {
void EmitExit(v8::Handle<v8::Object> process_l) {
// process.emit('exit')
- process_l->Set(String::NewSymbol("_exiting"), True());
+ process_l->Set(String::NewSymbol("_exiting"), True(node_isolate));
Local<Value> emit_v = process_l->Get(String::New("emit"));
assert(emit_v->IsFunction());
Local<Function> emit = Local<Function>::Cast(emit_v);
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index 1136a3d4c6..bdfefbf597 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -217,7 +217,7 @@ Handle<Value> SecureContext::Init(const Arguments& args) {
SSL_CTX_sess_set_new_cb(sc->ctx_, NewSessionCallback);
sc->ca_store_ = NULL;
- return True();
+ return True(node_isolate);
}
@@ -333,7 +333,7 @@ Handle<Value> SecureContext::SetKey(const Arguments& args) {
}
BIO *bio = LoadBIO(args[0]);
- if (!bio) return False();
+ if (!bio) return False(node_isolate);
String::Utf8Value passphrase(args[1]);
@@ -356,7 +356,7 @@ Handle<Value> SecureContext::SetKey(const Arguments& args) {
EVP_PKEY_free(key);
BIO_free(bio);
- return True();
+ return True(node_isolate);
}
@@ -437,7 +437,7 @@ Handle<Value> SecureContext::SetCert(const Arguments& args) {
}
BIO* bio = LoadBIO(args[0]);
- if (!bio) return False();
+ if (!bio) return False(node_isolate);
int rv = SSL_CTX_use_certificate_chain(sc->ctx_, bio);
@@ -454,7 +454,7 @@ Handle<Value> SecureContext::SetCert(const Arguments& args) {
return ThrowException(Exception::Error(String::New(string)));
}
- return True();
+ return True(node_isolate);
}
@@ -474,7 +474,7 @@ Handle<Value> SecureContext::AddCACert(const Arguments& args) {
}
X509* x509 = LoadX509(args[0]);
- if (!x509) return False();
+ if (!x509) return False(node_isolate);
X509_STORE_add_cert(sc->ca_store_, x509);
SSL_CTX_add_client_CA(sc->ctx_, x509);
@@ -485,7 +485,7 @@ Handle<Value> SecureContext::AddCACert(const Arguments& args) {
SSL_CTX_set_cert_store(sc->ctx_, sc->ca_store_);
}
- return True();
+ return True(node_isolate);
}
@@ -499,13 +499,13 @@ Handle<Value> SecureContext::AddCRL(const Arguments& args) {
}
BIO *bio = LoadBIO(args[0]);
- if (!bio) return False();
+ if (!bio) return False(node_isolate);
X509_CRL *x509 = PEM_read_bio_X509_CRL(bio, NULL, NULL, NULL);
if (x509 == NULL) {
BIO_free(bio);
- return False();
+ return False(node_isolate);
}
X509_STORE_add_crl(sc->ca_store_, x509);
@@ -516,7 +516,7 @@ Handle<Value> SecureContext::AddCRL(const Arguments& args) {
BIO_free(bio);
X509_CRL_free(x509);
- return True();
+ return True(node_isolate);
}
@@ -536,14 +536,14 @@ Handle<Value> SecureContext::AddRootCerts(const Arguments& args) {
if (!BIO_write(bp, root_certs[i], strlen(root_certs[i]))) {
BIO_free(bp);
- return False();
+ return False(node_isolate);
}
X509 *x509 = PEM_read_bio_X509(bp, NULL, NULL, NULL);
if (x509 == NULL) {
BIO_free(bp);
- return False();
+ return False(node_isolate);
}
X509_STORE_add_cert(root_cert_store, x509);
@@ -556,7 +556,7 @@ Handle<Value> SecureContext::AddRootCerts(const Arguments& args) {
sc->ca_store_ = root_cert_store;
SSL_CTX_set_cert_store(sc->ctx_, sc->ca_store_);
- return True();
+ return True(node_isolate);
}
@@ -572,7 +572,7 @@ Handle<Value> SecureContext::SetCiphers(const Arguments& args) {
String::Utf8Value ciphers(args[0]);
SSL_CTX_set_cipher_list(sc->ctx_, *ciphers);
- return True();
+ return True(node_isolate);
}
Handle<Value> SecureContext::SetOptions(const Arguments& args) {
@@ -586,7 +586,7 @@ Handle<Value> SecureContext::SetOptions(const Arguments& args) {
SSL_CTX_set_options(sc->ctx_, args[0]->IntegerValue());
- return True();
+ return True(node_isolate);
}
Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) {
@@ -618,14 +618,14 @@ Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) {
return ThrowException(Exception::TypeError(message));
}
- return True();
+ return True(node_isolate);
}
Handle<Value> SecureContext::Close(const Arguments& args) {
HandleScope scope;
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
sc->FreeCTXMem();
- return False();
+ return False(node_isolate);
}
//Takes .pfx or .p12 and password in string or buffer format
@@ -702,7 +702,7 @@ Handle<Value> SecureContext::LoadPKCS12(const Arguments& args) {
return ThrowException(Exception::Error(String::New(str)));
}
- return True();
+ return True(node_isolate);
}
@@ -948,11 +948,11 @@ void Connection::SetShutdownFlags() {
int flags = SSL_get_shutdown(ssl_);
if (flags & SSL_SENT_SHUTDOWN) {
- handle_->Set(String::New("sentShutdown"), True());
+ handle_->Set(String::New("sentShutdown"), True(node_isolate));
}
if (flags & SSL_RECEIVED_SHUTDOWN) {
- handle_->Set(String::New("receivedShutdown"), True());
+ handle_->Set(String::New("receivedShutdown"), True(node_isolate));
}
}
@@ -1082,7 +1082,7 @@ int Connection::SelectNextProtoCallback_(SSL *s,
*outlen = 8;
// set status unsupported
- p->selectedNPNProto_ = Persistent<Value>::New(False());
+ p->selectedNPNProto_ = Persistent<Value>::New(False(node_isolate));
return SSL_TLSEXT_ERR_OK;
}
@@ -1103,7 +1103,7 @@ int Connection::SelectNextProtoCallback_(SSL *s,
));
break;
case OPENSSL_NPN_NO_OVERLAP:
- p->selectedNPNProto_ = Persistent<Value>::New(False());
+ p->selectedNPNProto_ = Persistent<Value>::New(False(node_isolate));
break;
default:
break;
@@ -1660,7 +1660,7 @@ Handle<Value> Connection::SetSession(const Arguments& args) {
return ThrowException(Exception::Error(eStr));
}
- return True();
+ return True(node_isolate);
}
Handle<Value> Connection::LoadSession(const Arguments& args) {
@@ -1684,7 +1684,7 @@ Handle<Value> Connection::LoadSession(const Arguments& args) {
ss->hello_parser_.Finish();
- return True();
+ return True(node_isolate);
}
Handle<Value> Connection::IsSessionReused(const Arguments& args) {
@@ -1692,8 +1692,11 @@ Handle<Value> Connection::IsSessionReused(const Arguments& args) {
Connection *ss = Connection::Unwrap(args);
- if (ss->ssl_ == NULL) return False();
- return SSL_session_reused(ss->ssl_) ? True() : False();
+ if (ss->ssl_ == NULL || SSL_session_reused(ss->ssl_) == false) {
+ return False(node_isolate);
+ }
+
+ return True(node_isolate);
}
@@ -1724,7 +1727,7 @@ Handle<Value> Connection::Shutdown(const Arguments& args) {
Connection *ss = Connection::Unwrap(args);
- if (ss->ssl_ == NULL) return False();
+ if (ss->ssl_ == NULL) return False(node_isolate);
int rv = SSL_shutdown(ss->ssl_);
ss->HandleSSLError("SSL_shutdown", rv, kZeroIsNotAnError);
ss->SetShutdownFlags();
@@ -1738,12 +1741,12 @@ Handle<Value> Connection::ReceivedShutdown(const Arguments& args) {
Connection *ss = Connection::Unwrap(args);
- if (ss->ssl_ == NULL) return False();
+ if (ss->ssl_ == NULL) return False(node_isolate);
int r = SSL_get_shutdown(ss->ssl_);
- if (r & SSL_RECEIVED_SHUTDOWN) return True();
+ if (r & SSL_RECEIVED_SHUTDOWN) return True(node_isolate);
- return False();
+ return False(node_isolate);
}
@@ -1752,8 +1755,11 @@ Handle<Value> Connection::IsInitFinished(const Arguments& args) {
Connection *ss = Connection::Unwrap(args);
- if (ss->ssl_ == NULL) return False();
- return SSL_is_init_finished(ss->ssl_) ? True() : False();
+ if (ss->ssl_ == NULL || SSL_is_init_finished(ss->ssl_) == false) {
+ return False(node_isolate);
+ }
+
+ return True(node_isolate);
}
@@ -1929,7 +1935,7 @@ Handle<Value> Connection::Close(const Arguments& args) {
SSL_free(ss->ssl_);
ss->ssl_ = NULL;
}
- return True();
+ return True(node_isolate);
}
#ifdef OPENSSL_NPN_NEGOTIATED
@@ -1945,7 +1951,7 @@ Handle<Value> Connection::GetNegotiatedProto(const Arguments& args) {
SSL_get0_next_proto_negotiated(ss->ssl_, &npn_proto, &npn_proto_len);
if (!npn_proto) {
- return False();
+ return False(node_isolate);
}
return String::New((const char*) npn_proto, npn_proto_len);
@@ -1970,7 +1976,7 @@ Handle<Value> Connection::SetNPNProtocols(const Arguments& args) {
}
ss->npnProtos_ = Persistent<Object>::New(args[0]->ToObject());
- return True();
+ return True(node_isolate);
};
#endif
@@ -1983,7 +1989,7 @@ Handle<Value> Connection::GetServername(const Arguments& args) {
if (ss->is_server_ && !ss->servername_.IsEmpty()) {
return ss->servername_;
} else {
- return False();
+ return False(node_isolate);
}
}
@@ -2004,7 +2010,7 @@ Handle<Value> Connection::SetSNICallback(const Arguments& args) {
ss->sniObject_ = Persistent<Object>::New(Object::New());
ss->sniObject_->Set(String::New("onselect"), args[0]);
- return True();
+ return True(node_isolate);
}
#endif
diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc
index 448136aa31..3e622eb6aa 100644
--- a/src/node_http_parser.cc
+++ b/src/node_http_parser.cc
@@ -280,9 +280,12 @@ public:
Integer::New(parser_.http_minor, node_isolate));
message_info->Set(should_keep_alive_sym,
- http_should_keep_alive(&parser_) ? True() : False());
+ http_should_keep_alive(&parser_) ? True(node_isolate)
+ : False(node_isolate));
- message_info->Set(upgrade_sym, parser_.upgrade ? True() : False());
+ message_info->Set(upgrade_sym,
+ parser_.upgrade ? True(node_isolate)
+ : False(node_isolate));
Local<Value> argv[1] = { message_info };
diff --git a/src/node_os.cc b/src/node_os.cc
index 145ba47244..7b84c29278 100644
--- a/src/node_os.cc
+++ b/src/node_os.cc
@@ -235,8 +235,10 @@ static Handle<Value> GetInterfaceAddresses(const Arguments& args) {
o = Object::New();
o->Set(String::New("address"), String::New(ip));
o->Set(String::New("family"), family);
- o->Set(String::New("internal"), interfaces[i].is_internal ?
- True() : False());
+
+ const bool internal = interfaces[i].is_internal;
+ o->Set(String::New("internal"),
+ internal ? True(node_isolate) : False(node_isolate));
ifarr->Set(ifarr->Length(), o);
}
diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc
index 898bf90270..3df632833e 100644
--- a/src/tcp_wrap.cc
+++ b/src/tcp_wrap.cc
@@ -350,8 +350,8 @@ void TCPWrap::AfterConnect(uv_connect_t* req, int status) {
Integer::New(status, node_isolate),
Local<Value>::New(node_isolate, wrap->object_),
Local<Value>::New(node_isolate, req_wrap->object_),
- Local<Value>::New(node_isolate, v8::True()),
- Local<Value>::New(node_isolate, v8::True())
+ Local<Value>::New(node_isolate, v8::True(node_isolate)),
+ Local<Value>::New(node_isolate, v8::True(node_isolate))
};
MakeCallback(req_wrap->object_, oncomplete_sym, ARRAY_SIZE(argv), argv);
diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc
index 7875c7dfe0..476d0ab157 100644
--- a/src/tty_wrap.cc
+++ b/src/tty_wrap.cc
@@ -118,7 +118,12 @@ Handle<Value> TTYWrap::IsTTY(const Arguments& args) {
HandleScope scope;
int fd = args[0]->Int32Value();
assert(fd >= 0);
- return uv_guess_handle(fd) == UV_TTY ? v8::True() : v8::False();
+
+ if (uv_guess_handle(fd) == UV_TTY) {
+ return v8::True(node_isolate);
+ }
+
+ return v8::False(node_isolate);
}
diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc
index 785d348a66..ac8265f11c 100644
--- a/src/udp_wrap.cc
+++ b/src/udp_wrap.cc
@@ -280,10 +280,10 @@ Handle<Value> UDPWrap::RecvStart(const Arguments& args) {
int r = uv_udp_recv_start(&wrap->handle_, OnAlloc, OnRecv);
if (r && uv_last_error(uv_default_loop()).code != UV_EALREADY) {
SetErrno(uv_last_error(uv_default_loop()));
- return False();
+ return False(node_isolate);
}
- return True();
+ return True(node_isolate);
}