@@ -50,6 +50,7 @@ using v8::HeapStatistics;
50
50
using v8::Integer;
51
51
using v8::Isolate;
52
52
using v8::Local;
53
+ using v8::LocalVector;
53
54
using v8::Maybe;
54
55
using v8::NewStringType;
55
56
using v8::Number;
@@ -289,7 +290,7 @@ static void Uptime(const FunctionCallbackInfo<Value>& args) {
289
290
static void GetActiveRequests (const FunctionCallbackInfo<Value>& args) {
290
291
Environment* env = Environment::GetCurrent (args);
291
292
292
- std::vector<Local< Value>> request_v;
293
+ LocalVector< Value> request_v (env-> isolate ()) ;
293
294
for (ReqWrapBase* req_wrap : *env->req_wrap_queue ()) {
294
295
AsyncWrap* w = req_wrap->GetAsyncWrap ();
295
296
if (w->persistent ().IsEmpty ())
@@ -306,7 +307,7 @@ static void GetActiveRequests(const FunctionCallbackInfo<Value>& args) {
306
307
void GetActiveHandles (const FunctionCallbackInfo<Value>& args) {
307
308
Environment* env = Environment::GetCurrent (args);
308
309
309
- std::vector<Local< Value>> handle_v;
310
+ LocalVector< Value> handle_v (env-> isolate ()) ;
310
311
for (auto w : *env->handle_wrap_queue ()) {
311
312
if (!HandleWrap::HasRef (w))
312
313
continue ;
@@ -318,7 +319,7 @@ void GetActiveHandles(const FunctionCallbackInfo<Value>& args) {
318
319
319
320
static void GetActiveResourcesInfo (const FunctionCallbackInfo<Value>& args) {
320
321
Environment* env = Environment::GetCurrent (args);
321
- std::vector<Local< Value>> resources_info;
322
+ LocalVector< Value> resources_info (env-> isolate ()) ;
322
323
323
324
// Active requests
324
325
for (ReqWrapBase* req_wrap : *env->req_wrap_queue ()) {
@@ -336,14 +337,17 @@ static void GetActiveResourcesInfo(const FunctionCallbackInfo<Value>& args) {
336
337
}
337
338
338
339
// Active timeouts
339
- resources_info.insert (resources_info.end (),
340
- env->timeout_info ()[0 ],
341
- FIXED_ONE_BYTE_STRING (env->isolate (), " Timeout" ));
340
+ Local<Value> timeout_str = FIXED_ONE_BYTE_STRING (env->isolate (), " Timeout" );
341
+ for (int i = 0 ; i < env->timeout_info ()[0 ]; ++i) {
342
+ resources_info.push_back (timeout_str);
343
+ }
342
344
343
345
// Active immediates
344
- resources_info.insert (resources_info.end (),
345
- env->immediate_info ()->ref_count (),
346
- FIXED_ONE_BYTE_STRING (env->isolate (), " Immediate" ));
346
+ Local<Value> immediate_str =
347
+ FIXED_ONE_BYTE_STRING (env->isolate (), " Immediate" );
348
+ for (uint32_t i = 0 ; i < env->immediate_info ()->ref_count (); ++i) {
349
+ resources_info.push_back (immediate_str);
350
+ }
347
351
348
352
args.GetReturnValue ().Set (
349
353
Array::New (env->isolate (), resources_info.data (), resources_info.size ()));
0 commit comments