@@ -169,8 +169,6 @@ using v8::Undefined;
169169using v8::V8;
170170using v8::Value;
171171
172- using AsyncHooks = Environment::AsyncHooks;
173-
174172static Mutex process_mutex;
175173static Mutex environ_mutex;
176174
@@ -923,115 +921,6 @@ void RemoveEnvironmentCleanupHook(v8::Isolate* isolate,
923921 env->RemoveCleanupHook (fun, arg);
924922}
925923
926-
927- CallbackScope::CallbackScope (Isolate* isolate,
928- Local<Object> object,
929- async_context asyncContext)
930- : private_(new InternalCallbackScope(Environment::GetCurrent(isolate),
931- object,
932- asyncContext)),
933- try_catch_(isolate) {
934- try_catch_.SetVerbose (true );
935- }
936-
937- CallbackScope::~CallbackScope () {
938- if (try_catch_.HasCaught ())
939- private_->MarkAsFailed ();
940- delete private_;
941- }
942-
943- InternalCallbackScope::InternalCallbackScope (AsyncWrap* async_wrap)
944- : InternalCallbackScope(async_wrap->env (),
945- async_wrap->object(),
946- { async_wrap->get_async_id (),
947- async_wrap->get_trigger_async_id () }) {}
948-
949- InternalCallbackScope::InternalCallbackScope (Environment* env,
950- Local<Object> object,
951- const async_context& asyncContext,
952- ResourceExpectation expect)
953- : env_(env),
954- async_context_(asyncContext),
955- object_(object),
956- callback_scope_(env) {
957- if (expect == kRequireResource ) {
958- CHECK (!object.IsEmpty ());
959- }
960-
961- if (!env->can_call_into_js ()) {
962- failed_ = true ;
963- return ;
964- }
965-
966- HandleScope handle_scope (env->isolate ());
967- // If you hit this assertion, you forgot to enter the v8::Context first.
968- CHECK_EQ (Environment::GetCurrent (env->isolate ()), env);
969-
970- if (asyncContext.async_id != 0 ) {
971- // No need to check a return value because the application will exit if
972- // an exception occurs.
973- AsyncWrap::EmitBefore (env, asyncContext.async_id );
974- }
975-
976- if (!IsInnerMakeCallback ()) {
977- env->tick_info ()->set_has_thrown (false );
978- }
979-
980- env->async_hooks ()->push_async_ids (async_context_.async_id ,
981- async_context_.trigger_async_id );
982- pushed_ids_ = true ;
983- }
984-
985- InternalCallbackScope::~InternalCallbackScope () {
986- Close ();
987- }
988-
989- void InternalCallbackScope::Close () {
990- if (closed_) return ;
991- closed_ = true ;
992- HandleScope handle_scope (env_->isolate ());
993-
994- if (pushed_ids_)
995- env_->async_hooks ()->pop_async_id (async_context_.async_id );
996-
997- if (failed_) return ;
998-
999- if (async_context_.async_id != 0 ) {
1000- AsyncWrap::EmitAfter (env_, async_context_.async_id );
1001- }
1002-
1003- if (IsInnerMakeCallback ()) {
1004- return ;
1005- }
1006-
1007- Environment::TickInfo* tick_info = env_->tick_info ();
1008-
1009- if (!env_->can_call_into_js ()) return ;
1010- if (!tick_info->has_scheduled ()) {
1011- env_->isolate ()->RunMicrotasks ();
1012- }
1013-
1014- // Make sure the stack unwound properly. If there are nested MakeCallback's
1015- // then it should return early and not reach this code.
1016- if (env_->async_hooks ()->fields ()[AsyncHooks::kTotals ]) {
1017- CHECK_EQ (env_->execution_async_id (), 0 );
1018- CHECK_EQ (env_->trigger_async_id (), 0 );
1019- }
1020-
1021- if (!tick_info->has_scheduled () && !tick_info->has_promise_rejections ()) {
1022- return ;
1023- }
1024-
1025- Local<Object> process = env_->process_object ();
1026-
1027- if (!env_->can_call_into_js ()) return ;
1028-
1029- if (env_->tick_callback_function ()->Call (process, 0 , nullptr ).IsEmpty ()) {
1030- env_->tick_info ()->set_has_thrown (true );
1031- failed_ = true ;
1032- }
1033- }
1034-
1035924MaybeLocal<Value> InternalMakeCallback (Environment* env,
1036925 Local<Object> recv,
1037926 const Local<Function> callback,
0 commit comments