GeezerVison is showing github.com — src: remove unnecessary `Environment::GetCurrent()` calls · nodejs/node@8e182e5
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/cares_wrap.cc +1-3Lines changed: 1 addition & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1668,7 +1668,6 @@ Maybe<int> ReverseTraits::Parse(QueryReverseWrap* wrap, | 1668 | 1668 | namespace { | 1669 | 1669 | template <class Wrap> | 1670 | 1670 | static void Query(const FunctionCallbackInfo<Value>& args) { | 1671 | | - Environment* env = Environment::GetCurrent(args); | 1672 | 1671 | ChannelWrap* channel; | 1673 | 1672 | ASSIGN_OR_RETURN_UNWRAP(&channel, args.This()); | 1674 | 1673 |
| @@ -1680,7 +1679,7 @@ static void Query(const FunctionCallbackInfo<Value>& args) { | 1680 | 1679 | Local<String> string = args[1].As<String>(); | 1681 | 1680 | auto wrap = std::make_unique<Wrap>(channel, req_wrap_obj); | 1682 | 1681 |
| 1683 | | - node::Utf8Value utf8name(env->isolate(), string); | | 1682 | + node::Utf8Value utf8name(args.GetIsolate(), string); | 1684 | 1683 | auto plain_name = utf8name.ToStringView(); | 1685 | 1684 | std::string name = ada::idna::to_ascii(plain_name); | 1686 | 1685 | channel->ModifyActivityQueryCount(1); | @@ -1695,7 +1694,6 @@ static void Query(const FunctionCallbackInfo<Value>& args) { | 1695 | 1694 | args.GetReturnValue().Set(err); | 1696 | 1695 | } | 1697 | 1696 |
| 1698 | | - | 1699 | 1697 | void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) { | 1700 | 1698 | auto cleanup = OnScopeLeave([&]() { uv_freeaddrinfo(res); }); | 1701 | 1699 | BaseObjectPtr<GetAddrInfoReqWrap> req_wrap{ | |
Collapse file Copy file name to clipboardExpand all lines: src/crypto/crypto_keys.cc +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -799,12 +799,11 @@ int GetOKPCurveFromName(const char* name) { | 799 | 799 | } | 800 | 800 |
| 801 | 801 | void KeyObjectHandle::InitEDRaw(const FunctionCallbackInfo<Value>& args) { | 802 | | - Environment* env = Environment::GetCurrent(args); | 803 | 802 | KeyObjectHandle* key; | 804 | 803 | ASSIGN_OR_RETURN_UNWRAP(&key, args.This()); | 805 | 804 |
| 806 | 805 | CHECK(args[0]->IsString()); | 807 | | - Utf8Value name(env->isolate(), args[0]); | | 806 | + Utf8Value name(args.GetIsolate(), args[0]); | 808 | 807 |
| 809 | 808 | ArrayBufferOrViewContents<unsigned char> key_data(args[1]); | 810 | 809 | KeyType type = FromV8Value<KeyType>(args[2]); | |
Collapse file Copy file name to clipboardExpand all lines: src/crypto/crypto_tls.cc +3-8Lines changed: 3 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1357,8 +1357,6 @@ void TLSWrap::EnableALPNCb(const FunctionCallbackInfo<Value>& args) { | 1357 | 1357 | } | 1358 | 1358 |
| 1359 | 1359 | void TLSWrap::GetServername(const FunctionCallbackInfo<Value>& args) { | 1360 | | - Environment* env = Environment::GetCurrent(args); | 1361 | | - | 1362 | 1360 | TLSWrap* wrap; | 1363 | 1361 | ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); | 1364 | 1362 |
| @@ -1368,15 +1366,13 @@ void TLSWrap::GetServername(const FunctionCallbackInfo<Value>& args) { | 1368 | 1366 | if (servername.has_value()) { | 1369 | 1367 | auto& sn = servername.value(); | 1370 | 1368 | args.GetReturnValue().Set( | 1371 | | - OneByteString(env->isolate(), sn.data(), sn.length())); | | 1369 | + OneByteString(args.GetIsolate(), sn.data(), sn.length())); | 1372 | 1370 | } else { | 1373 | 1371 | args.GetReturnValue().Set(false); | 1374 | 1372 | } | 1375 | 1373 | } | 1376 | 1374 |
| 1377 | 1375 | void TLSWrap::SetServername(const FunctionCallbackInfo<Value>& args) { | 1378 | | - Environment* env = Environment::GetCurrent(args); | 1379 | | - | 1380 | 1376 | TLSWrap* wrap; | 1381 | 1377 | ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); | 1382 | 1378 |
| @@ -1387,7 +1383,7 @@ void TLSWrap::SetServername(const FunctionCallbackInfo<Value>& args) { | 1387 | 1383 |
| 1388 | 1384 | CHECK(wrap->ssl_); | 1389 | 1385 |
| 1390 | | - Utf8Value servername(env->isolate(), args[0].As<String>()); | | 1386 | + Utf8Value servername(args.GetIsolate(), args[0].As<String>()); | 1391 | 1387 | SSL_set_tlsext_host_name(wrap->ssl_.get(), *servername); | 1392 | 1388 | } | 1393 | 1389 |
| @@ -2109,11 +2105,10 @@ void TLSWrap::GetEphemeralKeyInfo(const FunctionCallbackInfo<Value>& args) { | 2109 | 2105 | } | 2110 | 2106 |
| 2111 | 2107 | void TLSWrap::GetProtocol(const FunctionCallbackInfo<Value>& args) { | 2112 | | - Environment* env = Environment::GetCurrent(args); | 2113 | 2108 | TLSWrap* w; | 2114 | 2109 | ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); | 2115 | 2110 | args.GetReturnValue().Set( | 2116 | | - OneByteString(env->isolate(), SSL_get_version(w->ssl_.get()))); | | 2111 | + OneByteString(args.GetIsolate(), SSL_get_version(w->ssl_.get()))); | 2117 | 2112 | } | 2118 | 2113 |
| 2119 | 2114 | void TLSWrap::GetALPNNegotiatedProto(const FunctionCallbackInfo<Value>& args) { | |
Collapse file Copy file name to clipboardExpand all lines: src/crypto/crypto_util.cc +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -705,10 +705,9 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) { | 705 | 705 | } | 706 | 706 |
| 707 | 707 | void SecureHeapUsed(const FunctionCallbackInfo<Value>& args) { | 708 | | - Environment* env = Environment::GetCurrent(args); | 709 | 708 | if (CRYPTO_secure_malloc_initialized()) | 710 | 709 | args.GetReturnValue().Set( | 711 | | - BigInt::New(env->isolate(), CRYPTO_secure_used())); | | 710 | + BigInt::New(args.GetIsolate(), CRYPTO_secure_used())); | 712 | 711 | } | 713 | 712 | } // namespace | 714 | 713 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/histogram.cc +7-10Lines changed: 7 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -453,10 +453,9 @@ void HistogramImpl::GetCount(const FunctionCallbackInfo<Value>& args) { | 453 | 453 | } | 454 | 454 |
| 455 | 455 | void HistogramImpl::GetCountBigInt(const FunctionCallbackInfo<Value>& args) { | 456 | | - Environment* env = Environment::GetCurrent(args); | 457 | 456 | HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); | 458 | 457 | args.GetReturnValue().Set( | 459 | | - BigInt::NewFromUnsigned(env->isolate(), (*histogram)->Count())); | | 458 | + BigInt::NewFromUnsigned(args.GetIsolate(), (*histogram)->Count())); | 460 | 459 | } | 461 | 460 |
| 462 | 461 | void HistogramImpl::GetMin(const FunctionCallbackInfo<Value>& args) { | @@ -466,9 +465,9 @@ void HistogramImpl::GetMin(const FunctionCallbackInfo<Value>& args) { | 466 | 465 | } | 467 | 466 |
| 468 | 467 | void HistogramImpl::GetMinBigInt(const FunctionCallbackInfo<Value>& args) { | 469 | | - Environment* env = Environment::GetCurrent(args); | 470 | 468 | HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); | 471 | | - args.GetReturnValue().Set(BigInt::New(env->isolate(), (*histogram)->Min())); | | 469 | + args.GetReturnValue().Set( | | 470 | + BigInt::New(args.GetIsolate(), (*histogram)->Min())); | 472 | 471 | } | 473 | 472 |
| 474 | 473 | void HistogramImpl::GetMax(const FunctionCallbackInfo<Value>& args) { | @@ -478,9 +477,9 @@ void HistogramImpl::GetMax(const FunctionCallbackInfo<Value>& args) { | 478 | 477 | } | 479 | 478 |
| 480 | 479 | void HistogramImpl::GetMaxBigInt(const FunctionCallbackInfo<Value>& args) { | 481 | | - Environment* env = Environment::GetCurrent(args); | 482 | 480 | HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); | 483 | | - args.GetReturnValue().Set(BigInt::New(env->isolate(), (*histogram)->Max())); | | 481 | + args.GetReturnValue().Set( | | 482 | + BigInt::New(args.GetIsolate(), (*histogram)->Max())); | 484 | 483 | } | 485 | 484 |
| 486 | 485 | void HistogramImpl::GetMean(const FunctionCallbackInfo<Value>& args) { | @@ -495,10 +494,9 @@ void HistogramImpl::GetExceeds(const FunctionCallbackInfo<Value>& args) { | 495 | 494 | } | 496 | 495 |
| 497 | 496 | void HistogramImpl::GetExceedsBigInt(const FunctionCallbackInfo<Value>& args) { | 498 | | - Environment* env = Environment::GetCurrent(args); | 499 | 497 | HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); | 500 | 498 | args.GetReturnValue().Set( | 501 | | - BigInt::New(env->isolate(), (*histogram)->Exceeds())); | | 499 | + BigInt::New(args.GetIsolate(), (*histogram)->Exceeds())); | 502 | 500 | } | 503 | 501 |
| 504 | 502 | void HistogramImpl::GetStddev(const FunctionCallbackInfo<Value>& args) { | @@ -516,12 +514,11 @@ void HistogramImpl::GetPercentile(const FunctionCallbackInfo<Value>& args) { | 516 | 514 |
| 517 | 515 | void HistogramImpl::GetPercentileBigInt( | 518 | 516 | const FunctionCallbackInfo<Value>& args) { | 519 | | - Environment* env = Environment::GetCurrent(args); | 520 | 517 | HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); | 521 | 518 | CHECK(args[0]->IsNumber()); | 522 | 519 | double percentile = args[0].As<Number>()->Value(); | 523 | 520 | int64_t value = (*histogram)->Percentile(percentile); | 524 | | - args.GetReturnValue().Set(BigInt::New(env->isolate(), value)); | | 521 | + args.GetReturnValue().Set(BigInt::New(args.GetIsolate(), value)); | 525 | 522 | } | 526 | 523 |
| 527 | 524 | void HistogramImpl::GetPercentiles(const FunctionCallbackInfo<Value>& args) { | |
Collapse file Copy file name to clipboardExpand all lines: src/inspector_js_api.cc +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -128,14 +128,13 @@ class JSBindingsConnection : public BaseObject { | 128 | 128 | } | 129 | 129 |
| 130 | 130 | static void Dispatch(const FunctionCallbackInfo<Value>& info) { | 131 | | - Environment* env = Environment::GetCurrent(info); | 132 | 131 | JSBindingsConnection* session; | 133 | 132 | ASSIGN_OR_RETURN_UNWRAP(&session, info.This()); | 134 | 133 | CHECK(info[0]->IsString()); | 135 | 134 |
| 136 | 135 | if (session->session_) { | 137 | 136 | session->session_->Dispatch( | 138 | | - ToInspectorString(env->isolate(), info[0])->string()); | | 137 | + ToInspectorString(info.GetIsolate(), info[0])->string()); | 139 | 138 | } | 140 | 139 | } | 141 | 140 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/node_blob.cc +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -46,7 +46,6 @@ namespace { | 46 | 46 | void Concat(const FunctionCallbackInfo<Value>& args) { | 47 | 47 | Isolate* isolate = args.GetIsolate(); | 48 | 48 | Local<Context> context = isolate->GetCurrentContext(); | 49 | | - Environment* env = Environment::GetCurrent(context); | 50 | 49 |
| 51 | 50 | CHECK(args[0]->IsArray()); | 52 | 51 | Local<Array> array = args[0].As<Array>(); | @@ -83,7 +82,7 @@ void Concat(const FunctionCallbackInfo<Value>& args) { | 83 | 82 | } | 84 | 83 |
| 85 | 84 | std::shared_ptr<BackingStore> store = | 86 | | - ArrayBuffer::NewBackingStore(env->isolate(), total); | | 85 | + ArrayBuffer::NewBackingStore(isolate, total); | 87 | 86 | uint8_t* ptr = static_cast<uint8_t*>(store->Data()); | 88 | 87 | for (size_t n = 0; n < views.size(); n++) { | 89 | 88 | uint8_t* from = | @@ -92,7 +91,7 @@ void Concat(const FunctionCallbackInfo<Value>& args) { | 92 | 91 | ptr += views[n].length; | 93 | 92 | } | 94 | 93 |
| 95 | | - args.GetReturnValue().Set(ArrayBuffer::New(env->isolate(), std::move(store))); | | 94 | + args.GetReturnValue().Set(ArrayBuffer::New(isolate, std::move(store))); | 96 | 95 | } | 97 | 96 |
| 98 | 97 | void BlobFromFilePath(const FunctionCallbackInfo<Value>& args) { | |
Collapse file Copy file name to clipboardExpand all lines: src/node_i18n.cc +4-7Lines changed: 4 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -324,10 +324,10 @@ void Transcode(const FunctionCallbackInfo<Value>&args) { | 324 | 324 | } | 325 | 325 |
| 326 | 326 | void ICUErrorName(const FunctionCallbackInfo<Value>& args) { | 327 | | - Environment* env = Environment::GetCurrent(args); | 328 | 327 | CHECK(args[0]->IsInt32()); | 329 | 328 | UErrorCode status = static_cast<UErrorCode>(args[0].As<Int32>()->Value()); | 330 | | - args.GetReturnValue().Set(OneByteString(env->isolate(), u_errorName(status))); | | 329 | + args.GetReturnValue().Set( | | 330 | + OneByteString(args.GetIsolate(), u_errorName(status))); | 331 | 331 | } | 332 | 332 |
| 333 | 333 | } // anonymous namespace | @@ -369,10 +369,8 @@ size_t Converter::max_char_size() const { | 369 | 369 | } | 370 | 370 |
| 371 | 371 | void ConverterObject::Has(const FunctionCallbackInfo<Value>& args) { | 372 | | - Environment* env = Environment::GetCurrent(args); | 373 | | - | 374 | 372 | CHECK_GE(args.Length(), 1); | 375 | | - Utf8Value label(env->isolate(), args[0]); | | 373 | + Utf8Value label(args.GetIsolate(), args[0]); | 376 | 374 |
| 377 | 375 | UErrorCode status = U_ZERO_ERROR; | 378 | 376 | ConverterPointer conv(ucnv_open(*label, &status)); | @@ -639,13 +637,12 @@ static int GetColumnWidth(UChar32 codepoint, | 639 | 637 |
| 640 | 638 | // Returns the column width for the given String. | 641 | 639 | static void GetStringWidth(const FunctionCallbackInfo<Value>& args) { | 642 | | - Environment* env = Environment::GetCurrent(args); | 643 | 640 | CHECK(args[0]->IsString()); | 644 | 641 |
| 645 | 642 | bool ambiguous_as_full_width = args[1]->IsTrue(); | 646 | 643 | bool expand_emoji_sequence = !args[2]->IsBoolean() || args[2]->IsTrue(); | 647 | 644 |
| 648 | | - TwoByteValue value(env->isolate(), args[0]); | | 645 | + TwoByteValue value(args.GetIsolate(), args[0]); | 649 | 646 | // reinterpret_cast is required by windows to compile | 650 | 647 | UChar* str = reinterpret_cast<UChar*>(*value); | 651 | 648 | static_assert(sizeof(*str) == sizeof(**value), | |
Collapse file Copy file name to clipboardExpand all lines: src/node_os.cc +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -107,8 +107,7 @@ static void GetOSInformation(const FunctionCallbackInfo<Value>& args) { | 107 | 107 | } | 108 | 108 |
| 109 | 109 | static void GetCPUInfo(const FunctionCallbackInfo<Value>& args) { | 110 | | - Environment* env = Environment::GetCurrent(args); | 111 | | - Isolate* isolate = env->isolate(); | | 110 | + Isolate* isolate = args.GetIsolate(); | 112 | 111 |
| 113 | 112 | uv_cpu_info_t* cpu_infos; | 114 | 113 | int count; | |
Collapse file Copy file name to clipboardExpand all lines: src/node_report_module.cc +3-6Lines changed: 3 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -78,8 +78,7 @@ static void GetCompact(const FunctionCallbackInfo<Value>& info) { | 78 | 78 |
| 79 | 79 | static void SetCompact(const FunctionCallbackInfo<Value>& info) { | 80 | 80 | Mutex::ScopedLock lock(per_process::cli_options_mutex); | 81 | | - Environment* env = Environment::GetCurrent(info); | 82 | | - Isolate* isolate = env->isolate(); | | 81 | + Isolate* isolate = info.GetIsolate(); | 83 | 82 | bool compact = info[0]->ToBoolean(isolate)->Value(); | 84 | 83 | per_process::cli_options->report_compact = compact; | 85 | 84 | } | @@ -116,9 +115,8 @@ static void GetDirectory(const FunctionCallbackInfo<Value>& info) { | 116 | 115 |
| 117 | 116 | static void SetDirectory(const FunctionCallbackInfo<Value>& info) { | 118 | 117 | Mutex::ScopedLock lock(per_process::cli_options_mutex); | 119 | | - Environment* env = Environment::GetCurrent(info); | 120 | 118 | CHECK(info[0]->IsString()); | 121 | | - Utf8Value dir(env->isolate(), info[0].As<String>()); | | 119 | + Utf8Value dir(info.GetIsolate(), info[0].As<String>()); | 122 | 120 | per_process::cli_options->report_directory = *dir; | 123 | 121 | } | 124 | 122 |
| @@ -132,9 +130,8 @@ static void GetFilename(const FunctionCallbackInfo<Value>& info) { | 132 | 130 |
| 133 | 131 | static void SetFilename(const FunctionCallbackInfo<Value>& info) { | 134 | 132 | Mutex::ScopedLock lock(per_process::cli_options_mutex); | 135 | | - Environment* env = Environment::GetCurrent(info); | 136 | 133 | CHECK(info[0]->IsString()); | 137 | | - Utf8Value name(env->isolate(), info[0].As<String>()); | | 134 | + Utf8Value name(info.GetIsolate(), info[0].As<String>()); | 138 | 135 | per_process::cli_options->report_filename = *name; | 139 | 136 | } | 140 | 137 |
| |
|