3030#include " v8-profiler.h"
3131
3232using v8::Context;
33+ using v8::DontDelete;
34+ using v8::EscapableHandleScope;
3335using v8::Function;
3436using v8::FunctionCallbackInfo;
3537using v8::FunctionTemplate;
@@ -38,16 +40,22 @@ using v8::Integer;
3840using v8::Isolate;
3941using v8::Local;
4042using v8::MaybeLocal;
43+ using v8::NewStringType;
4144using v8::Number;
4245using v8::Object;
4346using v8::ObjectTemplate;
4447using v8::Promise;
4548using v8::PromiseHookType;
49+ using v8::PropertyAttribute;
4650using v8::PropertyCallbackInfo;
51+ using v8::ReadOnly;
4752using v8::String;
53+ using v8::TryCatch;
4854using v8::Uint32;
4955using v8::Undefined;
5056using v8::Value;
57+ using v8::WeakCallbackInfo;
58+ using v8::WeakCallbackType;
5159
5260using AsyncHooks = node::Environment::AsyncHooks;
5361
@@ -117,7 +125,7 @@ void Emit(Environment* env, double async_id, AsyncHooks::Fields type,
117125 if (async_hooks->fields ()[type] == 0 || !env->can_call_into_js ())
118126 return ;
119127
120- v8:: HandleScope handle_scope (env->isolate ());
128+ HandleScope handle_scope (env->isolate ());
121129 Local<Value> async_id_value = Number::New (env->isolate (), async_id);
122130 FatalTryCatch try_catch (env);
123131 USE (fn->Call (env->context (), Undefined (env->isolate ()), 1 , &async_id_value));
@@ -353,8 +361,7 @@ class DestroyParam {
353361 Persistent<Object> propBag;
354362};
355363
356-
357- void AsyncWrap::WeakCallback (const v8::WeakCallbackInfo<DestroyParam>& info) {
364+ void AsyncWrap::WeakCallback (const WeakCallbackInfo<DestroyParam>& info) {
358365 HandleScope scope (info.GetIsolate ());
359366
360367 std::unique_ptr<DestroyParam> p{info.GetParameter ()};
@@ -385,8 +392,7 @@ static void RegisterDestroyHook(const FunctionCallbackInfo<Value>& args) {
385392 p->env = Environment::GetCurrent (args);
386393 p->target .Reset (isolate, args[0 ].As <Object>());
387394 p->propBag .Reset (isolate, args[2 ].As <Object>());
388- p->target .SetWeak (
389- p, AsyncWrap::WeakCallback, v8::WeakCallbackType::kParameter );
395+ p->target .SetWeak (p, AsyncWrap::WeakCallback, WeakCallbackType::kParameter );
390396}
391397
392398
@@ -460,8 +466,8 @@ void AsyncWrap::Initialize(Local<Object> target,
460466 env->SetMethod (target, " disablePromiseHook" , DisablePromiseHook);
461467 env->SetMethod (target, " registerDestroyHook" , RegisterDestroyHook);
462468
463- v8:: PropertyAttribute ReadOnlyDontDelete =
464- static_cast <v8:: PropertyAttribute>(v8:: ReadOnly | v8:: DontDelete);
469+ PropertyAttribute ReadOnlyDontDelete =
470+ static_cast <PropertyAttribute>(ReadOnly | DontDelete);
465471
466472#define FORCE_SET_TARGET_FIELD (obj, str, field ) \
467473 (obj)->DefineOwnProperty (context, \
@@ -707,7 +713,7 @@ MaybeLocal<Value> AsyncWrap::MakeCallback(const Local<Function> cb,
707713
708714async_id AsyncHooksGetExecutionAsyncId (Isolate* isolate) {
709715 // Environment::GetCurrent() allocates a Local<> handle.
710- v8:: HandleScope handle_scope (isolate);
716+ HandleScope handle_scope (isolate);
711717 Environment* env = Environment::GetCurrent (isolate);
712718 if (env == nullptr ) return -1 ;
713719 return env->execution_async_id ();
@@ -716,7 +722,7 @@ async_id AsyncHooksGetExecutionAsyncId(Isolate* isolate) {
716722
717723async_id AsyncHooksGetTriggerAsyncId (Isolate* isolate) {
718724 // Environment::GetCurrent() allocates a Local<> handle.
719- v8:: HandleScope handle_scope (isolate);
725+ HandleScope handle_scope (isolate);
720726 Environment* env = Environment::GetCurrent (isolate);
721727 if (env == nullptr ) return -1 ;
722728 return env->trigger_async_id ();
@@ -727,18 +733,18 @@ async_context EmitAsyncInit(Isolate* isolate,
727733 Local<Object> resource,
728734 const char * name,
729735 async_id trigger_async_id) {
730- v8:: HandleScope handle_scope (isolate);
736+ HandleScope handle_scope (isolate);
731737 Local<String> type =
732- String::NewFromUtf8 (isolate, name, v8:: NewStringType::kInternalized )
738+ String::NewFromUtf8 (isolate, name, NewStringType::kInternalized )
733739 .ToLocalChecked ();
734740 return EmitAsyncInit (isolate, resource, type, trigger_async_id);
735741}
736742
737743async_context EmitAsyncInit (Isolate* isolate,
738744 Local<Object> resource,
739- v8:: Local<v8:: String> name,
745+ Local<String> name,
740746 async_id trigger_async_id) {
741- v8:: HandleScope handle_scope (isolate);
747+ HandleScope handle_scope (isolate);
742748 Environment* env = Environment::GetCurrent (isolate);
743749 CHECK_NOT_NULL (env);
744750
@@ -760,7 +766,7 @@ async_context EmitAsyncInit(Isolate* isolate,
760766
761767void EmitAsyncDestroy (Isolate* isolate, async_context asyncContext) {
762768 // Environment::GetCurrent() allocates a Local<> handle.
763- v8:: HandleScope handle_scope (isolate);
769+ HandleScope handle_scope (isolate);
764770 AsyncWrap::EmitDestroy (
765771 Environment::GetCurrent (isolate), asyncContext.async_id );
766772}
@@ -779,10 +785,10 @@ Local<Object> AsyncWrap::GetOwner() {
779785}
780786
781787Local<Object> AsyncWrap::GetOwner (Environment* env, Local<Object> obj) {
782- v8:: EscapableHandleScope handle_scope (env->isolate ());
788+ EscapableHandleScope handle_scope (env->isolate ());
783789 CHECK (!obj.IsEmpty ());
784790
785- v8:: TryCatch ignore_exceptions (env->isolate ());
791+ TryCatch ignore_exceptions (env->isolate ());
786792 while (true ) {
787793 Local<Value> owner;
788794 if (!obj->Get (env->context (),
0 commit comments