15
15
namespace node {
16
16
17
17
using v8::Context;
18
+ using v8::EmbedderGraph;
19
+ using v8::External;
18
20
using v8::Function;
19
21
using v8::FunctionTemplate;
20
22
using v8::HandleScope;
21
23
using v8::Integer;
22
24
using v8::Isolate;
23
25
using v8::Local;
24
26
using v8::Message;
27
+ using v8::NewStringType;
25
28
using v8::Number;
29
+ using v8::Object;
26
30
using v8::Private;
31
+ using v8::Promise;
32
+ using v8::PromiseHookType;
27
33
using v8::StackFrame;
28
34
using v8::StackTrace;
29
35
using v8::String;
30
36
using v8::Symbol;
37
+ using v8::TracingController;
31
38
using v8::TryCatch;
39
+ using v8::Undefined;
32
40
using v8::Value;
33
41
using worker::Worker;
34
42
@@ -89,7 +97,7 @@ IsolateData::IsolateData(Isolate* isolate,
89
97
String::NewFromOneByte ( \
90
98
isolate, \
91
99
reinterpret_cast <const uint8_t *>(StringValue), \
92
- v8:: NewStringType::kInternalized , \
100
+ NewStringType::kInternalized , \
93
101
sizeof (StringValue) - 1 ).ToLocalChecked ()));
94
102
PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES (V)
95
103
#undef V
@@ -101,7 +109,7 @@ IsolateData::IsolateData(Isolate* isolate,
101
109
String::NewFromOneByte ( \
102
110
isolate, \
103
111
reinterpret_cast <const uint8_t *>(StringValue), \
104
- v8:: NewStringType::kInternalized , \
112
+ NewStringType::kInternalized , \
105
113
sizeof (StringValue) - 1 ).ToLocalChecked ()));
106
114
PER_ISOLATE_SYMBOL_PROPERTIES (V)
107
115
#undef V
@@ -111,7 +119,7 @@ IsolateData::IsolateData(Isolate* isolate,
111
119
String::NewFromOneByte ( \
112
120
isolate, \
113
121
reinterpret_cast <const uint8_t *>(StringValue), \
114
- v8:: NewStringType::kInternalized , \
122
+ NewStringType::kInternalized , \
115
123
sizeof (StringValue) - 1 ).ToLocalChecked ());
116
124
PER_ISOLATE_STRING_PROPERTIES (V)
117
125
#undef V
@@ -149,7 +157,7 @@ void Environment::TrackingTraceStateObserver::UpdateTraceCategoryState() {
149
157
return ;
150
158
TryCatch try_catch (isolate);
151
159
try_catch.SetVerbose (true );
152
- cb->Call (env_->context (), v8:: Undefined (isolate),
160
+ cb->Call (env_->context (), Undefined (isolate),
153
161
0 , nullptr ).ToLocalChecked ();
154
162
}
155
163
@@ -173,9 +181,9 @@ Environment::Environment(IsolateData* isolate_data,
173
181
fs_stats_field_bigint_array_(isolate_, kFsStatsBufferLength ),
174
182
context_(context->GetIsolate (), context) {
175
183
// We'll be creating new objects so make sure we've entered the context.
176
- v8:: HandleScope handle_scope (isolate ());
177
- v8:: Context::Scope context_scope (context);
178
- set_as_external (v8:: External::New (isolate (), this ));
184
+ HandleScope handle_scope (isolate ());
185
+ Context::Scope context_scope (context);
186
+ set_as_external (External::New (isolate (), this ));
179
187
180
188
// We create new copies of the per-Environment option sets, so that it is
181
189
// easier to modify them after Environment creation. The defaults are
@@ -194,7 +202,7 @@ Environment::Environment(IsolateData* isolate_data,
194
202
195
203
if (tracing::AgentWriterHandle* writer = GetTracingAgentWriter ()) {
196
204
trace_state_observer_ = std::make_unique<TrackingTraceStateObserver>(this );
197
- v8:: TracingController* tracing_controller = writer->GetTracingController ();
205
+ TracingController* tracing_controller = writer->GetTracingController ();
198
206
if (tracing_controller != nullptr )
199
207
tracing_controller->AddTraceStateObserver (trace_state_observer_.get ());
200
208
}
@@ -232,7 +240,7 @@ Environment::~Environment() {
232
240
// CleanupHandles() should have removed all of them.
233
241
CHECK (file_handle_read_wrap_freelist_.empty ());
234
242
235
- v8:: HandleScope handle_scope (isolate ());
243
+ HandleScope handle_scope (isolate ());
236
244
237
245
#if HAVE_INSPECTOR
238
246
// Destroy inspector agent before erasing the context. The inspector
@@ -246,7 +254,7 @@ Environment::~Environment() {
246
254
if (trace_state_observer_) {
247
255
tracing::AgentWriterHandle* writer = GetTracingAgentWriter ();
248
256
CHECK_NOT_NULL (writer);
249
- v8:: TracingController* tracing_controller = writer->GetTracingController ();
257
+ TracingController* tracing_controller = writer->GetTracingController ();
250
258
if (tracing_controller != nullptr )
251
259
tracing_controller->RemoveTraceStateObserver (trace_state_observer_.get ());
252
260
}
@@ -410,7 +418,7 @@ void Environment::PrintSyncTrace() const {
410
418
return ;
411
419
412
420
HandleScope handle_scope (isolate ());
413
- Local<v8:: StackTrace> stack =
421
+ Local<StackTrace> stack =
414
422
StackTrace::CurrentStackTrace (isolate (), 10 , StackTrace::kDetailed );
415
423
416
424
fprintf (stderr, " (node:%d) WARNING: Detected use of sync API\n " ,
@@ -545,10 +553,10 @@ bool Environment::RemovePromiseHook(promise_hook_func fn, void* arg) {
545
553
return true ;
546
554
}
547
555
548
- void Environment::EnvPromiseHook (v8:: PromiseHookType type,
549
- v8:: Local<v8:: Promise> promise,
550
- v8:: Local<v8:: Value> parent) {
551
- Local<v8:: Context> context = promise->CreationContext ();
556
+ void Environment::EnvPromiseHook (PromiseHookType type,
557
+ Local<Promise> promise,
558
+ Local<Value> parent) {
559
+ Local<Context> context = promise->CreationContext ();
552
560
553
561
Environment* env = Environment::GetCurrent (context);
554
562
if (env == nullptr ) return ;
@@ -568,7 +576,7 @@ void Environment::RunAndClearNativeImmediates() {
568
576
std::vector<NativeImmediateCallback> list;
569
577
native_immediate_callbacks_.swap (list);
570
578
auto drain_list = [&]() {
571
- v8:: TryCatch try_catch (isolate ());
579
+ TryCatch try_catch (isolate ());
572
580
for (auto it = list.begin (); it != list.end (); ++it) {
573
581
#ifdef DEBUG
574
582
v8::SealHandleScope seal_handle_scope (isolate ());
@@ -748,7 +756,7 @@ void Environment::set_debug_categories(const std::string& cats, bool enabled) {
748
756
}
749
757
750
758
void CollectExceptionInfo (Environment* env,
751
- v8:: Local<v8:: Object> obj,
759
+ Local<Object> obj,
752
760
int errorno,
753
761
const char * err_string,
754
762
const char * syscall,
@@ -757,7 +765,7 @@ void CollectExceptionInfo(Environment* env,
757
765
const char * dest) {
758
766
obj->Set (env->context (),
759
767
env->errno_string (),
760
- v8:: Integer::New (env->isolate (), errorno)).FromJust ();
768
+ Integer::New (env->isolate (), errorno)).FromJust ();
761
769
762
770
obj->Set (env->context (), env->code_string (),
763
771
OneByteString (env->isolate (), err_string)).FromJust ();
@@ -767,14 +775,14 @@ void CollectExceptionInfo(Environment* env,
767
775
OneByteString (env->isolate (), message)).FromJust ();
768
776
}
769
777
770
- v8:: Local<v8:: Value> path_buffer;
778
+ Local<Value> path_buffer;
771
779
if (path != nullptr ) {
772
780
path_buffer =
773
781
Buffer::Copy (env->isolate (), path, strlen (path)).ToLocalChecked ();
774
782
obj->Set (env->context (), env->path_string (), path_buffer).FromJust ();
775
783
}
776
784
777
- v8:: Local<v8:: Value> dest_buffer;
785
+ Local<Value> dest_buffer;
778
786
if (dest != nullptr ) {
779
787
dest_buffer =
780
788
Buffer::Copy (env->isolate (), dest, strlen (dest)).ToLocalChecked ();
@@ -787,15 +795,15 @@ void CollectExceptionInfo(Environment* env,
787
795
}
788
796
}
789
797
790
- void Environment::CollectExceptionInfo (v8:: Local<v8:: Value> object,
798
+ void Environment::CollectExceptionInfo (Local<Value> object,
791
799
int errorno,
792
800
const char * syscall,
793
801
const char * message,
794
802
const char * path) {
795
803
if (!object->IsObject () || errorno == 0 )
796
804
return ;
797
805
798
- v8:: Local<v8:: Object> obj = object.As <v8:: Object>();
806
+ Local<Object> obj = object.As <Object>();
799
807
const char * err_string = node::errno_string (errorno);
800
808
801
809
if (message == nullptr || message[0 ] == ' \0 ' ) {
@@ -806,7 +814,7 @@ void Environment::CollectExceptionInfo(v8::Local<v8::Value> object,
806
814
syscall , message, path, nullptr );
807
815
}
808
816
809
- void Environment::CollectUVExceptionInfo (v8:: Local<v8:: Value> object,
817
+ void Environment::CollectUVExceptionInfo (Local<Value> object,
810
818
int errorno,
811
819
const char * syscall,
812
820
const char * message,
@@ -815,7 +823,7 @@ void Environment::CollectUVExceptionInfo(v8::Local<v8::Value> object,
815
823
if (!object->IsObject () || errorno == 0 )
816
824
return ;
817
825
818
- v8:: Local<v8:: Object> obj = object.As <v8:: Object>();
826
+ Local<Object> obj = object.As <Object>();
819
827
const char * err_string = uv_err_name (errorno);
820
828
821
829
if (message == nullptr || message[0 ] == ' \0 ' ) {
@@ -854,8 +862,8 @@ void Environment::stop_sub_worker_contexts() {
854
862
}
855
863
}
856
864
857
- void Environment::BuildEmbedderGraph (v8:: Isolate* isolate,
858
- v8:: EmbedderGraph* graph,
865
+ void Environment::BuildEmbedderGraph (Isolate* isolate,
866
+ EmbedderGraph* graph,
859
867
void * data) {
860
868
MemoryTracker tracker (isolate, graph);
861
869
static_cast <Environment*>(data)->ForEachBaseObject ([&](BaseObject* obj) {
0 commit comments