diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2019-03-20 22:52:28 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2019-03-27 10:30:19 -0400 |
commit | 9d854fb60cd4a7386a23add2900fa224dcb1e2d5 (patch) | |
tree | 8ed62ab706f98641b55eb3f7871c48a62c3d004b /src/env-inl.h | |
parent | 9f37d3c114b2c4233e58bdce8d82a06cac467738 (diff) | |
download | android-node-v8-9d854fb60cd4a7386a23add2900fa224dcb1e2d5.tar.gz android-node-v8-9d854fb60cd4a7386a23add2900fa224dcb1e2d5.tar.bz2 android-node-v8-9d854fb60cd4a7386a23add2900fa224dcb1e2d5.zip |
src: move ShouldNotAbortOnUncaughtScope 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.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/env-inl.h b/src/env-inl.h index f379660004..69c70804c8 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -487,24 +487,32 @@ inline uint32_t Environment::get_next_function_id() { return function_id_counter_++; } -Environment::ShouldNotAbortOnUncaughtScope::ShouldNotAbortOnUncaughtScope( +ShouldNotAbortOnUncaughtScope::ShouldNotAbortOnUncaughtScope( Environment* env) : env_(env) { - env_->should_not_abort_scope_counter_++; + env_->PushShouldNotAbortOnUncaughtScope(); } -Environment::ShouldNotAbortOnUncaughtScope::~ShouldNotAbortOnUncaughtScope() { +ShouldNotAbortOnUncaughtScope::~ShouldNotAbortOnUncaughtScope() { Close(); } -void Environment::ShouldNotAbortOnUncaughtScope::Close() { +void ShouldNotAbortOnUncaughtScope::Close() { if (env_ != nullptr) { - env_->should_not_abort_scope_counter_--; + env_->PopShouldNotAbortOnUncaughtScope(); env_ = nullptr; } } -bool Environment::inside_should_not_abort_on_uncaught_scope() const { +inline void Environment::PushShouldNotAbortOnUncaughtScope() { + should_not_abort_scope_counter_++; +} + +inline void Environment::PopShouldNotAbortOnUncaughtScope() { + should_not_abort_scope_counter_--; +} + +inline bool Environment::inside_should_not_abort_on_uncaught_scope() const { return should_not_abort_scope_counter_ > 0; } |