2828#include " v8-profiler.h"
2929
3030using v8::Context;
31+ using v8::DontDelete;
32+ using v8::EscapableHandleScope;
3133using v8::Function;
3234using v8::FunctionCallbackInfo;
3335using v8::FunctionTemplate;
@@ -36,16 +38,22 @@ using v8::Integer;
3638using v8::Isolate;
3739using v8::Local;
3840using v8::MaybeLocal;
41+ using v8::NewStringType;
3942using v8::Number;
4043using v8::Object;
4144using v8::ObjectTemplate;
4245using v8::Promise;
4346using v8::PromiseHookType;
47+ using v8::PropertyAttribute;
4448using v8::PropertyCallbackInfo;
49+ using v8::ReadOnly;
4550using v8::String;
51+ using v8::TryCatch;
4652using v8::Uint32;
4753using v8::Undefined;
4854using v8::Value;
55+ using v8::WeakCallbackInfo;
56+ using v8::WeakCallbackType;
4957
5058using AsyncHooks = node::Environment::AsyncHooks;
5159
@@ -115,7 +123,7 @@ void Emit(Environment* env, double async_id, AsyncHooks::Fields type,
115123 if (async_hooks->fields ()[type] == 0 || !env->can_call_into_js ())
116124 return ;
117125
118- v8:: HandleScope handle_scope (env->isolate ());
126+ HandleScope handle_scope (env->isolate ());
119127 Local<Value> async_id_value = Number::New (env->isolate (), async_id);
120128 FatalTryCatch try_catch (env);
121129 USE (fn->Call (env->context (), Undefined (env->isolate ()), 1 , &async_id_value));
@@ -351,8 +359,7 @@ class DestroyParam {
351359 Persistent<Object> propBag;
352360};
353361
354-
355- void AsyncWrap::WeakCallback (const v8::WeakCallbackInfo<DestroyParam>& info) {
362+ void AsyncWrap::WeakCallback (const WeakCallbackInfo<DestroyParam>& info) {
356363 HandleScope scope (info.GetIsolate ());
357364
358365 std::unique_ptr<DestroyParam> p{info.GetParameter ()};
@@ -377,8 +384,7 @@ static void RegisterDestroyHook(const FunctionCallbackInfo<Value>& args) {
377384 p->env = Environment::GetCurrent (args);
378385 p->target .Reset (isolate, args[0 ].As <Object>());
379386 p->propBag .Reset (isolate, args[2 ].As <Object>());
380- p->target .SetWeak (
381- p, AsyncWrap::WeakCallback, v8::WeakCallbackType::kParameter );
387+ p->target .SetWeak (p, AsyncWrap::WeakCallback, WeakCallbackType::kParameter );
382388}
383389
384390
@@ -452,8 +458,8 @@ void AsyncWrap::Initialize(Local<Object> target,
452458 env->SetMethod (target, " disablePromiseHook" , DisablePromiseHook);
453459 env->SetMethod (target, " registerDestroyHook" , RegisterDestroyHook);
454460
455- v8:: PropertyAttribute ReadOnlyDontDelete =
456- static_cast <v8:: PropertyAttribute>(v8:: ReadOnly | v8:: DontDelete);
461+ PropertyAttribute ReadOnlyDontDelete =
462+ static_cast <PropertyAttribute>(ReadOnly | DontDelete);
457463
458464#define FORCE_SET_TARGET_FIELD (obj, str, field ) \
459465 (obj)->DefineOwnProperty (context, \
@@ -695,7 +701,7 @@ MaybeLocal<Value> AsyncWrap::MakeCallback(const Local<Function> cb,
695701
696702async_id AsyncHooksGetExecutionAsyncId (Isolate* isolate) {
697703 // Environment::GetCurrent() allocates a Local<> handle.
698- v8:: HandleScope handle_scope (isolate);
704+ HandleScope handle_scope (isolate);
699705 Environment* env = Environment::GetCurrent (isolate);
700706 if (env == nullptr ) return -1 ;
701707 return env->execution_async_id ();
@@ -704,7 +710,7 @@ async_id AsyncHooksGetExecutionAsyncId(Isolate* isolate) {
704710
705711async_id AsyncHooksGetTriggerAsyncId (Isolate* isolate) {
706712 // Environment::GetCurrent() allocates a Local<> handle.
707- v8:: HandleScope handle_scope (isolate);
713+ HandleScope handle_scope (isolate);
708714 Environment* env = Environment::GetCurrent (isolate);
709715 if (env == nullptr ) return -1 ;
710716 return env->trigger_async_id ();
@@ -715,18 +721,18 @@ async_context EmitAsyncInit(Isolate* isolate,
715721 Local<Object> resource,
716722 const char * name,
717723 async_id trigger_async_id) {
718- v8:: HandleScope handle_scope (isolate);
724+ HandleScope handle_scope (isolate);
719725 Local<String> type =
720- String::NewFromUtf8 (isolate, name, v8:: NewStringType::kInternalized )
726+ String::NewFromUtf8 (isolate, name, NewStringType::kInternalized )
721727 .ToLocalChecked ();
722728 return EmitAsyncInit (isolate, resource, type, trigger_async_id);
723729}
724730
725731async_context EmitAsyncInit (Isolate* isolate,
726732 Local<Object> resource,
727- v8:: Local<v8:: String> name,
733+ Local<String> name,
728734 async_id trigger_async_id) {
729- v8:: HandleScope handle_scope (isolate);
735+ HandleScope handle_scope (isolate);
730736 Environment* env = Environment::GetCurrent (isolate);
731737 CHECK_NOT_NULL (env);
732738
@@ -748,7 +754,7 @@ async_context EmitAsyncInit(Isolate* isolate,
748754
749755void EmitAsyncDestroy (Isolate* isolate, async_context asyncContext) {
750756 // Environment::GetCurrent() allocates a Local<> handle.
751- v8:: HandleScope handle_scope (isolate);
757+ HandleScope handle_scope (isolate);
752758 AsyncWrap::EmitDestroy (
753759 Environment::GetCurrent (isolate), asyncContext.async_id );
754760}
@@ -767,10 +773,10 @@ Local<Object> AsyncWrap::GetOwner() {
767773}
768774
769775Local<Object> AsyncWrap::GetOwner (Environment* env, Local<Object> obj) {
770- v8:: EscapableHandleScope handle_scope (env->isolate ());
776+ EscapableHandleScope handle_scope (env->isolate ());
771777 CHECK (!obj.IsEmpty ());
772778
773- v8:: TryCatch ignore_exceptions (env->isolate ());
779+ TryCatch ignore_exceptions (env->isolate ());
774780 while (true ) {
775781 Local<Value> owner;
776782 if (!obj->Get (env->context (),
0 commit comments