GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: promote v8 name spaces with using · nodejs/node@be86ddb

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
+45-35Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,14 @@ using v8::Array;
132132
using v8::ArrayBuffer;
133133
using v8::Boolean;
134134
using v8::Context;
135+
using v8::DEFAULT;
136+
using v8::DontEnum;
135137
using v8::EscapableHandleScope;
136138
using v8::Exception;
137139
using v8::Function;
138140
using v8::FunctionCallbackInfo;
139141
using v8::HandleScope;
142+
using v8::Int32;
140143
using v8::Integer;
141144
using v8::Isolate;
142145
using v8::Just;
@@ -145,19 +148,27 @@ using v8::Locker;
145148
using v8::Maybe;
146149
using v8::MaybeLocal;
147150
using v8::Message;
151+
using v8::MicrotasksPolicy;
148152
using v8::Name;
149153
using v8::NamedPropertyHandlerConfiguration;
154+
using v8::NewStringType;
155+
using v8::None;
150156
using v8::Nothing;
151157
using v8::Null;
152158
using v8::Number;
153159
using v8::Object;
154160
using v8::ObjectTemplate;
155161
using v8::Promise;
162+
using v8::PropertyAttribute;
156163
using v8::PropertyCallbackInfo;
164+
using v8::ReadOnly;
165+
using v8::Script;
166+
using v8::ScriptCompiler;
157167
using v8::ScriptOrigin;
158168
using v8::SealHandleScope;
159169
using v8::SideEffectType;
160170
using v8::String;
171+
using v8::TracingController;
161172
using v8::TryCatch;
162173
using v8::Undefined;
163174
using v8::V8;
@@ -190,12 +201,12 @@ std::shared_ptr<PerProcessOptions> per_process_opts {
190201
new PerProcessOptions() };
191202

192203
static Mutex node_isolate_mutex;
193-
static v8::Isolate* node_isolate;
204+
static Isolate* node_isolate;
194205

195206
// Ensures that __metadata trace events are only emitted
196207
// when tracing is enabled.
197208
class NodeTraceStateObserver :
198-
public v8::TracingController::TraceStateObserver {
209+
public TracingController::TraceStateObserver {
199210
public:
200211
void OnTraceEnabled() override {
201212
char name_buffer[512];
@@ -278,12 +289,12 @@ class NodeTraceStateObserver :
278289
UNREACHABLE();
279290
}
280291

281-
explicit NodeTraceStateObserver(v8::TracingController* controller) :
292+
explicit NodeTraceStateObserver(TracingController* controller) :
282293
controller_(controller) {}
283294
~NodeTraceStateObserver() override {}
284295

285296
private:
286-
v8::TracingController* controller_;
297+
TracingController* controller_;
287298
};
288299

289300
static struct {
@@ -692,20 +703,20 @@ bool ShouldAbortOnUncaughtException(Isolate* isolate) {
692703
} // anonymous namespace
693704

694705

695-
void AddPromiseHook(v8::Isolate* isolate, promise_hook_func fn, void* arg) {
706+
void AddPromiseHook(Isolate* isolate, promise_hook_func fn, void* arg) {
696707
Environment* env = Environment::GetCurrent(isolate);
697708
env->AddPromiseHook(fn, arg);
698709
}
699710

700-
void AddEnvironmentCleanupHook(v8::Isolate* isolate,
711+
void AddEnvironmentCleanupHook(Isolate* isolate,
701712
void (*fun)(void* arg),
702713
void* arg) {
703714
Environment* env = Environment::GetCurrent(isolate);
704715
env->AddCleanupHook(fun, arg);
705716
}
706717

707718

708-
void RemoveEnvironmentCleanupHook(v8::Isolate* isolate,
719+
void RemoveEnvironmentCleanupHook(Isolate* isolate,
709720
void (*fun)(void* arg),
710721
void* arg) {
711722
Environment* env = Environment::GetCurrent(isolate);
@@ -759,7 +770,7 @@ MaybeLocal<Value> MakeCallback(Isolate* isolate,
759770
Local<Value> argv[],
760771
async_context asyncContext) {
761772
Local<String> method_string =
762-
String::NewFromUtf8(isolate, method, v8::NewStringType::kNormal)
773+
String::NewFromUtf8(isolate, method, NewStringType::kNormal)
763774
.ToLocalChecked();
764775
return MakeCallback(isolate, recv, method_string, argc, argv, asyncContext);
765776
}
@@ -945,7 +956,7 @@ void AppendExceptionLine(Environment* env,
945956
arrow[off + 1] = '\0';
946957

947958
Local<String> arrow_str = String::NewFromUtf8(env->isolate(), arrow,
948-
v8::NewStringType::kNormal).ToLocalChecked();
959+
NewStringType::kNormal).ToLocalChecked();
949960

950961
const bool can_set_arrow = !arrow_str.IsEmpty() && !err_obj.IsEmpty();
951962
// If allocating arrow_str failed, print it out. There's not much else to do.
@@ -1071,8 +1082,8 @@ static MaybeLocal<Value> ExecuteString(Environment* env,
10711082
try_catch.SetVerbose(false);
10721083

10731084
ScriptOrigin origin(filename);
1074-
MaybeLocal<v8::Script> script =
1075-
v8::Script::Compile(env->context(), source, &origin);
1085+
MaybeLocal<Script> script =
1086+
Script::Compile(env->context(), source, &origin);
10761087
if (script.IsEmpty()) {
10771088
ReportException(env, try_catch);
10781089
env->Exit(3);
@@ -1525,7 +1536,7 @@ void FatalException(Isolate* isolate,
15251536
!code->IsInt32()) {
15261537
exit(1);
15271538
}
1528-
exit(code.As<v8::Int32>()->Value());
1539+
exit(code.As<Int32>()->Value());
15291540
}
15301541
}
15311542
}
@@ -1574,20 +1585,20 @@ static Maybe<bool> ProcessEmitWarningGeneric(Environment* env,
15741585
// do proper error checking for string creation.
15751586
if (!String::NewFromUtf8(env->isolate(),
15761587
warning,
1577-
v8::NewStringType::kNormal).ToLocal(&args[argc++])) {
1588+
NewStringType::kNormal).ToLocal(&args[argc++])) {
15781589
return Nothing<bool>();
15791590
}
15801591
if (type != nullptr) {
15811592
if (!String::NewFromOneByte(env->isolate(),
15821593
reinterpret_cast<const uint8_t*>(type),
1583-
v8::NewStringType::kNormal)
1594+
NewStringType::kNormal)
15841595
.ToLocal(&args[argc++])) {
15851596
return Nothing<bool>();
15861597
}
15871598
if (code != nullptr &&
15881599
!String::NewFromOneByte(env->isolate(),
15891600
reinterpret_cast<const uint8_t*>(code),
1590-
v8::NewStringType::kNormal)
1601+
NewStringType::kNormal)
15911602
.ToLocal(&args[argc++])) {
15921603
return Nothing<bool>();
15931604
}
@@ -1732,7 +1743,7 @@ static void GetLinkedBinding(const FunctionCallbackInfo<Value>& args) {
17321743
Local<Object> module = Object::New(env->isolate());
17331744
Local<Object> exports = Object::New(env->isolate());
17341745
Local<String> exports_prop = String::NewFromUtf8(env->isolate(), "exports",
1735-
v8::NewStringType::kNormal).ToLocalChecked();
1746+
NewStringType::kNormal).ToLocalChecked();
17361747
module->Set(exports_prop, exports);
17371748

17381749
if (mod->nm_context_register_func != nullptr) {
@@ -1816,16 +1827,15 @@ namespace {
18161827
obj->DefineOwnProperty(env->context(), \
18171828
OneByteString(env->isolate(), str), \
18181829
var, \
1819-
v8::ReadOnly).FromJust(); \
1830+
ReadOnly).FromJust(); \
18201831
} while (0)
18211832

18221833
#define READONLY_DONT_ENUM_PROPERTY(obj, str, var) \
18231834
do { \
18241835
obj->DefineOwnProperty(env->context(), \
18251836
OneByteString(env->isolate(), str), \
18261837
var, \
1827-
static_cast<v8::PropertyAttribute>(v8::ReadOnly | \
1828-
v8::DontEnum)) \
1838+
static_cast<PropertyAttribute>(ReadOnly|DontEnum)) \
18291839
.FromJust(); \
18301840
} while (0)
18311841

@@ -1845,8 +1855,8 @@ void SetupProcessObject(Environment* env,
18451855
ProcessTitleGetter,
18461856
env->is_main_thread() ? ProcessTitleSetter : nullptr,
18471857
env->as_external(),
1848-
v8::DEFAULT,
1849-
v8::None,
1858+
DEFAULT,
1859+
None,
18501860
SideEffectType::kHasNoSideEffect).FromJust());
18511861

18521862
// process.version
@@ -1975,7 +1985,7 @@ void SetupProcessObject(Environment* env,
19751985
for (size_t i = 0; i < args.size(); ++i) {
19761986
arguments->Set(env->context(), i,
19771987
String::NewFromUtf8(env->isolate(), args[i].c_str(),
1978-
v8::NewStringType::kNormal).ToLocalChecked())
1988+
NewStringType::kNormal).ToLocalChecked())
19791989
.FromJust();
19801990
}
19811991
process->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "argv"), arguments);
@@ -1985,7 +1995,7 @@ void SetupProcessObject(Environment* env,
19851995
for (size_t i = 0; i < exec_args.size(); ++i) {
19861996
exec_arguments->Set(env->context(), i,
19871997
String::NewFromUtf8(env->isolate(), exec_args[i].c_str(),
1988-
v8::NewStringType::kNormal).ToLocalChecked())
1998+
NewStringType::kNormal).ToLocalChecked())
19891999
.FromJust();
19902000
}
19912001
process->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "execArgv"),
@@ -2021,7 +2031,7 @@ void SetupProcessObject(Environment* env,
20212031
String::NewFromUtf8(
20222032
env->isolate(),
20232033
env->options()->eval_string.c_str(),
2024-
v8::NewStringType::kNormal).ToLocalChecked());
2034+
NewStringType::kNormal).ToLocalChecked());
20252035
}
20262036

20272037
// -p, --print
@@ -2047,7 +2057,7 @@ void SetupProcessObject(Environment* env,
20472057
for (unsigned int i = 0; i < preload_modules.size(); ++i) {
20482058
Local<String> module = String::NewFromUtf8(env->isolate(),
20492059
preload_modules[i].c_str(),
2050-
v8::NewStringType::kNormal)
2060+
NewStringType::kNormal)
20512061
.ToLocalChecked();
20522062
array->Set(i, module);
20532063
}
@@ -2134,11 +2144,11 @@ void SetupProcessObject(Environment* env,
21342144
if (uv_exepath(exec_path, &exec_path_len) == 0) {
21352145
exec_path_value = String::NewFromUtf8(env->isolate(),
21362146
exec_path,
2137-
v8::NewStringType::kInternalized,
2147+
NewStringType::kInternalized,
21382148
exec_path_len).ToLocalChecked();
21392149
} else {
21402150
exec_path_value = String::NewFromUtf8(env->isolate(), args[0].c_str(),
2141-
v8::NewStringType::kInternalized).ToLocalChecked();
2151+
NewStringType::kInternalized).ToLocalChecked();
21422152
}
21432153
process->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "execPath"),
21442154
exec_path_value);
@@ -2302,15 +2312,15 @@ void LoadEnvironment(Environment* env) {
23022312
global->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "global"), global);
23032313

23042314
// Create binding loaders
2305-
v8::Local<v8::Function> get_binding_fn =
2315+
Local<Function> get_binding_fn =
23062316
env->NewFunctionTemplate(GetBinding)->GetFunction(env->context())
23072317
.ToLocalChecked();
23082318

2309-
v8::Local<v8::Function> get_linked_binding_fn =
2319+
Local<Function> get_linked_binding_fn =
23102320
env->NewFunctionTemplate(GetLinkedBinding)->GetFunction(env->context())
23112321
.ToLocalChecked();
23122322

2313-
v8::Local<v8::Function> get_internal_binding_fn =
2323+
Local<Function> get_internal_binding_fn =
23142324
env->NewFunctionTemplate(GetInternalBinding)->GetFunction(env->context())
23152325
.ToLocalChecked();
23162326

@@ -2842,7 +2852,7 @@ void RunAtExit(Environment* env) {
28422852
}
28432853

28442854

2845-
uv_loop_t* GetCurrentEventLoop(v8::Isolate* isolate) {
2855+
uv_loop_t* GetCurrentEventLoop(Isolate* isolate) {
28462856
HandleScope handle_scope(isolate);
28472857
auto context = isolate->GetCurrentContext();
28482858
if (context.IsEmpty())
@@ -2984,7 +2994,7 @@ MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform() {
29842994

29852995
MultiIsolatePlatform* CreatePlatform(
29862996
int thread_pool_size,
2987-
v8::TracingController* tracing_controller) {
2997+
TracingController* tracing_controller) {
29882998
return new NodePlatform(thread_pool_size, tracing_controller);
29892999
}
29903000

@@ -3007,8 +3017,8 @@ Local<Context> NewContext(Isolate* isolate,
30073017
// Run lib/internal/per_context.js
30083018
Context::Scope context_scope(context);
30093019
Local<String> per_context = NodePerContextSource(isolate);
3010-
v8::ScriptCompiler::Source per_context_src(per_context, nullptr);
3011-
Local<v8::Script> s = v8::ScriptCompiler::Compile(
3020+
ScriptCompiler::Source per_context_src(per_context, nullptr);
3021+
Local<Script> s = ScriptCompiler::Compile(
30123022
context,
30133023
&per_context_src).ToLocalChecked();
30143024
s->Run(context).ToLocalChecked();
@@ -3117,7 +3127,7 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator) {
31173127

31183128
isolate->AddMessageListener(OnMessage);
31193129
isolate->SetAbortOnUncaughtExceptionCallback(ShouldAbortOnUncaughtException);
3120-
isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit);
3130+
isolate->SetMicrotasksPolicy(MicrotasksPolicy::kExplicit);
31213131
isolate->SetFatalErrorHandler(OnFatalError);
31223132
isolate->SetAllowWasmCodeGenerationCallback(AllowWasmCodeGenerationCallback);
31233133

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.