summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-11-11 10:53:00 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2013-11-12 22:06:48 +0100
commit27f115d715478b9a800927498ba606d4a62f927c (patch)
tree2a1c5b790d852f48f5547a72fa4e90ea146e004d
parentc0d62c207ee67492619bde4af46502b5a3ce6a66 (diff)
downloadandroid-node-v8-27f115d715478b9a800927498ba606d4a62f927c.tar.gz
android-node-v8-27f115d715478b9a800927498ba606d4a62f927c.tar.bz2
android-node-v8-27f115d715478b9a800927498ba606d4a62f927c.zip
src: fix Context::Scope usage
env->context() may or may not create a new Local. It currently does not but don't depend on that behavior, create a HandleScope first.
-rw-r--r--src/cares_wrap.cc8
-rw-r--r--src/env-inl.h2
-rw-r--r--src/fs_event_wrap.cc2
-rw-r--r--src/handle_wrap.cc2
-rw-r--r--src/node.cc2
-rw-r--r--src/node_crypto.cc4
-rw-r--r--src/node_file.cc2
-rw-r--r--src/node_stat_watcher.cc4
-rw-r--r--src/node_zlib.cc2
-rw-r--r--src/pipe_wrap.cc4
-rw-r--r--src/process_wrap.cc2
-rw-r--r--src/signal_wrap.cc2
-rw-r--r--src/stream_wrap.cc6
-rw-r--r--src/tcp_wrap.cc4
-rw-r--r--src/timer_wrap.cc2
-rw-r--r--src/tls_wrap.cc10
-rw-r--r--src/udp_wrap.cc4
17 files changed, 31 insertions, 31 deletions
diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc
index 8145c595a5..5cc19f48fb 100644
--- a/src/cares_wrap.cc
+++ b/src/cares_wrap.cc
@@ -276,8 +276,8 @@ class QueryWrap : public AsyncWrap {
}
void CallOnComplete(Local<Value> answer) {
- Context::Scope context_scope(env()->context());
HandleScope handle_scope(env()->isolate());
+ Context::Scope context_scope(env()->context());
Local<Value> argv[] = {
Integer::New(0, env()->isolate()),
answer
@@ -286,8 +286,8 @@ class QueryWrap : public AsyncWrap {
}
void CallOnComplete(Local<Value> answer, Local<Value> family) {
- Context::Scope context_scope(env()->context());
HandleScope handle_scope(env()->isolate());
+ Context::Scope context_scope(env()->context());
Local<Value> argv[] = {
Integer::New(0, env()->isolate()),
answer,
@@ -298,8 +298,8 @@ class QueryWrap : public AsyncWrap {
void ParseError(int status) {
assert(status != ARES_SUCCESS);
- Context::Scope context_scope(env()->context());
HandleScope handle_scope(env()->isolate());
+ Context::Scope context_scope(env()->context());
Local<Value> arg;
switch (status) {
#define V(code) \
@@ -800,8 +800,8 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
GetAddrInfoReqWrap* req_wrap = static_cast<GetAddrInfoReqWrap*>(req->data);
Environment* env = req_wrap->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
Local<Value> argv[] = {
Integer::New(status, node_isolate),
diff --git a/src/env-inl.h b/src/env-inl.h
index d9aed32419..4578f6ebc0 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -165,8 +165,8 @@ inline Environment::Environment(v8::Local<v8::Context> context)
using_smalloc_alloc_cb_(false),
context_(context->GetIsolate(), context) {
// We'll be creating new objects so make sure we've entered the context.
- v8::Context::Scope context_scope(context);
v8::HandleScope handle_scope(isolate());
+ v8::Context::Scope context_scope(context);
set_binding_cache_object(v8::Object::New());
set_module_load_list_array(v8::Array::New());
RB_INIT(&cares_task_list_);
diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc
index 8563b40f36..79538b747b 100644
--- a/src/fs_event_wrap.cc
+++ b/src/fs_event_wrap.cc
@@ -137,8 +137,8 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename,
FSEventWrap* wrap = static_cast<FSEventWrap*>(handle->data);
Environment* env = wrap->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
assert(wrap->persistent().IsEmpty() == false);
diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc
index be37d63b6d..553cf799dc 100644
--- a/src/handle_wrap.cc
+++ b/src/handle_wrap.cc
@@ -117,8 +117,8 @@ void HandleWrap::OnClose(uv_handle_t* handle) {
// But the handle pointer should be gone.
assert(wrap->handle__ == NULL);
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
Local<Object> object = wrap->object();
if (wrap->flags_ & kCloseCallback) {
diff --git a/src/node.cc b/src/node.cc
index 3153392efd..0d8985f306 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -3155,8 +3155,8 @@ void AtExit(void (*cb)(void* arg), void* arg) {
void EmitExit(Environment* env) {
// process.emit('exit')
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
Local<Object> process_object = env->process_object();
process_object->Set(FIXED_ONE_BYTE_STRING(node_isolate, "_exiting"),
True(node_isolate));
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index f116232ec5..c1dc61696e 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -1789,8 +1789,8 @@ void Connection::SSLInfoCallback(const SSL *ssl_, int where, int ret) {
SSL* ssl = const_cast<SSL*>(ssl_);
Connection* conn = static_cast<Connection*>(SSL_get_app_data(ssl));
Environment* env = conn->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
if (where & SSL_CB_HANDSHAKE_START) {
conn->MakeCallback(env->onhandshakestart_string(), 0, NULL);
@@ -3447,8 +3447,8 @@ void EIO_PBKDF2After(uv_work_t* work_req, int status) {
assert(status == 0);
PBKDF2Request* req = CONTAINER_OF(work_req, PBKDF2Request, work_req_);
Environment* env = req->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
Local<Value> argv[2];
EIO_PBKDF2After(req, argv);
req->MakeCallback(env->ondone_string(), ARRAY_SIZE(argv), argv);
diff --git a/src/node_file.cc b/src/node_file.cc
index 80f8573d3e..f829fb5de4 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -109,8 +109,8 @@ static void After(uv_fs_t *req) {
req_wrap->ReleaseEarly(); // Free memory that's no longer used now.
Environment* env = req_wrap->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
// there is always at least one argument. "error"
int argc = 1;
diff --git a/src/node_stat_watcher.cc b/src/node_stat_watcher.cc
index 2f35d550bc..df896fa873 100644
--- a/src/node_stat_watcher.cc
+++ b/src/node_stat_watcher.cc
@@ -86,8 +86,8 @@ void StatWatcher::Callback(uv_fs_poll_t* handle,
StatWatcher* wrap = static_cast<StatWatcher*>(handle->data);
assert(wrap->watcher_ == handle);
Environment* env = wrap->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
Local<Value> argv[] = {
BuildStatsObject(env, curr),
BuildStatsObject(env, prev),
@@ -124,8 +124,8 @@ void StatWatcher::Start(const FunctionCallbackInfo<Value>& args) {
void StatWatcher::Stop(const FunctionCallbackInfo<Value>& args) {
StatWatcher* wrap = Unwrap<StatWatcher>(args.This());
Environment* env = wrap->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
wrap->MakeCallback(env->onstop_string(), 0, NULL);
wrap->Stop();
}
diff --git a/src/node_zlib.cc b/src/node_zlib.cc
index 43bec55a4f..c4da32e266 100644
--- a/src/node_zlib.cc
+++ b/src/node_zlib.cc
@@ -255,8 +255,8 @@ class ZCtx : public WeakObject {
ZCtx* ctx = CONTAINER_OF(work_req, ZCtx, work_req_);
Environment* env = ctx->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
// Acceptable error states depend on the type of zlib stream.
switch (ctx->err_) {
diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc
index e5b6836050..d4f01ebf9e 100644
--- a/src/pipe_wrap.cc
+++ b/src/pipe_wrap.cc
@@ -181,8 +181,8 @@ void PipeWrap::OnConnection(uv_stream_t* handle, int status) {
assert(&pipe_wrap->handle_ == reinterpret_cast<uv_pipe_t*>(handle));
Environment* env = pipe_wrap->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
// We should not be getting this callback if someone as already called
// uv_close() on the handle.
@@ -220,8 +220,8 @@ void PipeWrap::AfterConnect(uv_connect_t* req, int status) {
assert(req_wrap->env() == wrap->env());
Environment* env = wrap->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
// The wrap and request objects should still be there.
assert(req_wrap->persistent().IsEmpty() == false);
diff --git a/src/process_wrap.cc b/src/process_wrap.cc
index 83126be6d0..2ced3dee6d 100644
--- a/src/process_wrap.cc
+++ b/src/process_wrap.cc
@@ -276,8 +276,8 @@ class ProcessWrap : public HandleWrap {
assert(&wrap->process_ == handle);
Environment* env = wrap->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
Local<Value> argv[] = {
Number::New(node_isolate, static_cast<double>(exit_status)),
diff --git a/src/signal_wrap.cc b/src/signal_wrap.cc
index 1eade0bd96..821b6dc580 100644
--- a/src/signal_wrap.cc
+++ b/src/signal_wrap.cc
@@ -100,8 +100,8 @@ class SignalWrap : public HandleWrap {
static void OnSignal(uv_signal_t* handle, int signum) {
SignalWrap* wrap = CONTAINER_OF(handle, SignalWrap, handle_);
Environment* env = wrap->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
Local<Value> arg = Integer::New(signum, env->isolate());
wrap->MakeCallback(env->onsignal_string(), 1, &arg);
diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc
index 2274eff0f4..77797621d0 100644
--- a/src/stream_wrap.cc
+++ b/src/stream_wrap.cc
@@ -431,8 +431,8 @@ void StreamWrap::AfterWrite(uv_write_t* req, int status) {
StreamWrap* wrap = req_wrap->wrap();
Environment* env = wrap->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
// The wrap and request objects should still be there.
assert(req_wrap->persistent().IsEmpty() == false);
@@ -483,8 +483,8 @@ void StreamWrap::AfterShutdown(uv_shutdown_t* req, int status) {
assert(req_wrap->persistent().IsEmpty() == false);
assert(wrap->persistent().IsEmpty() == false);
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
Local<Object> req_wrap_obj = req_wrap->object();
Local<Value> argv[3] = {
@@ -552,8 +552,8 @@ void StreamWrapCallbacks::DoRead(uv_stream_t* handle,
const uv_buf_t* buf,
uv_handle_type pending) {
Environment* env = wrap()->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
Local<Value> argv[] = {
Integer::New(nread, node_isolate),
diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc
index be05a294ea..dad505dbe1 100644
--- a/src/tcp_wrap.cc
+++ b/src/tcp_wrap.cc
@@ -297,8 +297,8 @@ void TCPWrap::OnConnection(uv_stream_t* handle, int status) {
assert(&tcp_wrap->handle_ == reinterpret_cast<uv_tcp_t*>(handle));
Environment* env = tcp_wrap->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
// We should not be getting this callback if someone as already called
// uv_close() on the handle.
@@ -333,8 +333,8 @@ void TCPWrap::AfterConnect(uv_connect_t* req, int status) {
assert(req_wrap->env() == wrap->env());
Environment* env = wrap->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
// The wrap and request objects should still be there.
assert(req_wrap->persistent().IsEmpty() == false);
diff --git a/src/timer_wrap.cc b/src/timer_wrap.cc
index 01a50f0024..7a0116ee41 100644
--- a/src/timer_wrap.cc
+++ b/src/timer_wrap.cc
@@ -137,8 +137,8 @@ class TimerWrap : public HandleWrap {
static void OnTimeout(uv_timer_t* handle, int status) {
TimerWrap* wrap = static_cast<TimerWrap*>(handle->data);
Environment* env = wrap->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
Local<Value> argv[1] = { Integer::New(status, node_isolate) };
wrap->MakeCallback(kOnTimeout, ARRAY_SIZE(argv), argv);
}
diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc
index 5c837fa22e..287c90cce7 100644
--- a/src/tls_wrap.cc
+++ b/src/tls_wrap.cc
@@ -308,8 +308,8 @@ void TLSCallbacks::EncOutCb(uv_write_t* req, int status) {
return;
// Notify about error
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
Local<Value> arg = String::Concat(
FIXED_ONE_BYTE_STRING(node_isolate, "write cb error, status: "),
Integer::New(status, node_isolate)->ToString());
@@ -367,8 +367,8 @@ void TLSCallbacks::ClearOut() {
if (!hello_parser_.IsEnded())
return;
- Context::Scope context_scope(env()->context());
HandleScope handle_scope(env()->isolate());
+ Context::Scope context_scope(env()->context());
assert(ssl_ != NULL);
@@ -418,8 +418,8 @@ bool TLSCallbacks::ClearIn() {
return true;
}
- Context::Scope context_scope(env()->context());
HandleScope handle_scope(env()->isolate());
+ Context::Scope context_scope(env()->context());
// Error or partial write
int err;
@@ -484,8 +484,8 @@ int TLSCallbacks::DoWrite(WriteWrap* w,
if (i != count) {
int err;
- Context::Scope context_scope(env()->context());
HandleScope handle_scope(env()->isolate());
+ Context::Scope context_scope(env()->context());
Handle<Value> arg = GetSSLError(written, &err);
if (!arg.IsEmpty()) {
MakeCallback(env()->onerror_string(), 1, &arg);
@@ -524,8 +524,8 @@ void TLSCallbacks::DoRead(uv_stream_t* handle,
if (nread < 0) {
// Error should be emitted only after all data was read
ClearOut();
- Context::Scope context_scope(env()->context());
HandleScope handle_scope(env()->isolate());
+ Context::Scope context_scope(env()->context());
Local<Value> arg = Integer::New(nread, node_isolate);
wrap()->MakeCallback(env()->onread_string(), 1, &arg);
return;
diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc
index 8424ff080e..a563a7eccb 100644
--- a/src/udp_wrap.cc
+++ b/src/udp_wrap.cc
@@ -364,8 +364,8 @@ void UDPWrap::OnSend(uv_udp_send_t* req, int status) {
SendWrap* req_wrap = static_cast<SendWrap*>(req->data);
if (req_wrap->have_callback()) {
Environment* env = req_wrap->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
Local<Value> arg = Integer::New(status, node_isolate);
req_wrap->MakeCallback(env->oncomplete_string(), 1, &arg);
}
@@ -400,8 +400,8 @@ void UDPWrap::OnRecv(uv_udp_t* handle,
UDPWrap* wrap = static_cast<UDPWrap*>(handle->data);
Environment* env = wrap->env();
- Context::Scope context_scope(env->context());
HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
Local<Object> wrap_obj = wrap->object();
Local<Value> argv[] = {