@@ -258,21 +258,6 @@ static void GetActiveRequests(const FunctionCallbackInfo<Value>& args) {
258258 Array::New (env->isolate (), request_v.data (), request_v.size ()));
259259}
260260
261- static void GetActiveRequestsInfo (const FunctionCallbackInfo<Value>& args) {
262- Environment* env = Environment::GetCurrent (args);
263-
264- std::vector<Local<Value>> requests_info;
265- for (ReqWrapBase* req_wrap : *env->req_wrap_queue ()) {
266- AsyncWrap* w = req_wrap->GetAsyncWrap ();
267- if (w->persistent ().IsEmpty ()) continue ;
268- requests_info.emplace_back (OneByteString (env->isolate (),
269- w->MemoryInfoName ().c_str ()));
270- }
271-
272- args.GetReturnValue ().Set (
273- Array::New (env->isolate (), requests_info.data (), requests_info.size ()));
274- }
275-
276261// Non-static, friend of HandleWrap. Could have been a HandleWrap method but
277262// implemented here for consistency with GetActiveRequests().
278263void GetActiveHandles (const FunctionCallbackInfo<Value>& args) {
@@ -288,18 +273,37 @@ void GetActiveHandles(const FunctionCallbackInfo<Value>& args) {
288273 Array::New (env->isolate (), handle_v.data (), handle_v.size ()));
289274}
290275
291- void GetActiveHandlesInfo (const FunctionCallbackInfo<Value>& args) {
276+ static void GetActiveResourcesInfo (const FunctionCallbackInfo<Value>& args) {
292277 Environment* env = Environment::GetCurrent (args);
278+ std::vector<Local<Value>> resources_info;
279+
280+ // Active requests
281+ for (ReqWrapBase* req_wrap : *env->req_wrap_queue ()) {
282+ AsyncWrap* w = req_wrap->GetAsyncWrap ();
283+ if (w->persistent ().IsEmpty ()) continue ;
284+ resources_info.emplace_back (
285+ OneByteString (env->isolate (), w->MemoryInfoName ().c_str ()));
286+ }
293287
294- std::vector<Local<Value>> handles_info;
288+ // Active handles
295289 for (HandleWrap* w : *env->handle_wrap_queue ()) {
296290 if (w->persistent ().IsEmpty () || !HandleWrap::HasRef (w)) continue ;
297- handles_info .emplace_back (OneByteString (env-> isolate (),
298- w->MemoryInfoName ().c_str ()));
291+ resources_info .emplace_back (
292+ OneByteString (env-> isolate (), w->MemoryInfoName ().c_str ()));
299293 }
300294
295+ // Active timeouts
296+ resources_info.insert (resources_info.end (),
297+ env->timeout_info ()[0 ],
298+ OneByteString (env->isolate (), " Timeout" ));
299+
300+ // Active immediates
301+ resources_info.insert (resources_info.end (),
302+ env->immediate_info ()->ref_count (),
303+ OneByteString (env->isolate (), " Immediate" ));
304+
301305 args.GetReturnValue ().Set (
302- Array::New (env->isolate (), handles_info .data (), handles_info .size ()));
306+ Array::New (env->isolate (), resources_info .data (), resources_info .size ()));
303307}
304308
305309static void ResourceUsage (const FunctionCallbackInfo<Value>& args) {
@@ -578,10 +582,9 @@ static void Initialize(Local<Object> target,
578582 SetMethod (context, target, " resourceUsage" , ResourceUsage);
579583
580584 SetMethod (context, target, " _debugEnd" , DebugEnd);
581- SetMethod (context, target, " _getActiveRequestsInfo" , GetActiveRequestsInfo);
582585 SetMethod (context, target, " _getActiveRequests" , GetActiveRequests);
583586 SetMethod (context, target, " _getActiveHandles" , GetActiveHandles);
584- SetMethod (context, target, " _getActiveHandlesInfo " , GetActiveHandlesInfo );
587+ SetMethod (context, target, " getActiveResourcesInfo " , GetActiveResourcesInfo );
585588 SetMethod (context, target, " _kill" , Kill);
586589 SetMethod (context, target, " _rawDebug" , RawDebug);
587590
@@ -609,9 +612,8 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
609612 registry->Register (ResourceUsage);
610613
611614 registry->Register (GetActiveRequests);
612- registry->Register (GetActiveRequestsInfo);
613615 registry->Register (GetActiveHandles);
614- registry->Register (GetActiveHandlesInfo );
616+ registry->Register (GetActiveResourcesInfo );
615617 registry->Register (Kill);
616618
617619 registry->Register (Cwd);
0 commit comments