From 8b3b973b2e3814c5cdf4ab905730466f400bc517 Mon Sep 17 00:00:00 2001 From: Gireesh Punathil Date: Sat, 1 Sep 2018 12:19:02 +0530 Subject: [PATCH] src: promote v8 name spaces with using MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit there are several places where v8 artifacts appear with scope resolution operator inline with the source. Elevate them for improved readability as well as to follow the convention. PR-URL: https://github.com/nodejs/node/pull/22641 Reviewed-By: Michaƫl Zasso Reviewed-By: Ruben Bridgewater Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- src/node.cc | 80 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/src/node.cc b/src/node.cc index f7835c47f31d3b..9a85991a295aeb 100644 --- a/src/node.cc +++ b/src/node.cc @@ -132,11 +132,14 @@ using v8::Array; using v8::ArrayBuffer; using v8::Boolean; using v8::Context; +using v8::DEFAULT; +using v8::DontEnum; using v8::EscapableHandleScope; using v8::Exception; using v8::Function; using v8::FunctionCallbackInfo; using v8::HandleScope; +using v8::Int32; using v8::Integer; using v8::Isolate; using v8::Just; @@ -145,19 +148,27 @@ using v8::Locker; using v8::Maybe; using v8::MaybeLocal; using v8::Message; +using v8::MicrotasksPolicy; using v8::Name; using v8::NamedPropertyHandlerConfiguration; +using v8::NewStringType; +using v8::None; using v8::Nothing; using v8::Null; using v8::Number; using v8::Object; using v8::ObjectTemplate; using v8::Promise; +using v8::PropertyAttribute; using v8::PropertyCallbackInfo; +using v8::ReadOnly; +using v8::Script; +using v8::ScriptCompiler; using v8::ScriptOrigin; using v8::SealHandleScope; using v8::SideEffectType; using v8::String; +using v8::TracingController; using v8::TryCatch; using v8::Undefined; using v8::V8; @@ -190,12 +201,12 @@ std::shared_ptr per_process_opts { new PerProcessOptions() }; static Mutex node_isolate_mutex; -static v8::Isolate* node_isolate; +static Isolate* node_isolate; // Ensures that __metadata trace events are only emitted // when tracing is enabled. class NodeTraceStateObserver : - public v8::TracingController::TraceStateObserver { + public TracingController::TraceStateObserver { public: void OnTraceEnabled() override { char name_buffer[512]; @@ -278,12 +289,12 @@ class NodeTraceStateObserver : UNREACHABLE(); } - explicit NodeTraceStateObserver(v8::TracingController* controller) : + explicit NodeTraceStateObserver(TracingController* controller) : controller_(controller) {} ~NodeTraceStateObserver() override {} private: - v8::TracingController* controller_; + TracingController* controller_; }; static struct { @@ -692,12 +703,12 @@ bool ShouldAbortOnUncaughtException(Isolate* isolate) { } // anonymous namespace -void AddPromiseHook(v8::Isolate* isolate, promise_hook_func fn, void* arg) { +void AddPromiseHook(Isolate* isolate, promise_hook_func fn, void* arg) { Environment* env = Environment::GetCurrent(isolate); env->AddPromiseHook(fn, arg); } -void AddEnvironmentCleanupHook(v8::Isolate* isolate, +void AddEnvironmentCleanupHook(Isolate* isolate, void (*fun)(void* arg), void* arg) { Environment* env = Environment::GetCurrent(isolate); @@ -705,7 +716,7 @@ void AddEnvironmentCleanupHook(v8::Isolate* isolate, } -void RemoveEnvironmentCleanupHook(v8::Isolate* isolate, +void RemoveEnvironmentCleanupHook(Isolate* isolate, void (*fun)(void* arg), void* arg) { Environment* env = Environment::GetCurrent(isolate); @@ -759,7 +770,7 @@ MaybeLocal MakeCallback(Isolate* isolate, Local argv[], async_context asyncContext) { Local method_string = - String::NewFromUtf8(isolate, method, v8::NewStringType::kNormal) + String::NewFromUtf8(isolate, method, NewStringType::kNormal) .ToLocalChecked(); return MakeCallback(isolate, recv, method_string, argc, argv, asyncContext); } @@ -945,7 +956,7 @@ void AppendExceptionLine(Environment* env, arrow[off + 1] = '\0'; Local arrow_str = String::NewFromUtf8(env->isolate(), arrow, - v8::NewStringType::kNormal).ToLocalChecked(); + NewStringType::kNormal).ToLocalChecked(); const bool can_set_arrow = !arrow_str.IsEmpty() && !err_obj.IsEmpty(); // If allocating arrow_str failed, print it out. There's not much else to do. @@ -1071,8 +1082,8 @@ static MaybeLocal ExecuteString(Environment* env, try_catch.SetVerbose(false); ScriptOrigin origin(filename); - MaybeLocal script = - v8::Script::Compile(env->context(), source, &origin); + MaybeLocal