From 864860e9f3d4eed0b0b81af55197d7e525ea6306 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sat, 23 Mar 2019 07:39:52 +0800 Subject: 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 --- src/env-inl.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/env-inl.h') diff --git a/src/env-inl.h b/src/env-inl.h index ef054be4cb..a489a4001a 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -638,6 +638,26 @@ inline const std::vector& Environment::exec_argv() { return exec_argv_; } +#if HAVE_INSPECTOR +inline void Environment::set_coverage_directory(const char* dir) { + coverage_directory_ = std::string(dir); +} + +inline void Environment::set_coverage_connection( + std::unique_ptr connection) { + CHECK_NULL(coverage_connection_); + std::swap(coverage_connection_, connection); +} + +inline profiler::V8CoverageConnection* Environment::coverage_connection() { + return coverage_connection_.get(); +} + +inline const std::string& Environment::coverage_directory() const { + return coverage_directory_; +} +#endif // HAVE_INSPECTOR + inline std::shared_ptr Environment::inspector_host_port() { return inspector_host_port_; } -- cgit v1.2.3