Skip to content

Commit 0340652

Browse files
committed
Revert "src: add GetActiveRequests and GetActiveHandles to async_wrap.cc"
This reverts commit b9ad96f.
1 parent b9ad96f commit 0340652

File tree

2 files changed

+10
-39
lines changed

2 files changed

+10
-39
lines changed

lib/internal/async_hooks.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ const { setCallbackTrampoline } = async_wrap;
4343
const {
4444
async_hook_fields,
4545
async_id_fields,
46-
execution_async_resources,
47-
getActiveRequests,
48-
getActiveHandles,
46+
execution_async_resources
4947
} = async_wrap;
5048
// Store the pair executionAsyncId and triggerAsyncId in a AliasedFloat64Array
5149
// in Environment::AsyncHooks::async_ids_stack_ which tracks the resource
@@ -542,6 +540,15 @@ function triggerAsyncId() {
542540
}
543541

544542

543+
function getActiveRequests() {
544+
return process._getActiveRequests();
545+
}
546+
547+
function getActiveHandles() {
548+
return process._getActiveHandles();
549+
}
550+
551+
545552
module.exports = {
546553
executionAsyncId,
547554
triggerAsyncId,

src/async_wrap.cc

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
#include "v8.h"
3131

32-
using v8::Array;
3332
using v8::Context;
3433
using v8::DontDelete;
3534
using v8::EscapableHandleScope;
@@ -514,36 +513,6 @@ static void RegisterDestroyHook(const FunctionCallbackInfo<Value>& args) {
514513
p->env->AddCleanupHook(DestroyParamCleanupHook, p);
515514
}
516515

517-
static void GetActiveRequests(const FunctionCallbackInfo<Value>& args) {
518-
Environment* env = Environment::GetCurrent(args);
519-
520-
std::vector<Local<Value>> request_v;
521-
for (ReqWrapBase* req_wrap : *env->req_wrap_queue()) {
522-
AsyncWrap* w = req_wrap->GetAsyncWrap();
523-
if (w->persistent().IsEmpty())
524-
continue;
525-
request_v.emplace_back(w->GetOwner());
526-
}
527-
528-
args.GetReturnValue().Set(
529-
Array::New(env->isolate(), request_v.data(), request_v.size()));
530-
}
531-
532-
// Non-static, friend of HandleWrap. Could have been a HandleWrap method but
533-
// implemented here for consistency with GetActiveRequests().
534-
void GetActiveHandles(const FunctionCallbackInfo<Value>& args) {
535-
Environment* env = Environment::GetCurrent(args);
536-
537-
std::vector<Local<Value>> handle_v;
538-
for (auto w : *env->handle_wrap_queue()) {
539-
if (!HandleWrap::HasRef(w))
540-
continue;
541-
handle_v.emplace_back(w->GetOwner());
542-
}
543-
args.GetReturnValue().Set(
544-
Array::New(env->isolate(), handle_v.data(), handle_v.size()));
545-
}
546-
547516
void AsyncWrap::GetAsyncId(const FunctionCallbackInfo<Value>& args) {
548517
AsyncWrap* wrap;
549518
args.GetReturnValue().Set(kInvalidAsyncId);
@@ -665,9 +634,6 @@ void AsyncWrap::Initialize(Local<Object> target,
665634
env->SetMethod(target, "disablePromiseHook", DisablePromiseHook);
666635
env->SetMethod(target, "registerDestroyHook", RegisterDestroyHook);
667636

668-
env->SetMethod(target, "getActiveRequests", GetActiveRequests);
669-
env->SetMethod(target, "getActiveHandles", GetActiveHandles);
670-
671637
PropertyAttribute ReadOnlyDontDelete =
672638
static_cast<PropertyAttribute>(ReadOnly | DontDelete);
673639

@@ -766,8 +732,6 @@ void AsyncWrap::RegisterExternalReferences(
766732
registry->Register(AsyncWrap::GetProviderType);
767733
registry->Register(PromiseWrap::GetAsyncId);
768734
registry->Register(PromiseWrap::GetTriggerAsyncId);
769-
registry->Register(GetActiveRequests);
770-
registry->Register(GetActiveHandles);
771735
}
772736

773737
AsyncWrap::AsyncWrap(Environment* env,

0 commit comments

Comments
 (0)