Browse Source

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().
v0.11.9-release
Ben Noordhuis 11 years ago
parent
commit
09724b311e
  1. 4
      src/async-wrap-inl.h
  2. 8
      src/cares_wrap.cc
  3. 4
      src/fs_event_wrap.cc
  4. 23
      src/node.cc
  5. 19
      src/node_buffer.cc
  6. 4
      src/node_contextify.cc
  7. 16
      src/node_crypto.cc
  8. 2
      src/node_file.cc
  9. 6
      src/node_http_parser.cc
  10. 2
      src/node_stat_watcher.cc
  11. 2
      src/node_zlib.cc
  12. 4
      src/pipe_wrap.cc
  13. 4
      src/process_wrap.cc
  14. 2
      src/signal_wrap.cc
  15. 3
      src/smalloc.cc
  16. 8
      src/stream_wrap.cc
  17. 10
      src/tcp_wrap.cc
  18. 4
      src/timer_wrap.cc
  19. 2
      src/tls_wrap.cc
  20. 2
      src/tty_wrap.cc
  21. 6
      src/udp_wrap.cc

4
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];

8
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());

4
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());
}

23
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"));

19
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());
}

4
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;

16
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());
}

2
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");

6
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());

2
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());
}

2
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");

4
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());

4
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());

2
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());
}

3
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);

8
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());

10
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());

4
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);

2
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");

2
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

6
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());

Loading…
Cancel
Save