summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-11-11 22:02:03 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2013-11-11 10:40:28 +0100
commit09724b311ee44e6c7998c7a5cb39e739609eba66 (patch)
tree7eb3c62b3bca06b7c2da156f6d7a644140377cea /src
parent7f09a13bbae62bbd9eb9df10d616974a8ed8c577 (diff)
downloadandroid-node-v8-09724b311ee44e6c7998c7a5cb39e739609eba66.tar.gz
android-node-v8-09724b311ee44e6c7998c7a5cb39e739609eba66.tar.bz2
android-node-v8-09724b311ee44e6c7998c7a5cb39e739609eba66.zip
src: fix Environment::GetCurrent() usage
Create a HandleScope before calling the Environment::GetCurrent() that takes a v8::Isolate* as an argument because it creates a handle with the call to v8::Isolate::CurrentContext().
Diffstat (limited to 'src')
-rw-r--r--src/async-wrap-inl.h4
-rw-r--r--src/cares_wrap.cc8
-rw-r--r--src/fs_event_wrap.cc4
-rw-r--r--src/node.cc23
-rw-r--r--src/node_buffer.cc19
-rw-r--r--src/node_contextify.cc4
-rw-r--r--src/node_crypto.cc16
-rw-r--r--src/node_file.cc2
-rw-r--r--src/node_http_parser.cc6
-rw-r--r--src/node_stat_watcher.cc2
-rw-r--r--src/node_zlib.cc2
-rw-r--r--src/pipe_wrap.cc4
-rw-r--r--src/process_wrap.cc4
-rw-r--r--src/signal_wrap.cc2
-rw-r--r--src/smalloc.cc3
-rw-r--r--src/stream_wrap.cc8
-rw-r--r--src/tcp_wrap.cc10
-rw-r--r--src/timer_wrap.cc4
-rw-r--r--src/tls_wrap.cc2
-rw-r--r--src/tty_wrap.cc2
-rw-r--r--src/udp_wrap.cc6
21 files changed, 76 insertions, 59 deletions
diff --git a/src/async-wrap-inl.h b/src/async-wrap-inl.h
index b342cabfe6..1de29583b5 100644
--- a/src/async-wrap-inl.h
+++ b/src/async-wrap-inl.h
@@ -191,8 +191,8 @@ inline v8::Handle<v8::Value> AsyncWrap::MakeCallback(
template <typename TYPE>
inline void AsyncWrap::AddAsyncListener(
const v8::FunctionCallbackInfo<v8::Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
v8::HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
v8::Local<v8::Object> handle = args.This();
v8::Local<v8::Value> listener = args[0];
@@ -211,8 +211,8 @@ inline void AsyncWrap::AddAsyncListener(
template <typename TYPE>
inline void AsyncWrap::RemoveAsyncListener(
const v8::FunctionCallbackInfo<v8::Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
v8::HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
v8::Local<v8::Object> handle = args.This();
v8::Local<v8::Value> listener = args[0];
diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc
index 7758749d02..8145c595a5 100644
--- a/src/cares_wrap.cc
+++ b/src/cares_wrap.cc
@@ -776,8 +776,8 @@ class GetHostByNameWrap: public QueryWrap {
template <class Wrap>
static void Query(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
assert(!args.IsConstructCall());
assert(args[0]->IsObject());
@@ -911,8 +911,8 @@ static void IsIP(const FunctionCallbackInfo<Value>& args) {
static void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
assert(args[0]->IsObject());
assert(args[1]->IsString());
@@ -958,8 +958,8 @@ static void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
static void GetServers(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
Local<Array> server_array = Array::New();
@@ -988,8 +988,8 @@ static void GetServers(const FunctionCallbackInfo<Value>& args) {
static void SetServers(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
assert(args[0]->IsArray());
diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc
index 5dbc278846..8563b40f36 100644
--- a/src/fs_event_wrap.cc
+++ b/src/fs_event_wrap.cc
@@ -78,9 +78,6 @@ FSEventWrap::~FSEventWrap() {
void FSEventWrap::Initialize(Handle<Object> target,
Handle<Value> unused,
Handle<Context> context) {
- Environment* env = Environment::GetCurrent(context);
- HandleScope handle_scope(env->isolate());
-
Local<FunctionTemplate> t = FunctionTemplate::New(New);
t->InstanceTemplate()->SetInternalFieldCount(1);
t->SetClassName(FIXED_ONE_BYTE_STRING(node_isolate, "FSEvent"));
@@ -94,6 +91,7 @@ void FSEventWrap::Initialize(Handle<Object> target,
void FSEventWrap::New(const FunctionCallbackInfo<Value>& args) {
assert(args.IsConstructCall());
+ HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new FSEventWrap(env, args.This());
}
diff --git a/src/node.cc b/src/node.cc
index 3cb6a22a5f..93926cd8bd 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -845,8 +845,8 @@ Local<Value> WinapiErrnoException(int errorno,
void SetupAsyncListener(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
assert(args[0]->IsObject());
assert(args[1]->IsFunction());
@@ -875,8 +875,8 @@ void SetupAsyncListener(const FunctionCallbackInfo<Value>& args) {
void SetupNextTick(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
assert(args[0]->IsObject() && args[1]->IsFunction());
@@ -1648,8 +1648,8 @@ static void Uptime(const FunctionCallbackInfo<Value>& args) {
void MemoryUsage(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
size_t rss;
int err = uv_resident_set_memory(&rss);
@@ -1728,8 +1728,8 @@ typedef void (UV_DYNAMIC* extInit)(Handle<Object> exports);
// when two contexts try to load the same shared object. Maybe have a shadow
// cache that's a plain C list or hash table that's shared across contexts?
void DLOpen(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
char symbol[1024], *base, *pos;
uv_lib_t lib;
int r;
@@ -1898,8 +1898,8 @@ void OnMessage(Handle<Message> message, Handle<Value> error) {
static void Binding(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
Local<String> module = args[0]->ToString();
String::Utf8Value module_v(module);
@@ -2181,6 +2181,7 @@ static void DebugEnd(const FunctionCallbackInfo<Value>& args);
void NeedImmediateCallbackGetter(Local<String> property,
const PropertyCallbackInfo<Value>& info) {
+ HandleScope handle_scope(info.GetIsolate());
Environment* env = Environment::GetCurrent(info.GetIsolate());
const uv_check_t* immediate_check_handle = env->immediate_check_handle();
bool active = uv_is_active(
@@ -2193,8 +2194,8 @@ static void NeedImmediateCallbackSetter(
Local<String> property,
Local<Value> value,
const PropertyCallbackInfo<void>& info) {
- Environment* env = Environment::GetCurrent(info.GetIsolate());
HandleScope handle_scope(info.GetIsolate());
+ Environment* env = Environment::GetCurrent(info.GetIsolate());
uv_check_t* immediate_check_handle = env->immediate_check_handle();
bool active = uv_is_active(
@@ -2241,12 +2242,16 @@ void StopProfilerIdleNotifier(Environment* env) {
void StartProfilerIdleNotifier(const FunctionCallbackInfo<Value>& args) {
- StartProfilerIdleNotifier(Environment::GetCurrent(args.GetIsolate()));
+ HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
+ StartProfilerIdleNotifier(env);
}
void StopProfilerIdleNotifier(const FunctionCallbackInfo<Value>& args) {
- StopProfilerIdleNotifier(Environment::GetCurrent(args.GetIsolate()));
+ HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
+ StopProfilerIdleNotifier(env);
}
@@ -2761,6 +2766,7 @@ static void EnableDebug(bool wait_connect) {
assert(debugger_running == false);
Isolate* isolate = node_isolate; // TODO(bnoordhuis) Multi-isolate support.
Isolate::Scope isolate_scope(isolate);
+ HandleScope handle_scope(isolate);
v8::Debug::SetDebugMessageDispatchHandler(DispatchMessagesDebugAgentCallback,
false);
debugger_running = v8::Debug::EnableAgent("node " NODE_VERSION,
@@ -2779,7 +2785,6 @@ static void EnableDebug(bool wait_connect) {
return; // Still starting up.
Context::Scope context_scope(env->context());
- HandleScope handle_scope(env->isolate());
Local<Object> message = Object::New();
message->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "cmd"),
FIXED_ONE_BYTE_STRING(env->isolate(), "NODE_DEBUG_ENABLED"));
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
index 8c5bf3318c..c16129e0ce 100644
--- a/src/node_buffer.cc
+++ b/src/node_buffer.cc
@@ -127,8 +127,10 @@ Local<Object> New(Handle<String> string, enum encoding enc) {
Local<Object> New(size_t length) {
+ HandleScope handle_scope(node_isolate);
Environment* env = Environment::GetCurrent(node_isolate);
- return Buffer::New(env, length);
+ Local<Object> obj = Buffer::New(env, length);
+ return handle_scope.Close(obj);
}
@@ -160,8 +162,10 @@ Local<Object> New(Environment* env, size_t length) {
Local<Object> New(const char* data, size_t length) {
+ HandleScope handle_scope(node_isolate);
Environment* env = Environment::GetCurrent(node_isolate);
- return Buffer::New(env, data, length);
+ Local<Object> obj = Buffer::New(env, data, length);
+ return handle_scope.Close(obj);
}
@@ -199,8 +203,10 @@ Local<Object> New(char* data,
size_t length,
smalloc::FreeCallback callback,
void* hint) {
+ HandleScope handle_scope(node_isolate);
Environment* env = Environment::GetCurrent(node_isolate);
- return Buffer::New(env, data, length, callback, hint);
+ Local<Object> obj = Buffer::New(env, data, length, callback, hint);
+ return handle_scope.Close(obj);
}
@@ -223,8 +229,10 @@ Local<Object> New(Environment* env,
Local<Object> Use(char* data, uint32_t length) {
+ HandleScope handle_scope(node_isolate);
Environment* env = Environment::GetCurrent(node_isolate);
- return Buffer::Use(env, data, length);
+ Local<Object> obj = Buffer::Use(env, data, length);
+ return handle_scope.Close(obj);
}
@@ -588,8 +596,8 @@ void ByteLength(const FunctionCallbackInfo<Value> &args) {
// pass Buffer object to load prototype methods
void SetupBufferJS(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
assert(args[0]->IsFunction());
@@ -649,7 +657,6 @@ void Initialize(Handle<Object> target,
Handle<Value> unused,
Handle<Context> context) {
Environment* env = Environment::GetCurrent(context);
- HandleScope handle_scope(env->isolate());
target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "setupBufferJS"),
FunctionTemplate::New(SetupBufferJS)->GetFunction());
}
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index d1568f8f48..508e329572 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -218,8 +218,8 @@ class ContextifyContext {
static void MakeContext(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
if (!args[0]->IsObject()) {
return ThrowTypeError("sandbox argument must be an object.");
@@ -449,8 +449,8 @@ class ContextifyScript : public WeakObject {
// args: [options]
static void RunInThisContext(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
// Assemble arguments
TryCatch try_catch;
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index 28ce89c7d7..952767397c 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -245,6 +245,7 @@ void SecureContext::Initialize(Environment* env, Handle<Object> target) {
void SecureContext::New(const FunctionCallbackInfo<Value>& args) {
+ HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new SecureContext(env, args.This());
}
@@ -2105,6 +2106,7 @@ void CipherBase::Initialize(Environment* env, Handle<Object> target) {
void CipherBase::New(const FunctionCallbackInfo<Value>& args) {
assert(args.IsConstructCall() == true);
+ HandleScope handle_scope(args.GetIsolate());
CipherKind kind = args[0]->IsTrue() ? kCipher : kDecipher;
Environment* env = Environment::GetCurrent(args.GetIsolate());
new CipherBase(env, args.This(), kind);
@@ -2241,8 +2243,8 @@ bool CipherBase::Update(const char* data,
void CipherBase::Update(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
CipherBase* cipher = Unwrap<CipherBase>(args.This());
@@ -2310,8 +2312,8 @@ bool CipherBase::Final(unsigned char** out, int *out_len) {
void CipherBase::Final(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
CipherBase* cipher = Unwrap<CipherBase>(args.This());
@@ -2348,6 +2350,7 @@ void Hmac::Initialize(Environment* env, v8::Handle<v8::Object> target) {
void Hmac::New(const FunctionCallbackInfo<Value>& args) {
+ HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new Hmac(env, args.This());
}
@@ -2586,6 +2589,7 @@ void Sign::Initialize(Environment* env, v8::Handle<v8::Object> target) {
void Sign::New(const FunctionCallbackInfo<Value>& args) {
+ HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new Sign(env, args.This());
}
@@ -2768,6 +2772,7 @@ void Verify::Initialize(Environment* env, v8::Handle<v8::Object> target) {
void Verify::New(const FunctionCallbackInfo<Value>& args) {
+ HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new Verify(env, args.This());
}
@@ -3449,8 +3454,8 @@ void EIO_PBKDF2After(uv_work_t* work_req, int status) {
void PBKDF2(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
const char* type_error = NULL;
char* pass = NULL;
@@ -3655,8 +3660,8 @@ void RandomBytesAfter(uv_work_t* work_req, int status) {
RandomBytesRequest,
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];
RandomBytesCheck(req, argv);
req->MakeCallback(env->ondone_string(), ARRAY_SIZE(argv), argv);
@@ -3666,8 +3671,8 @@ void RandomBytesAfter(uv_work_t* work_req, int status) {
template <bool pseudoRandom>
void RandomBytes(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
// maybe allow a buffer to write to? cuts down on object creation
// when generating random data in a loop
@@ -3776,6 +3781,7 @@ void Certificate::Initialize(Handle<Object> target) {
void Certificate::New(const FunctionCallbackInfo<Value>& args) {
+ HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new Certificate(env, args.This());
}
diff --git a/src/node_file.cc b/src/node_file.cc
index 5650e4cc2d..80f8573d3e 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -731,8 +731,8 @@ static void WriteBuffer(const FunctionCallbackInfo<Value>& args) {
// if null, write from the current position
// 3 enc encoding of string
static void WriteString(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
if (!args[0]->IsInt32())
return ThrowTypeError("First argument must be file descriptor");
diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc
index 12957010e5..66c6c7c4cf 100644
--- a/src/node_http_parser.cc
+++ b/src/node_http_parser.cc
@@ -337,8 +337,8 @@ class Parser : public WeakObject {
static void New(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
http_parser_type type =
static_cast<http_parser_type>(args[0]->Int32Value());
assert(type == HTTP_REQUEST || type == HTTP_RESPONSE);
@@ -445,8 +445,8 @@ class Parser : public WeakObject {
static void Reinitialize(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
http_parser_type type =
static_cast<http_parser_type>(args[0]->Int32Value());
@@ -461,8 +461,8 @@ class Parser : public WeakObject {
template <bool should_pause>
static void Pause(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
Parser* parser = Unwrap<Parser>(args.This());
// Should always be called from the same context.
assert(env == parser->env());
diff --git a/src/node_stat_watcher.cc b/src/node_stat_watcher.cc
index b5a04c1f94..2f35d550bc 100644
--- a/src/node_stat_watcher.cc
+++ b/src/node_stat_watcher.cc
@@ -99,8 +99,8 @@ void StatWatcher::Callback(uv_fs_poll_t* handle,
void StatWatcher::New(const FunctionCallbackInfo<Value>& args) {
assert(args.IsConstructCall());
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
new StatWatcher(env, args.This());
}
diff --git a/src/node_zlib.cc b/src/node_zlib.cc
index 5360b7a077..43bec55a4f 100644
--- a/src/node_zlib.cc
+++ b/src/node_zlib.cc
@@ -313,8 +313,8 @@ class ZCtx : public WeakObject {
}
static void New(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
if (args.Length() < 1 || !args[0]->IsInt32()) {
return ThrowTypeError("Bad argument");
diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc
index a522775743..e5b6836050 100644
--- a/src/pipe_wrap.cc
+++ b/src/pipe_wrap.cc
@@ -123,8 +123,8 @@ void PipeWrap::New(const FunctionCallbackInfo<Value>& args) {
// Therefore we assert that we are not trying to call this as a
// normal function.
assert(args.IsConstructCall());
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
new PipeWrap(env, args.This(), args[0]->IsTrue());
}
@@ -266,8 +266,8 @@ void PipeWrap::Open(const FunctionCallbackInfo<Value>& args) {
void PipeWrap::Connect(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
PipeWrap* wrap = Unwrap<PipeWrap>(args.This());
diff --git a/src/process_wrap.cc b/src/process_wrap.cc
index 7b8125ceba..83126be6d0 100644
--- a/src/process_wrap.cc
+++ b/src/process_wrap.cc
@@ -72,8 +72,8 @@ class ProcessWrap : public HandleWrap {
// Therefore we assert that we are not trying to call this as a
// normal function.
assert(args.IsConstructCall());
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
new ProcessWrap(env, args.This());
}
@@ -130,8 +130,8 @@ class ProcessWrap : public HandleWrap {
}
static void Spawn(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
ProcessWrap* wrap = Unwrap<ProcessWrap>(args.This());
diff --git a/src/signal_wrap.cc b/src/signal_wrap.cc
index b38ca38d0c..1eade0bd96 100644
--- a/src/signal_wrap.cc
+++ b/src/signal_wrap.cc
@@ -66,8 +66,8 @@ class SignalWrap : public HandleWrap {
// Therefore we assert that we are not trying to call this as a
// normal function.
assert(args.IsConstructCall());
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
new SignalWrap(env, args.This());
}
diff --git a/src/smalloc.cc b/src/smalloc.cc
index 62a57fada9..0e830bb32f 100644
--- a/src/smalloc.cc
+++ b/src/smalloc.cc
@@ -297,8 +297,8 @@ void AllocDispose(const FunctionCallbackInfo<Value>& args) {
void AllocDispose(Handle<Object> obj) {
+ HandleScope handle_scope(node_isolate);
Environment* env = Environment::GetCurrent(node_isolate);
- HandleScope handle_scope(env->isolate());
if (env->using_smalloc_alloc_cb()) {
Local<Value> ext_v = obj->GetHiddenValue(env->smalloc_p_string());
@@ -360,6 +360,7 @@ void Alloc(Handle<Object> obj,
enum ExternalArrayType type) {
assert(!obj->HasIndexedPropertiesInExternalArrayData());
+ HandleScope handle_scope(node_isolate);
Environment* env = Environment::GetCurrent(node_isolate);
env->set_using_smalloc_alloc_cb(true);
diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc
index 507819e6cd..69ba23d7c4 100644
--- a/src/stream_wrap.cc
+++ b/src/stream_wrap.cc
@@ -190,8 +190,8 @@ size_t StreamWrap::WriteBuffer(Handle<Value> val, uv_buf_t* buf) {
void StreamWrap::WriteBuffer(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
StreamWrap* wrap = Unwrap<StreamWrap>(args.This());
@@ -229,8 +229,8 @@ void StreamWrap::WriteBuffer(const FunctionCallbackInfo<Value>& args) {
template <enum encoding encoding>
void StreamWrap::WriteStringImpl(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
int err;
StreamWrap* wrap = Unwrap<StreamWrap>(args.This());
@@ -313,8 +313,8 @@ void StreamWrap::WriteStringImpl(const FunctionCallbackInfo<Value>& args) {
void StreamWrap::Writev(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
StreamWrap* wrap = Unwrap<StreamWrap>(args.This());
@@ -459,8 +459,8 @@ void StreamWrap::AfterWrite(uv_write_t* req, int status) {
void StreamWrap::Shutdown(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
StreamWrap* wrap = Unwrap<StreamWrap>(args.This());
diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc
index 85fff070a6..be05a294ea 100644
--- a/src/tcp_wrap.cc
+++ b/src/tcp_wrap.cc
@@ -133,8 +133,8 @@ void TCPWrap::New(const FunctionCallbackInfo<Value>& args) {
// Therefore we assert that we are not trying to call this as a
// normal function.
assert(args.IsConstructCall());
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
TCPWrap* wrap = new TCPWrap(env, args.This());
assert(wrap);
}
@@ -155,8 +155,8 @@ TCPWrap::~TCPWrap() {
void TCPWrap::GetSockName(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
struct sockaddr_storage address;
TCPWrap* wrap = Unwrap<TCPWrap>(args.This());
@@ -178,8 +178,8 @@ void TCPWrap::GetSockName(const FunctionCallbackInfo<Value>& args) {
void TCPWrap::GetPeerName(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
struct sockaddr_storage address;
TCPWrap* wrap = Unwrap<TCPWrap>(args.This());
@@ -356,8 +356,8 @@ void TCPWrap::AfterConnect(uv_connect_t* req, int status) {
void TCPWrap::Connect(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
TCPWrap* wrap = Unwrap<TCPWrap>(args.This());
@@ -388,8 +388,8 @@ void TCPWrap::Connect(const FunctionCallbackInfo<Value>& args) {
void TCPWrap::Connect6(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
TCPWrap* wrap = Unwrap<TCPWrap>(args.This());
diff --git a/src/timer_wrap.cc b/src/timer_wrap.cc
index 393def3d59..01a50f0024 100644
--- a/src/timer_wrap.cc
+++ b/src/timer_wrap.cc
@@ -77,8 +77,8 @@ class TimerWrap : public HandleWrap {
// Therefore we assert that we are not trying to call this as a
// normal function.
assert(args.IsConstructCall());
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
new TimerWrap(env, args.This());
}
@@ -144,8 +144,8 @@ class TimerWrap : public HandleWrap {
}
static void Now(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
uv_update_time(env->event_loop());
double now = static_cast<double>(uv_now(env->event_loop()));
args.GetReturnValue().Set(now);
diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc
index a18b6c1da4..2dd8016c59 100644
--- a/src/tls_wrap.cc
+++ b/src/tls_wrap.cc
@@ -181,8 +181,8 @@ void TLSCallbacks::InitSSL() {
void TLSCallbacks::Wrap(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
if (args.Length() < 1 || !args[0]->IsObject())
return ThrowTypeError("First argument should be a StreamWrap instance");
diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc
index 6a0b282377..0f7e390748 100644
--- a/src/tty_wrap.cc
+++ b/src/tty_wrap.cc
@@ -157,8 +157,8 @@ void TTYWrap::SetRawMode(const FunctionCallbackInfo<Value>& args) {
void TTYWrap::New(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
// This constructor should not be exposed to public javascript.
// Therefore we assert that we are not trying to call this as a
diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc
index 5a16a55b4e..8424ff080e 100644
--- a/src/udp_wrap.cc
+++ b/src/udp_wrap.cc
@@ -129,8 +129,8 @@ void UDPWrap::Initialize(Handle<Object> target,
void UDPWrap::New(const FunctionCallbackInfo<Value>& args) {
assert(args.IsConstructCall());
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
new UDPWrap(env, args.This());
}
@@ -243,8 +243,8 @@ void UDPWrap::DropMembership(const FunctionCallbackInfo<Value>& args) {
void UDPWrap::DoSend(const FunctionCallbackInfo<Value>& args, int family) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
UDPWrap* wrap = Unwrap<UDPWrap>(args.This());
@@ -336,8 +336,8 @@ void UDPWrap::RecvStop(const FunctionCallbackInfo<Value>& args) {
void UDPWrap::GetSockName(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
+ Environment* env = Environment::GetCurrent(args.GetIsolate());
struct sockaddr_storage address;
UDPWrap* wrap = Unwrap<UDPWrap>(args.This());