@@ -73,33 +73,14 @@ inline worker::Worker* IsolateData::worker_context() const {
73
73
return worker_context_;
74
74
}
75
75
76
+ SnapshotReadData* IsolateData::snapshot_data () const {
77
+ return snapshot_data_;
78
+ }
79
+
76
80
inline v8::Local<v8::String> IsolateData::async_wrap_provider (int index) const {
77
81
return async_wrap_providers_[index ].Get (isolate_);
78
82
}
79
83
80
- inline AsyncHooks::AsyncHooks ()
81
- : async_ids_stack_(env()->isolate(), 16 * 2),
82
- fields_(env()->isolate(), kFieldsCount),
83
- async_id_fields_(env()->isolate(), kUidFieldsCount) {
84
- clear_async_id_stack ();
85
-
86
- // Always perform async_hooks checks, not just when async_hooks is enabled.
87
- // TODO(AndreasMadsen): Consider removing this for LTS releases.
88
- // See discussion in https://github.com/nodejs/node/pull/15454
89
- // When removing this, do it by reverting the commit. Otherwise the test
90
- // and flag changes won't be included.
91
- fields_[kCheck ] = 1 ;
92
-
93
- // kDefaultTriggerAsyncId should be -1, this indicates that there is no
94
- // specified default value and it should fallback to the executionAsyncId.
95
- // 0 is not used as the magic value, because that indicates a missing context
96
- // which is different from a default context.
97
- async_id_fields_[AsyncHooks::kDefaultTriggerAsyncId ] = -1 ;
98
-
99
- // kAsyncIdCounter should start at 1 because that'll be the id the execution
100
- // context during bootstrap (code that runs before entering uv_run()).
101
- async_id_fields_[AsyncHooks::kAsyncIdCounter ] = 1 ;
102
- }
103
84
inline AliasedUint32Array& AsyncHooks::fields () {
104
85
return fields_;
105
86
}
@@ -128,6 +109,10 @@ inline Environment* AsyncHooks::env() {
128
109
return Environment::ForAsyncHooks (this );
129
110
}
130
111
112
+ inline const Environment* AsyncHooks::env () const {
113
+ return Environment::ForAsyncHooks (const_cast <AsyncHooks*>(this ));
114
+ }
115
+
131
116
// Remember to keep this code aligned with pushAsyncContext() in JS.
132
117
inline void AsyncHooks::push_async_context (double async_id,
133
118
double trigger_async_id,
@@ -238,9 +223,6 @@ inline void Environment::PopAsyncCallbackScope() {
238
223
async_callback_scope_depth_--;
239
224
}
240
225
241
- inline ImmediateInfo::ImmediateInfo (v8::Isolate* isolate)
242
- : fields_(isolate, kFieldsCount ) {}
243
-
244
226
inline AliasedUint32Array& ImmediateInfo::fields () {
245
227
return fields_;
246
228
}
@@ -265,9 +247,6 @@ inline void ImmediateInfo::ref_count_dec(uint32_t decrement) {
265
247
fields_[kRefCount ] -= decrement;
266
248
}
267
249
268
- inline TickInfo::TickInfo (v8::Isolate* isolate)
269
- : fields_(isolate, kFieldsCount ) {}
270
-
271
250
inline AliasedUint8Array& TickInfo::fields () {
272
251
return fields_;
273
252
}
@@ -467,15 +446,27 @@ inline void Environment::set_is_in_inspector_console_call(bool value) {
467
446
}
468
447
#endif
469
448
449
+ inline const AsyncHooks* Environment::async_hooks () const {
450
+ return &async_hooks_;
451
+ }
452
+
470
453
inline AsyncHooks* Environment::async_hooks () {
471
454
return &async_hooks_;
472
455
}
473
456
457
+ inline const ImmediateInfo* Environment::immediate_info () const {
458
+ return &immediate_info_;
459
+ }
460
+
474
461
inline ImmediateInfo* Environment::immediate_info () {
475
462
return &immediate_info_;
476
463
}
477
464
478
- inline TickInfo* Environment::tick_info () {
465
+ inline const TickInfo* Environment::tick_info () const {
466
+ return &tick_info_;
467
+ }
468
+
469
+ inline TickInfo* Environment::tick_info () {
479
470
return &tick_info_;
480
471
}
481
472
@@ -926,6 +917,10 @@ inline performance::PerformanceState* Environment::performance_state() {
926
917
return performance_state_.get ();
927
918
}
928
919
920
+ const performance::PerformanceState* Environment::performance_state () const {
921
+ return performance_state_.get ();
922
+ }
923
+
929
924
inline std::unordered_map<std::string, uint64_t >*
930
925
Environment::performance_marks () {
931
926
return &performance_marks_;
@@ -1213,7 +1208,7 @@ BaseObject* CleanupHookCallback::GetBaseObject() const {
1213
1208
}
1214
1209
1215
1210
template <typename T>
1216
- void Environment::ForEachBaseObject (T&& iterator) {
1211
+ void Environment::ForEachBaseObject (T&& iterator) const {
1217
1212
for (const auto & hook : cleanup_hooks_) {
1218
1213
BaseObject* obj = hook.GetBaseObject ();
1219
1214
if (obj != nullptr )
0 commit comments