@@ -50,6 +50,7 @@ using v8::HeapStatistics;
5050using v8::Integer;
5151using v8::Isolate;
5252using v8::Local;
53+ using v8::LocalVector;
5354using v8::Maybe;
5455using v8::NewStringType;
5556using v8::Number;
@@ -265,7 +266,7 @@ static void Uptime(const FunctionCallbackInfo<Value>& args) {
265266static void GetActiveRequests (const FunctionCallbackInfo<Value>& args) {
266267 Environment* env = Environment::GetCurrent (args);
267268
268- std::vector<Local< Value>> request_v;
269+ LocalVector< Value> request_v (env-> isolate ()) ;
269270 for (ReqWrapBase* req_wrap : *env->req_wrap_queue ()) {
270271 AsyncWrap* w = req_wrap->GetAsyncWrap ();
271272 if (w->persistent ().IsEmpty ())
@@ -282,7 +283,7 @@ static void GetActiveRequests(const FunctionCallbackInfo<Value>& args) {
282283void GetActiveHandles (const FunctionCallbackInfo<Value>& args) {
283284 Environment* env = Environment::GetCurrent (args);
284285
285- std::vector<Local< Value>> handle_v;
286+ LocalVector< Value> handle_v (env-> isolate ()) ;
286287 for (auto w : *env->handle_wrap_queue ()) {
287288 if (!HandleWrap::HasRef (w))
288289 continue ;
@@ -294,7 +295,7 @@ void GetActiveHandles(const FunctionCallbackInfo<Value>& args) {
294295
295296static void GetActiveResourcesInfo (const FunctionCallbackInfo<Value>& args) {
296297 Environment* env = Environment::GetCurrent (args);
297- std::vector<Local< Value>> resources_info;
298+ LocalVector< Value> resources_info (env-> isolate ()) ;
298299
299300 // Active requests
300301 for (ReqWrapBase* req_wrap : *env->req_wrap_queue ()) {
@@ -312,14 +313,17 @@ static void GetActiveResourcesInfo(const FunctionCallbackInfo<Value>& args) {
312313 }
313314
314315 // Active timeouts
315- resources_info.insert (resources_info.end (),
316- env->timeout_info ()[0 ],
317- FIXED_ONE_BYTE_STRING (env->isolate (), " Timeout" ));
316+ Local<Value> timeout_str = FIXED_ONE_BYTE_STRING (env->isolate (), " Timeout" );
317+ for (int i = 0 ; i < env->timeout_info ()[0 ]; ++i) {
318+ resources_info.push_back (timeout_str);
319+ }
318320
319321 // Active immediates
320- resources_info.insert (resources_info.end (),
321- env->immediate_info ()->ref_count (),
322- FIXED_ONE_BYTE_STRING (env->isolate (), " Immediate" ));
322+ Local<Value> immediate_str =
323+ FIXED_ONE_BYTE_STRING (env->isolate (), " Immediate" );
324+ for (uint32_t i = 0 ; i < env->immediate_info ()->ref_count (); ++i) {
325+ resources_info.push_back (immediate_str);
326+ }
323327
324328 args.GetReturnValue ().Set (
325329 Array::New (env->isolate (), resources_info.data (), resources_info.size ()));
0 commit comments