File tree Expand file tree Collapse file tree 4 files changed +29
-19
lines changed
Expand file tree Collapse file tree 4 files changed +29
-19
lines changed Original file line number Diff line number Diff line change @@ -487,24 +487,32 @@ inline uint32_t Environment::get_next_function_id() {
487487 return function_id_counter_++;
488488}
489489
490- Environment:: ShouldNotAbortOnUncaughtScope::ShouldNotAbortOnUncaughtScope(
490+ ShouldNotAbortOnUncaughtScope::ShouldNotAbortOnUncaughtScope(
491491 Environment* env)
492492 : env_(env) {
493- env_->should_not_abort_scope_counter_++ ;
493+ env_->PushShouldNotAbortOnUncaughtScope() ;
494494}
495495
496- Environment:: ShouldNotAbortOnUncaughtScope::~ShouldNotAbortOnUncaughtScope() {
496+ ShouldNotAbortOnUncaughtScope::~ShouldNotAbortOnUncaughtScope() {
497497 Close();
498498}
499499
500- void Environment:: ShouldNotAbortOnUncaughtScope::Close() {
500+ void ShouldNotAbortOnUncaughtScope::Close() {
501501 if (env_ != nullptr) {
502- env_->should_not_abort_scope_counter_-- ;
502+ env_->PopShouldNotAbortOnUncaughtScope() ;
503503 env_ = nullptr;
504504 }
505505}
506506
507- bool Environment::inside_should_not_abort_on_uncaught_scope() const {
507+ inline void Environment::PushShouldNotAbortOnUncaughtScope() {
508+ should_not_abort_scope_counter_++;
509+ }
510+
511+ inline void Environment::PopShouldNotAbortOnUncaughtScope() {
512+ should_not_abort_scope_counter_--;
513+ }
514+
515+ inline bool Environment::inside_should_not_abort_on_uncaught_scope() const {
508516 return should_not_abort_scope_counter_ > 0;
509517}
510518
Original file line number Diff line number Diff line change @@ -684,6 +684,16 @@ class TrackingTraceStateObserver :
684684 Environment* env_;
685685};
686686
687+ class ShouldNotAbortOnUncaughtScope {
688+ public:
689+ explicit inline ShouldNotAbortOnUncaughtScope(Environment* env);
690+ inline void Close();
691+ inline ~ShouldNotAbortOnUncaughtScope();
692+
693+ private:
694+ Environment* env_;
695+ };
696+
687697class Environment {
688698 public:
689699 Environment(const Environment&) = delete;
@@ -998,16 +1008,8 @@ class Environment {
9981008 // This needs to be available for the JS-land setImmediate().
9991009 void ToggleImmediateRef(bool ref);
10001010
1001- class ShouldNotAbortOnUncaughtScope {
1002- public:
1003- explicit inline ShouldNotAbortOnUncaughtScope(Environment* env);
1004- inline void Close();
1005- inline ~ShouldNotAbortOnUncaughtScope();
1006-
1007- private:
1008- Environment* env_;
1009- };
1010-
1011+ inline void PushShouldNotAbortOnUncaughtScope();
1012+ inline void PopShouldNotAbortOnUncaughtScope();
10111013 inline bool inside_should_not_abort_on_uncaught_scope() const;
10121014
10131015 static inline Environment* ForAsyncHooks(AsyncHooks* hooks);
Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ void ModuleWrap::New(const FunctionCallbackInfo<Value>& args) {
136136 column_offset = Integer::New(isolate, 0);
137137 }
138138
139- Environment:: ShouldNotAbortOnUncaughtScope no_abort_scope(env);
139+ ShouldNotAbortOnUncaughtScope no_abort_scope(env);
140140 TryCatchScope try_catch(env);
141141 Local<Module> module;
142142
@@ -280,7 +280,7 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo<Value>& args) {
280280 CHECK(args[1]->IsBoolean());
281281 bool break_on_sigint = args[1]->IsTrue();
282282
283- Environment:: ShouldNotAbortOnUncaughtScope no_abort_scope(env);
283+ ShouldNotAbortOnUncaughtScope no_abort_scope(env);
284284 TryCatchScope try_catch(env);
285285
286286 bool timed_out = false;
Original file line number Diff line number Diff line change @@ -719,7 +719,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
719719 compile_options = ScriptCompiler::kConsumeCodeCache;
720720
721721 TryCatchScope try_catch(env);
722- Environment:: ShouldNotAbortOnUncaughtScope no_abort_scope(env);
722+ ShouldNotAbortOnUncaughtScope no_abort_scope(env);
723723 Context::Scope scope(parsing_context);
724724
725725 MaybeLocal<UnboundScript> v8_script = ScriptCompiler::CompileUnboundScript(
You can’t perform that action at this time.
0 commit comments