@@ -2280,34 +2280,29 @@ static void LinkedBinding(const FunctionCallbackInfo<Value>& args) {
22802280
22812281static void ProcessTitleGetter (Local<String> property,
22822282 const PropertyCallbackInfo<Value>& info) {
2283- Environment* env = Environment::GetCurrent (info);
2284- HandleScope scope (env->isolate ());
22852283 char buffer[512 ];
22862284 uv_get_process_title (buffer, sizeof (buffer));
2287- info.GetReturnValue ().Set (String::NewFromUtf8 (env-> isolate (), buffer));
2285+ info.GetReturnValue ().Set (String::NewFromUtf8 (info. GetIsolate (), buffer));
22882286}
22892287
22902288
22912289static void ProcessTitleSetter (Local<String> property,
22922290 Local<Value> value,
22932291 const PropertyCallbackInfo<void >& info) {
2294- Environment* env = Environment::GetCurrent (info);
2295- HandleScope scope (env->isolate ());
2296- node::Utf8Value title (env->isolate (), value);
2292+ node::Utf8Value title (info.GetIsolate (), value);
22972293 // TODO(piscisaureus): protect with a lock
22982294 uv_set_process_title (*title);
22992295}
23002296
23012297
23022298static void EnvGetter (Local<String> property,
23032299 const PropertyCallbackInfo<Value>& info) {
2304- Environment* env = Environment::GetCurrent (info);
2305- HandleScope scope (env->isolate ());
2300+ Isolate* isolate = info.GetIsolate ();
23062301#ifdef __POSIX__
2307- node::Utf8Value key (env-> isolate () , property);
2302+ node::Utf8Value key (isolate, property);
23082303 const char * val = getenv (*key);
23092304 if (val) {
2310- return info.GetReturnValue ().Set (String::NewFromUtf8 (env-> isolate () , val));
2305+ return info.GetReturnValue ().Set (String::NewFromUtf8 (isolate, val));
23112306 }
23122307#else // _WIN32
23132308 String::Value key (property);
@@ -2321,7 +2316,7 @@ static void EnvGetter(Local<String> property,
23212316 if ((result > 0 || GetLastError () == ERROR_SUCCESS) &&
23222317 result < ARRAY_SIZE (buffer)) {
23232318 const uint16_t * two_byte_buffer = reinterpret_cast <const uint16_t *>(buffer);
2324- Local<String> rc = String::NewFromTwoByte (env-> isolate () , two_byte_buffer);
2319+ Local<String> rc = String::NewFromTwoByte (isolate, two_byte_buffer);
23252320 return info.GetReturnValue ().Set (rc);
23262321 }
23272322#endif
@@ -2331,11 +2326,9 @@ static void EnvGetter(Local<String> property,
23312326static void EnvSetter (Local<String> property,
23322327 Local<Value> value,
23332328 const PropertyCallbackInfo<Value>& info) {
2334- Environment* env = Environment::GetCurrent (info);
2335- HandleScope scope (env->isolate ());
23362329#ifdef __POSIX__
2337- node::Utf8Value key (env-> isolate (), property);
2338- node::Utf8Value val (env-> isolate (), value);
2330+ node::Utf8Value key (info. GetIsolate (), property);
2331+ node::Utf8Value val (info. GetIsolate (), value);
23392332 setenv (*key, *val, 1 );
23402333#else // _WIN32
23412334 String::Value key (property);
@@ -2353,11 +2346,9 @@ static void EnvSetter(Local<String> property,
23532346
23542347static void EnvQuery (Local<String> property,
23552348 const PropertyCallbackInfo<Integer>& info) {
2356- Environment* env = Environment::GetCurrent (info);
2357- HandleScope scope (env->isolate ());
23582349 int32_t rc = -1 ; // Not found unless proven otherwise.
23592350#ifdef __POSIX__
2360- node::Utf8Value key (env-> isolate (), property);
2351+ node::Utf8Value key (info. GetIsolate (), property);
23612352 if (getenv (*key))
23622353 rc = 0 ;
23632354#else // _WIN32
@@ -2381,11 +2372,9 @@ static void EnvQuery(Local<String> property,
23812372
23822373static void EnvDeleter (Local<String> property,
23832374 const PropertyCallbackInfo<Boolean>& info) {
2384- Environment* env = Environment::GetCurrent (info);
2385- HandleScope scope (env->isolate ());
23862375 bool rc = true ;
23872376#ifdef __POSIX__
2388- node::Utf8Value key (env-> isolate (), property);
2377+ node::Utf8Value key (info. GetIsolate (), property);
23892378 rc = getenv (*key) != nullptr ;
23902379 if (rc)
23912380 unsetenv (*key);
@@ -2404,20 +2393,19 @@ static void EnvDeleter(Local<String> property,
24042393
24052394
24062395static void EnvEnumerator (const PropertyCallbackInfo<Array>& info) {
2407- Environment* env = Environment::GetCurrent (info);
2408- HandleScope scope (env->isolate ());
2396+ Isolate* isolate = info.GetIsolate ();
24092397#ifdef __POSIX__
24102398 int size = 0 ;
24112399 while (environ[size])
24122400 size++;
24132401
2414- Local<Array> envarr = Array::New (env-> isolate () , size);
2402+ Local<Array> envarr = Array::New (isolate, size);
24152403
24162404 for (int i = 0 ; i < size; ++i) {
24172405 const char * var = environ[i];
24182406 const char * s = strchr (var, ' =' );
24192407 const int length = s ? s - var : strlen (var);
2420- Local<String> name = String::NewFromUtf8 (env-> isolate () ,
2408+ Local<String> name = String::NewFromUtf8 (isolate,
24212409 var,
24222410 String::kNormalString ,
24232411 length);
@@ -2427,7 +2415,7 @@ static void EnvEnumerator(const PropertyCallbackInfo<Array>& info) {
24272415 WCHAR* environment = GetEnvironmentStringsW ();
24282416 if (environment == nullptr )
24292417 return ; // This should not happen.
2430- Local<Array> envarr = Array::New (env-> isolate () );
2418+ Local<Array> envarr = Array::New (isolate);
24312419 WCHAR* p = environment;
24322420 int i = 0 ;
24332421 while (*p) {
@@ -2444,7 +2432,7 @@ static void EnvEnumerator(const PropertyCallbackInfo<Array>& info) {
24442432 }
24452433 const uint16_t * two_byte_buffer = reinterpret_cast <const uint16_t *>(p);
24462434 const size_t two_byte_buffer_len = s - p;
2447- Local<String> value = String::NewFromTwoByte (env-> isolate () ,
2435+ Local<String> value = String::NewFromTwoByte (isolate,
24482436 two_byte_buffer,
24492437 String::kNormalString ,
24502438 two_byte_buffer_len);
@@ -2505,17 +2493,13 @@ static Handle<Object> GetFeatures(Environment* env) {
25052493
25062494static void DebugPortGetter (Local<String> property,
25072495 const PropertyCallbackInfo<Value>& info) {
2508- Environment* env = Environment::GetCurrent (info);
2509- HandleScope scope (env->isolate ());
25102496 info.GetReturnValue ().Set (debug_port);
25112497}
25122498
25132499
25142500static void DebugPortSetter (Local<String> property,
25152501 Local<Value> value,
25162502 const PropertyCallbackInfo<void >& info) {
2517- Environment* env = Environment::GetCurrent (info);
2518- HandleScope scope (env->isolate ());
25192503 debug_port = value->Int32Value ();
25202504}
25212505
@@ -2539,7 +2523,6 @@ static void NeedImmediateCallbackSetter(
25392523 Local<String> property,
25402524 Local<Value> value,
25412525 const PropertyCallbackInfo<void >& info) {
2542- HandleScope handle_scope (info.GetIsolate ());
25432526 Environment* env = Environment::GetCurrent (info);
25442527
25452528 uv_check_t * immediate_check_handle = env->immediate_check_handle ();
0 commit comments