From 307e43da4d17b07a6dfbd7cc34459df32df3ef63 Mon Sep 17 00:00:00 2001 From: Nimit Date: Thu, 16 Apr 2020 01:51:51 +0530 Subject: [PATCH] src: elevate v8 namespaces elevate v8 namespaces. Leverage `using` semantics for repeated usage of v8 artifacts. PR-URL: https://github.com/nodejs/node/pull/32872 Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater Reviewed-By: Zeyu Yang --- src/cares_wrap.cc | 3 ++- src/env.cc | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index ff050cc2dc9502..8d1e3bc8794dfe 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -66,6 +66,7 @@ using v8::Int32; using v8::Integer; using v8::Isolate; using v8::Local; +using v8::NewStringType; using v8::Null; using v8::Object; using v8::String; @@ -1929,7 +1930,7 @@ void CanonicalizeIP(const FunctionCallbackInfo& args) { const int af = (rc == 4 ? AF_INET : AF_INET6); CHECK_EQ(0, uv_inet_ntop(af, &result, canonical_ip, sizeof(canonical_ip))); Local val = String::NewFromUtf8(isolate, canonical_ip, - v8::NewStringType::kNormal).ToLocalChecked(); + NewStringType::kNormal).ToLocalChecked(); args.GetReturnValue().Set(val); } diff --git a/src/env.cc b/src/env.cc index 444d9c0368ed78..f966bfba1ee7e6 100644 --- a/src/env.cc +++ b/src/env.cc @@ -174,10 +174,10 @@ void IsolateData::CreateProperties() { #define V(Provider) \ async_wrap_providers_[AsyncWrap::PROVIDER_ ## Provider].Set( \ isolate_, \ - v8::String::NewFromOneByte( \ + String::NewFromOneByte( \ isolate_, \ reinterpret_cast(#Provider), \ - v8::NewStringType::kInternalized, \ + NewStringType::kInternalized, \ sizeof(#Provider) - 1).ToLocalChecked()); NODE_ASYNC_PROVIDER_TYPES(V) #undef V