Skip to content

Commit 4214598

Browse files
committed
src: update std::vector<v8::Local<T>> to use v8::LocalVector<T>
Refs: nodejs#57578
1 parent 4868ca4 commit 4214598

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/node_process_methods.cc

+11-9
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ using v8::HeapStatistics;
5050
using v8::Integer;
5151
using v8::Isolate;
5252
using v8::Local;
53+
using v8::LocalVector;
5354
using v8::Maybe;
5455
using v8::NewStringType;
5556
using v8::Number;
@@ -289,7 +290,7 @@ static void Uptime(const FunctionCallbackInfo<Value>& args) {
289290
static void GetActiveRequests(const FunctionCallbackInfo<Value>& args) {
290291
Environment* env = Environment::GetCurrent(args);
291292

292-
std::vector<Local<Value>> request_v;
293+
LocalVector<Value> request_v(env->isolate());
293294
for (ReqWrapBase* req_wrap : *env->req_wrap_queue()) {
294295
AsyncWrap* w = req_wrap->GetAsyncWrap();
295296
if (w->persistent().IsEmpty())
@@ -306,7 +307,7 @@ static void GetActiveRequests(const FunctionCallbackInfo<Value>& args) {
306307
void GetActiveHandles(const FunctionCallbackInfo<Value>& args) {
307308
Environment* env = Environment::GetCurrent(args);
308309

309-
std::vector<Local<Value>> handle_v;
310+
LocalVector<Value> handle_v(env->isolate());
310311
for (auto w : *env->handle_wrap_queue()) {
311312
if (!HandleWrap::HasRef(w))
312313
continue;
@@ -318,7 +319,7 @@ void GetActiveHandles(const FunctionCallbackInfo<Value>& args) {
318319

319320
static void GetActiveResourcesInfo(const FunctionCallbackInfo<Value>& args) {
320321
Environment* env = Environment::GetCurrent(args);
321-
std::vector<Local<Value>> resources_info;
322+
LocalVector<Value> resources_info(env->isolate());
322323

323324
// Active requests
324325
for (ReqWrapBase* req_wrap : *env->req_wrap_queue()) {
@@ -336,14 +337,15 @@ static void GetActiveResourcesInfo(const FunctionCallbackInfo<Value>& args) {
336337
}
337338

338339
// Active timeouts
339-
resources_info.insert(resources_info.end(),
340-
env->timeout_info()[0],
341-
FIXED_ONE_BYTE_STRING(env->isolate(), "Timeout"));
340+
for (int i = 0; i < env->timeout_info()[0]; ++i) {
341+
resources_info.push_back(FIXED_ONE_BYTE_STRING(env->isolate(), "Timeout"));
342+
}
342343

343344
// Active immediates
344-
resources_info.insert(resources_info.end(),
345-
env->immediate_info()->ref_count(),
346-
FIXED_ONE_BYTE_STRING(env->isolate(), "Immediate"));
345+
for (uint32_t i = 0; i < env->immediate_info()->ref_count(); ++i) {
346+
resources_info.push_back(
347+
FIXED_ONE_BYTE_STRING(env->isolate(), "Immediate"));
348+
}
347349

348350
args.GetReturnValue().Set(
349351
Array::New(env->isolate(), resources_info.data(), resources_info.size()));

0 commit comments

Comments
 (0)