node_patches/node8.9.3_modified/src/node.cc
// Non-static, friend of HandleWrap. Could have been a HandleWrap method but
// implemented here for consistency with GetActiveRequests().
Non-static, friend of HandleWrap. Could have been a HandleWrap method but
implemented here for consistency with GetActiveRequests().
Non - static friend of HandleWrap . Could have been a HandleWrap method but implemented here for consistency with GetActiveRequests () .
void GetActiveHandles(const FunctionCallbackInfo<Value>& args) {
  Environment* env = Environment::GetCurrent(args);
  Local<Array> ary = Array::New(env->isolate());
  Local<Context> ctx = env->context();
  Local<Function> fn = env->push_values_to_array_function();
  Local<Value> argv[NODE_PUSH_VAL_TO_ARRAY_MAX];
  size_t idx = 0;
  Local<String> owner_sym = env->owner_string();
  for (auto w : *env->handle_wrap_queue()) {
    if (w->persistent().IsEmpty() || !HandleWrap::HasRef(w))
      continue;
    Local<Object> object = w->object();
    Local<Value> owner = object->Get(owner_sym);
    if (owner->IsUndefined())
      owner = object;
    argv[idx] = owner;
    if (++idx >= arraysize(argv)) {
      fn->Call(ctx, ary, idx, argv).ToLocalChecked();
      idx = 0;
    }
  }
  if (idx > 0) {
    fn->Call(ctx, ary, idx, argv).ToLocalChecked();
  }
  args.GetReturnValue().Set(ary);
}
void GetActiveHandles ( const FunctionCallbackInfo < Value > & args ) { Environment * env = Environment :: GetCurrent ( args ) ; Local < Array > ary = Array :: New ( env -> isolate ( ) ) ; Local < Context > ctx = env -> context ( ) ; Local < Function > fn = env -> push_values_to_array_function ( ) ; Local < Value > argv [ NODE_PUSH_VAL_TO_ARRAY_MAX ] ; size_t idx = 0 ; Local < String > owner_sym = env -> owner_string ( ) ; for ( auto w : * env -> handle_wrap_queue ( ) ) { if ( w -> persistent ( ) . IsEmpty ( ) || ! HandleWrap :: HasRef ( w ) ) continue ; Local < Object > object = w -> object ( ) ; Local < Value > owner = object -> Get ( owner_sym ) ; if ( owner -> IsUndefined ( ) ) owner = object ; argv [ idx ] = owner ; if ( ++ idx >= arraysize ( argv ) ) { fn -> Call ( ctx , ary , idx , argv ) . ToLocalChecked ( ) ; idx = 0 ; } } if ( idx > 0 ) { fn -> Call ( ctx , ary , idx , argv ) . ToLocalChecked ( ) ; } args . GetReturnValue ( ) . Set ( ary ) ; }
Non-static, friend of HandleWrap.
Non - static friend of HandleWrap .