Skip to content

Commit 2509c34

Browse files
committed
src: move DomainEnter,DomainExit to node.cc
PR-URL: #14697 Reviewed-By: Trevor Norris <[email protected]>
1 parent bdaa2cb commit 2509c34

File tree

3 files changed

+36
-40
lines changed

3 files changed

+36
-40
lines changed

src/async-wrap.cc

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -181,42 +181,6 @@ static void PushBackDestroyId(Environment* env, double id) {
181181
}
182182

183183

184-
bool DomainEnter(Environment* env, Local<Object> object) {
185-
Local<Value> domain_v = object->Get(env->domain_string());
186-
if (domain_v->IsObject()) {
187-
Local<Object> domain = domain_v.As<Object>();
188-
if (domain->Get(env->disposed_string())->IsTrue())
189-
return true;
190-
Local<Value> enter_v = domain->Get(env->enter_string());
191-
if (enter_v->IsFunction()) {
192-
if (enter_v.As<Function>()->Call(domain, 0, nullptr).IsEmpty()) {
193-
FatalError("node::AsyncWrap::MakeCallback",
194-
"domain enter callback threw, please report this");
195-
}
196-
}
197-
}
198-
return false;
199-
}
200-
201-
202-
bool DomainExit(Environment* env, v8::Local<v8::Object> object) {
203-
Local<Value> domain_v = object->Get(env->domain_string());
204-
if (domain_v->IsObject()) {
205-
Local<Object> domain = domain_v.As<Object>();
206-
if (domain->Get(env->disposed_string())->IsTrue())
207-
return true;
208-
Local<Value> exit_v = domain->Get(env->exit_string());
209-
if (exit_v->IsFunction()) {
210-
if (exit_v.As<Function>()->Call(domain, 0, nullptr).IsEmpty()) {
211-
FatalError("node::AsyncWrap::MakeCallback",
212-
"domain exit callback threw, please report this");
213-
}
214-
}
215-
}
216-
return false;
217-
}
218-
219-
220184
void AsyncWrap::EmitBefore(Environment* env, double async_id) {
221185
AsyncHooks* async_hooks = env->async_hooks();
222186

src/async-wrap.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,6 @@ class AsyncWrap : public BaseObject {
156156

157157
void LoadAsyncWrapperInfo(Environment* env);
158158

159-
// Return value is an indicator whether the domain was disposed.
160-
bool DomainEnter(Environment* env, v8::Local<v8::Object> object);
161-
bool DomainExit(Environment* env, v8::Local<v8::Object> object);
162-
163159
} // namespace node
164160

165161
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

src/node.cc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,42 @@ bool ShouldAbortOnUncaughtException(Isolate* isolate) {
11621162
}
11631163

11641164

1165+
bool DomainEnter(Environment* env, Local<Object> object) {
1166+
Local<Value> domain_v = object->Get(env->domain_string());
1167+
if (domain_v->IsObject()) {
1168+
Local<Object> domain = domain_v.As<Object>();
1169+
if (domain->Get(env->disposed_string())->IsTrue())
1170+
return true;
1171+
Local<Value> enter_v = domain->Get(env->enter_string());
1172+
if (enter_v->IsFunction()) {
1173+
if (enter_v.As<Function>()->Call(domain, 0, nullptr).IsEmpty()) {
1174+
FatalError("node::AsyncWrap::MakeCallback",
1175+
"domain enter callback threw, please report this");
1176+
}
1177+
}
1178+
}
1179+
return false;
1180+
}
1181+
1182+
1183+
bool DomainExit(Environment* env, v8::Local<v8::Object> object) {
1184+
Local<Value> domain_v = object->Get(env->domain_string());
1185+
if (domain_v->IsObject()) {
1186+
Local<Object> domain = domain_v.As<Object>();
1187+
if (domain->Get(env->disposed_string())->IsTrue())
1188+
return true;
1189+
Local<Value> exit_v = domain->Get(env->exit_string());
1190+
if (exit_v->IsFunction()) {
1191+
if (exit_v.As<Function>()->Call(domain, 0, nullptr).IsEmpty()) {
1192+
FatalError("node::AsyncWrap::MakeCallback",
1193+
"domain exit callback threw, please report this");
1194+
}
1195+
}
1196+
}
1197+
return false;
1198+
}
1199+
1200+
11651201
void DomainPromiseHook(PromiseHookType type,
11661202
Local<Promise> promise,
11671203
Local<Value> parent,

0 commit comments

Comments
 (0)