summaryrefslogtreecommitdiff
path: root/src/env-inl.h
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-03-20 19:05:02 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2019-03-27 10:30:09 -0400
commit51970537ee06f824160fcd035b018117ce264345 (patch)
tree824f710fce8db38c858e9deaa604a6964fd3c2bb /src/env-inl.h
parenta8eac78f8dbe778a2aef69d0989416e47c6c403e (diff)
downloadandroid-node-v8-51970537ee06f824160fcd035b018117ce264345.tar.gz
android-node-v8-51970537ee06f824160fcd035b018117ce264345.tar.bz2
android-node-v8-51970537ee06f824160fcd035b018117ce264345.zip
src: move AsyncHooks out of Environment
PR-URL: https://github.com/nodejs/node/pull/26824 Refs: https://github.com/nodejs/node/issues/26776 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/env-inl.h')
-rw-r--r--src/env-inl.h35
1 files changed, 15 insertions, 20 deletions
diff --git a/src/env-inl.h b/src/env-inl.h
index 79c9312e66..8d2327034a 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -64,7 +64,7 @@ inline MultiIsolatePlatform* IsolateData::platform() const {
return platform_;
}
-inline Environment::AsyncHooks::AsyncHooks()
+inline AsyncHooks::AsyncHooks()
: async_ids_stack_(env()->isolate(), 16 * 2),
fields_(env()->isolate(), kFieldsCount),
async_id_fields_(env()->isolate(), kUidFieldsCount) {
@@ -102,36 +102,33 @@ inline Environment::AsyncHooks::AsyncHooks()
#undef V
}
-inline AliasedBuffer<uint32_t, v8::Uint32Array>&
-Environment::AsyncHooks::fields() {
+inline AliasedBuffer<uint32_t, v8::Uint32Array>& AsyncHooks::fields() {
return fields_;
}
-inline AliasedBuffer<double, v8::Float64Array>&
-Environment::AsyncHooks::async_id_fields() {
+inline AliasedBuffer<double, v8::Float64Array>& AsyncHooks::async_id_fields() {
return async_id_fields_;
}
-inline AliasedBuffer<double, v8::Float64Array>&
-Environment::AsyncHooks::async_ids_stack() {
+inline AliasedBuffer<double, v8::Float64Array>& AsyncHooks::async_ids_stack() {
return async_ids_stack_;
}
-inline v8::Local<v8::String> Environment::AsyncHooks::provider_string(int idx) {
+inline v8::Local<v8::String> AsyncHooks::provider_string(int idx) {
return providers_[idx].Get(env()->isolate());
}
-inline void Environment::AsyncHooks::no_force_checks() {
+inline void AsyncHooks::no_force_checks() {
fields_[kCheck] -= 1;
}
-inline Environment* Environment::AsyncHooks::env() {
+inline Environment* AsyncHooks::env() {
return Environment::ForAsyncHooks(this);
}
// Remember to keep this code aligned with pushAsyncIds() in JS.
-inline void Environment::AsyncHooks::push_async_ids(double async_id,
- double trigger_async_id) {
+inline void AsyncHooks::push_async_ids(double async_id,
+ double trigger_async_id) {
// Since async_hooks is experimental, do only perform the check
// when async_hooks is enabled.
if (fields_[kCheck] > 0) {
@@ -150,7 +147,7 @@ inline void Environment::AsyncHooks::push_async_ids(double async_id,
}
// Remember to keep this code aligned with popAsyncIds() in JS.
-inline bool Environment::AsyncHooks::pop_async_id(double async_id) {
+inline bool AsyncHooks::pop_async_id(double async_id) {
// In case of an exception then this may have already been reset, if the
// stack was multiple MakeCallback()'s deep.
if (fields_[kStackLength] == 0) return false;
@@ -183,7 +180,7 @@ inline bool Environment::AsyncHooks::pop_async_id(double async_id) {
}
// Keep in sync with clearAsyncIdStack in lib/internal/async_hooks.js.
-inline void Environment::AsyncHooks::clear_async_id_stack() {
+inline void AsyncHooks::clear_async_id_stack() {
async_id_fields_[kExecutionAsyncId] = 0;
async_id_fields_[kTriggerAsyncId] = 0;
fields_[kStackLength] = 0;
@@ -192,9 +189,8 @@ inline void Environment::AsyncHooks::clear_async_id_stack() {
// The DefaultTriggerAsyncIdScope(AsyncWrap*) constructor is defined in
// async_wrap-inl.h to avoid a circular dependency.
-inline Environment::AsyncHooks::DefaultTriggerAsyncIdScope
- ::DefaultTriggerAsyncIdScope(Environment* env,
- double default_trigger_async_id)
+inline AsyncHooks::DefaultTriggerAsyncIdScope ::DefaultTriggerAsyncIdScope(
+ Environment* env, double default_trigger_async_id)
: async_hooks_(env->async_hooks()) {
if (env->async_hooks()->fields()[AsyncHooks::kCheck] > 0) {
CHECK_GE(default_trigger_async_id, 0);
@@ -206,8 +202,7 @@ inline Environment::AsyncHooks::DefaultTriggerAsyncIdScope
default_trigger_async_id;
}
-inline Environment::AsyncHooks::DefaultTriggerAsyncIdScope
- ::~DefaultTriggerAsyncIdScope() {
+inline AsyncHooks::DefaultTriggerAsyncIdScope ::~DefaultTriggerAsyncIdScope() {
async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId] =
old_default_trigger_async_id_;
}
@@ -430,7 +425,7 @@ inline void Environment::set_is_in_inspector_console_call(bool value) {
}
#endif
-inline Environment::AsyncHooks* Environment::async_hooks() {
+inline AsyncHooks* Environment::async_hooks() {
return &async_hooks_;
}