diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2019-03-23 07:39:52 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2019-04-06 12:01:45 +0800 |
commit | 864860e9f3d4eed0b0b81af55197d7e525ea6306 (patch) | |
tree | ed0c9cbc1cea99323cd4fa4c5385a11b262be8ee /src/node.cc | |
parent | baa54a5ae78ff04a3e8d8ac97c052304a6f6c18c (diff) | |
download | android-node-v8-864860e9f3d4eed0b0b81af55197d7e525ea6306.tar.gz android-node-v8-864860e9f3d4eed0b0b81af55197d7e525ea6306.tar.bz2 android-node-v8-864860e9f3d4eed0b0b81af55197d7e525ea6306.zip |
src: port coverage serialization to C++
This patch moves the serialization of coverage profiles into
C++. With this we no longer need to patch `process.reallyExit`
and hook into the exit events, but instead hook into relevant
places in C++ which are safe from user manipulation. This also
makes the code easier to reuse for other types of profiles.
PR-URL: https://github.com/nodejs/node/pull/26874
Reviewed-By: Ben Coe <bencoe@gmail.com>
Diffstat (limited to 'src/node.cc')
-rw-r--r-- | src/node.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/node.cc b/src/node.cc index 3401ce30b2..6e2327ef51 100644 --- a/src/node.cc +++ b/src/node.cc @@ -170,6 +170,8 @@ static const unsigned kMaxSignal = 32; void WaitForInspectorDisconnect(Environment* env) { #if HAVE_INSPECTOR + profiler::EndStartedProfilers(env); + if (env->inspector_agent()->IsActive()) { // Restore signal dispositions, the app is done and is no longer // capable of handling signals. @@ -240,13 +242,13 @@ MaybeLocal<Value> RunBootstrapping(Environment* env) { Isolate* isolate = env->isolate(); Local<Context> context = env->context(); - std::string coverage; - bool rc = credentials::SafeGetenv("NODE_V8_COVERAGE", &coverage); - if (rc && !coverage.empty()) { + Local<String> coverage_str = env->env_vars()->Get( + isolate, FIXED_ONE_BYTE_STRING(isolate, "NODE_V8_COVERAGE")); + if (!coverage_str.IsEmpty() && coverage_str->Length() > 0) { #if HAVE_INSPECTOR profiler::StartCoverageCollection(env); #else - fprintf(stderr, "NODE_V8_COVERAGE cannot be used without inspector"); + fprintf(stderr, "NODE_V8_COVERAGE cannot be used without inspector\n"); #endif // HAVE_INSPECTOR } |