summaryrefslogtreecommitdiff
path: root/src/env.h
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-03-23 07:39:52 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2019-04-06 12:01:45 +0800
commit864860e9f3d4eed0b0b81af55197d7e525ea6306 (patch)
treeed0c9cbc1cea99323cd4fa4c5385a11b262be8ee /src/env.h
parentbaa54a5ae78ff04a3e8d8ac97c052304a6f6c18c (diff)
downloadandroid-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/env.h')
-rw-r--r--src/env.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/env.h b/src/env.h
index 9d28907212..82d9943198 100644
--- a/src/env.h
+++ b/src/env.h
@@ -27,6 +27,7 @@
#include "aliased_buffer.h"
#if HAVE_INSPECTOR
#include "inspector_agent.h"
+#include "inspector_profiler.h"
#endif
#include "handle_wrap.h"
#include "node.h"
@@ -67,6 +68,12 @@ namespace tracing {
class AgentWriterHandle;
}
+#if HAVE_INSPECTOR
+namespace profiler {
+class V8CoverageConnection;
+} // namespace profiler
+#endif // HAVE_INSPECTOR
+
namespace worker {
class Worker;
}
@@ -366,7 +373,6 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2;
V(async_hooks_init_function, v8::Function) \
V(async_hooks_promise_resolve_function, v8::Function) \
V(buffer_prototype_object, v8::Object) \
- V(coverage_connection, v8::Object) \
V(crypto_key_object_constructor, v8::Function) \
V(domain_callback, v8::Function) \
V(domexception_function, v8::Function) \
@@ -390,7 +396,6 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2;
V(inspector_console_extension_installer, v8::Function) \
V(message_port, v8::Object) \
V(native_module_require, v8::Function) \
- V(on_coverage_message_function, v8::Function) \
V(performance_entry_callback, v8::Function) \
V(performance_entry_template, v8::Function) \
V(process_object, v8::Object) \
@@ -1116,6 +1121,15 @@ class Environment : public MemoryRetainer {
inline AsyncRequest* thread_stopper() { return &thread_stopper_; }
+#if HAVE_INSPECTOR
+ void set_coverage_connection(
+ std::unique_ptr<profiler::V8CoverageConnection> connection);
+ profiler::V8CoverageConnection* coverage_connection();
+
+ inline void set_coverage_directory(const char* directory);
+ inline const std::string& coverage_directory() const;
+#endif // HAVE_INSPECTOR
+
private:
inline void CreateImmediate(native_immediate_callback cb,
void* data,
@@ -1146,6 +1160,11 @@ class Environment : public MemoryRetainer {
size_t async_callback_scope_depth_ = 0;
std::vector<double> destroy_async_id_list_;
+#if HAVE_INSPECTOR
+ std::unique_ptr<profiler::V8CoverageConnection> coverage_connection_;
+ std::string coverage_directory_;
+#endif // HAVE_INSPECTOR
+
std::shared_ptr<EnvironmentOptions> options_;
// options_ contains debug options parsed from CLI arguments,
// while inspector_host_port_ stores the actual inspector host