Browse Source

src: use global SealHandleScope

Helps to find Handle leaks in Debug mode.

PR-URL: https://github.com/iojs/io.js/pull/1395
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
v1.8.0-commit
Fedor Indutny 10 years ago
parent
commit
a07c69113a
  1. 32
      src/node.cc

32
src/node.cc

@ -101,6 +101,7 @@ using v8::ObjectTemplate;
using v8::Promise; using v8::Promise;
using v8::PromiseRejectMessage; using v8::PromiseRejectMessage;
using v8::PropertyCallbackInfo; using v8::PropertyCallbackInfo;
using v8::SealHandleScope;
using v8::String; using v8::String;
using v8::TryCatch; using v8::TryCatch;
using v8::Uint32; using v8::Uint32;
@ -3836,22 +3837,25 @@ static void StartNodeInstance(void* arg) {
if (instance_data->use_debug_agent()) if (instance_data->use_debug_agent())
EnableDebug(env); EnableDebug(env);
bool more; {
do { SealHandleScope seal(isolate);
v8::platform::PumpMessageLoop(default_platform, isolate); bool more;
more = uv_run(env->event_loop(), UV_RUN_ONCE); do {
if (more == false) {
v8::platform::PumpMessageLoop(default_platform, isolate); v8::platform::PumpMessageLoop(default_platform, isolate);
EmitBeforeExit(env); more = uv_run(env->event_loop(), UV_RUN_ONCE);
// Emit `beforeExit` if the loop became alive either after emitting if (more == false) {
// event, or after running some callbacks. v8::platform::PumpMessageLoop(default_platform, isolate);
more = uv_loop_alive(env->event_loop()); EmitBeforeExit(env);
if (uv_run(env->event_loop(), UV_RUN_NOWAIT) != 0)
more = true; // Emit `beforeExit` if the loop became alive either after emitting
} // event, or after running some callbacks.
} while (more == true); more = uv_loop_alive(env->event_loop());
if (uv_run(env->event_loop(), UV_RUN_NOWAIT) != 0)
more = true;
}
} while (more == true);
}
int exit_code = EmitExit(env); int exit_code = EmitExit(env);
if (instance_data->is_main()) if (instance_data->is_main())

Loading…
Cancel
Save