MCPcopy Create free account
hub / github.com/nodejs/node-addon-api / stressEscapeFromScope

Function stressEscapeFromScope

test/handlescope.cc:48–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46
47#define LOOP_MAX 1000000
48Value stressEscapeFromScope(const CallbackInfo& info) {
49 Value result;
50 for (int i = 0; i < LOOP_MAX; i++) {
51 EscapableHandleScope scope(info.Env());
52 char buffer[128];
53 snprintf(buffer, 128, "%d", i);
54 std::string name = std::string("inner-scope") + std::string(buffer);
55 Value newValue = String::New(info.Env(), name.c_str());
56 if (i == (LOOP_MAX - 1)) {
57 result = scope.Escape(newValue);
58 }
59 }
60 return result;
61}
62
63Value doubleEscapeFromScope(const CallbackInfo& info) {
64 Value result;

Callers

nothing calls this directly

Calls 2

EnvMethod · 0.80
EscapeMethod · 0.80

Tested by

no test coverage detected