@encharm/cws 4.5.2 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/CLAUDE.md +81 -0
- package/README.md +10 -5
- package/dist/bindings/cws_darwin_arm64_node115.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node127.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node137.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node147.node +0 -0
- package/dist/bindings/cws_linux_arm64_node115.node +0 -0
- package/dist/bindings/cws_linux_arm64_node127.node +0 -0
- package/dist/bindings/cws_linux_arm64_node137.node +0 -0
- package/dist/bindings/cws_linux_arm64_node147.node +0 -0
- package/dist/bindings/cws_linux_x64_node115.node +0 -0
- package/dist/bindings/cws_linux_x64_node127.node +0 -0
- package/dist/bindings/cws_linux_x64_node137.node +0 -0
- package/dist/bindings/cws_linux_x64_node147.node +0 -0
- package/dist/bindings/cws_win32_x64_node115.node +0 -0
- package/dist/bindings/cws_win32_x64_node127.node +0 -0
- package/dist/bindings/cws_win32_x64_node137.node +0 -0
- package/dist/bindings/cws_win32_x64_node147.node +0 -0
- package/package.json +1 -1
- package/src/Addon.cpp +2 -1
- package/src/Addon.h +70 -14
- package/src/Hub.h +1 -0
- package/src/Networking.h +11 -0
- package/src/Socket.h +201 -6
- package/src/WebSocket.cpp +4 -1
- package/src/cSNode.cpp +2 -0
- package/src/cSNode.h +4 -0
- package/src/headers/24/tracing/agent.h +195 -0
- package/src/headers/24/tracing/trace_event.h +722 -0
- package/src/headers/26/acorn_version.h +6 -0
- package/src/headers/26/aliased_buffer-inl.h +264 -0
- package/src/headers/26/aliased_buffer.h +205 -0
- package/src/headers/26/aliased_struct-inl.h +143 -0
- package/src/headers/26/aliased_struct.h +248 -0
- package/src/headers/26/amaro_version.h +6 -0
- package/src/headers/26/async_context_frame.h +33 -0
- package/src/headers/26/async_wrap-inl.h +123 -0
- package/src/headers/26/async_wrap.h +254 -0
- package/src/headers/26/base_object-inl.h +333 -0
- package/src/headers/26/base_object.h +339 -0
- package/src/headers/26/base_object_types.h +76 -0
- package/src/headers/26/blob_serializer_deserializer-inl.h +385 -0
- package/src/headers/26/blob_serializer_deserializer.h +142 -0
- package/src/headers/26/builtin_info.h +57 -0
- package/src/headers/26/callback_queue-inl.h +97 -0
- package/src/headers/26/callback_queue.h +79 -0
- package/src/headers/26/cares_wrap.h +475 -0
- package/src/headers/26/cleanup_queue-inl.h +36 -0
- package/src/headers/26/cleanup_queue.h +79 -0
- package/src/headers/26/compile_cache.h +134 -0
- package/src/headers/26/connect_wrap.h +26 -0
- package/src/headers/26/connection_wrap.h +30 -0
- package/src/headers/26/cppgc_helpers-inl.h +69 -0
- package/src/headers/26/cppgc_helpers.h +162 -0
- package/src/headers/26/crypto/crypto_aes.h +107 -0
- package/src/headers/26/crypto/crypto_argon2.h +88 -0
- package/src/headers/26/crypto/crypto_bio.h +193 -0
- package/src/headers/26/crypto/crypto_chacha20_poly1305.h +62 -0
- package/src/headers/26/crypto/crypto_cipher.h +291 -0
- package/src/headers/26/crypto/crypto_common.h +48 -0
- package/src/headers/26/crypto/crypto_context.h +219 -0
- package/src/headers/26/crypto/crypto_dh.h +104 -0
- package/src/headers/26/crypto/crypto_dsa.h +50 -0
- package/src/headers/26/crypto/crypto_ec.h +102 -0
- package/src/headers/26/crypto/crypto_hash.h +157 -0
- package/src/headers/26/crypto/crypto_hkdf.h +62 -0
- package/src/headers/26/crypto/crypto_hmac.h +92 -0
- package/src/headers/26/crypto/crypto_kem.h +131 -0
- package/src/headers/26/crypto/crypto_keygen.h +382 -0
- package/src/headers/26/crypto/crypto_keys.h +366 -0
- package/src/headers/26/crypto/crypto_kmac.h +79 -0
- package/src/headers/26/crypto/crypto_pbkdf2.h +76 -0
- package/src/headers/26/crypto/crypto_pqc.h +39 -0
- package/src/headers/26/crypto/crypto_random.h +127 -0
- package/src/headers/26/crypto/crypto_rsa.h +108 -0
- package/src/headers/26/crypto/crypto_scrypt.h +85 -0
- package/src/headers/26/crypto/crypto_sig.h +159 -0
- package/src/headers/26/crypto/crypto_spkac.h +21 -0
- package/src/headers/26/crypto/crypto_timing.h +20 -0
- package/src/headers/26/crypto/crypto_tls.h +342 -0
- package/src/headers/26/crypto/crypto_turboshake.h +105 -0
- package/src/headers/26/crypto/crypto_util.h +775 -0
- package/src/headers/26/crypto/crypto_x509.h +140 -0
- package/src/headers/26/dataqueue/queue.h +311 -0
- package/src/headers/26/debug_utils-inl.h +291 -0
- package/src/headers/26/debug_utils.h +200 -0
- package/src/headers/26/diagnosticfilename-inl.h +33 -0
- package/src/headers/26/embedded_data.h +17 -0
- package/src/headers/26/encoding_binding.h +59 -0
- package/src/headers/26/env-inl.h +956 -0
- package/src/headers/26/env.h +1294 -0
- package/src/headers/26/env_properties.h +562 -0
- package/src/headers/26/ffi/data.h +30 -0
- package/src/headers/26/ffi/fast.h +96 -0
- package/src/headers/26/ffi/jit_memory.h +26 -0
- package/src/headers/26/ffi/types.h +99 -0
- package/src/headers/26/handle_wrap.h +123 -0
- package/src/headers/26/histogram-inl.h +211 -0
- package/src/headers/26/histogram.h +474 -0
- package/src/headers/26/inspector/dom_storage_agent.h +68 -0
- package/src/headers/26/inspector/inspector_object_utils.h +38 -0
- package/src/headers/26/inspector/io_agent.h +30 -0
- package/src/headers/26/inspector/main_thread_interface.h +116 -0
- package/src/headers/26/inspector/network_agent.h +110 -0
- package/src/headers/26/inspector/network_inspector.h +45 -0
- package/src/headers/26/inspector/network_requests_buffer.h +195 -0
- package/src/headers/26/inspector/network_resource_manager.h +29 -0
- package/src/headers/26/inspector/node_json.h +24 -0
- package/src/headers/26/inspector/node_string.h +101 -0
- package/src/headers/26/inspector/notification_emitter.h +38 -0
- package/src/headers/26/inspector/protocol_helper.h +27 -0
- package/src/headers/26/inspector/runtime_agent.h +41 -0
- package/src/headers/26/inspector/storage_agent.h +33 -0
- package/src/headers/26/inspector/target_agent.h +59 -0
- package/src/headers/26/inspector/target_manager.h +70 -0
- package/src/headers/26/inspector/tracing_agent.h +43 -0
- package/src/headers/26/inspector/worker_agent.h +40 -0
- package/src/headers/26/inspector/worker_inspector.h +124 -0
- package/src/headers/26/inspector_agent.h +168 -0
- package/src/headers/26/inspector_io.h +78 -0
- package/src/headers/26/inspector_profiler.h +149 -0
- package/src/headers/26/inspector_socket.h +60 -0
- package/src/headers/26/inspector_socket_server.h +110 -0
- package/src/headers/26/js_native_api.h +634 -0
- package/src/headers/26/js_native_api_types.h +244 -0
- package/src/headers/26/js_native_api_v8.h +485 -0
- package/src/headers/26/js_native_api_v8_internals.h +45 -0
- package/src/headers/26/js_stream.h +57 -0
- package/src/headers/26/json_utils.h +172 -0
- package/src/headers/26/large_pages/node_large_page.h +34 -0
- package/src/headers/26/lru_cache-inl.h +69 -0
- package/src/headers/26/memory_tracker-inl.h +461 -0
- package/src/headers/26/memory_tracker.h +341 -0
- package/src/headers/26/module_wrap.h +231 -0
- package/src/headers/26/ncrypto.h +2008 -0
- package/src/headers/26/node.h +1693 -0
- package/src/headers/26/node_api.h +265 -0
- package/src/headers/26/node_api_internals.h +48 -0
- package/src/headers/26/node_api_types.h +58 -0
- package/src/headers/26/node_binding.h +170 -0
- package/src/headers/26/node_blob.h +160 -0
- package/src/headers/26/node_bob-inl.h +36 -0
- package/src/headers/26/node_bob.h +107 -0
- package/src/headers/26/node_buffer.h +92 -0
- package/src/headers/26/node_builtins.h +239 -0
- package/src/headers/26/node_concepts.h +46 -0
- package/src/headers/26/node_config_file.h +77 -0
- package/src/headers/26/node_constants.h +82 -0
- package/src/headers/26/node_context_data.h +171 -0
- package/src/headers/26/node_contextify.h +261 -0
- package/src/headers/26/node_crypto.h +66 -0
- package/src/headers/26/node_debug.h +30 -0
- package/src/headers/26/node_diagnostics_channel.h +121 -0
- package/src/headers/26/node_dir.h +52 -0
- package/src/headers/26/node_dotenv.h +45 -0
- package/src/headers/26/node_errors.h +378 -0
- package/src/headers/26/node_exit_code.h +54 -0
- package/src/headers/26/node_external_reference.h +171 -0
- package/src/headers/26/node_ffi.h +212 -0
- package/src/headers/26/node_file-inl.h +421 -0
- package/src/headers/26/node_file.h +561 -0
- package/src/headers/26/node_file_utils.h +39 -0
- package/src/headers/26/node_hash.h +212 -0
- package/src/headers/26/node_http2.h +1202 -0
- package/src/headers/26/node_http2_state.h +159 -0
- package/src/headers/26/node_http_common-inl.h +199 -0
- package/src/headers/26/node_http_common.h +535 -0
- package/src/headers/26/node_i18n.h +132 -0
- package/src/headers/26/node_internals.h +485 -0
- package/src/headers/26/node_locks.h +184 -0
- package/src/headers/26/node_main_instance.h +67 -0
- package/src/headers/26/node_mem-inl.h +113 -0
- package/src/headers/26/node_mem.h +45 -0
- package/src/headers/26/node_messaging.h +389 -0
- package/src/headers/26/node_metadata.h +172 -0
- package/src/headers/26/node_modules.h +102 -0
- package/src/headers/26/node_mutex.h +323 -0
- package/src/headers/26/node_object_wrap.h +145 -0
- package/src/headers/26/node_options-inl.h +524 -0
- package/src/headers/26/node_options.h +710 -0
- package/src/headers/26/node_perf.h +167 -0
- package/src/headers/26/node_perf_common.h +103 -0
- package/src/headers/26/node_platform.h +290 -0
- package/src/headers/26/node_process-inl.h +26 -0
- package/src/headers/26/node_process.h +112 -0
- package/src/headers/26/node_profiling.h +38 -0
- package/src/headers/26/node_realm-inl.h +156 -0
- package/src/headers/26/node_realm.h +236 -0
- package/src/headers/26/node_report.h +43 -0
- package/src/headers/26/node_revert.h +82 -0
- package/src/headers/26/node_root_certs.h +2937 -0
- package/src/headers/26/node_sea.h +101 -0
- package/src/headers/26/node_shadow_realm.h +46 -0
- package/src/headers/26/node_snapshot_builder.h +57 -0
- package/src/headers/26/node_snapshotable.h +167 -0
- package/src/headers/26/node_sockaddr-inl.h +248 -0
- package/src/headers/26/node_sockaddr.h +459 -0
- package/src/headers/26/node_sqlite.h +607 -0
- package/src/headers/26/node_stat_watcher.h +73 -0
- package/src/headers/26/node_task_runner.h +92 -0
- package/src/headers/26/node_threadsafe_cow-inl.h +54 -0
- package/src/headers/26/node_threadsafe_cow.h +105 -0
- package/src/headers/26/node_union_bytes.h +81 -0
- package/src/headers/26/node_url.h +101 -0
- package/src/headers/26/node_url_pattern.h +118 -0
- package/src/headers/26/node_v8.h +78 -0
- package/src/headers/26/node_v8_embedder.h +26 -0
- package/src/headers/26/node_v8_platform-inl.h +96 -0
- package/src/headers/26/node_version.h +116 -0
- package/src/headers/26/node_wasi.h +184 -0
- package/src/headers/26/node_wasm_web_api.h +55 -0
- package/src/headers/26/node_watchdog.h +164 -0
- package/src/headers/26/node_webstorage.h +62 -0
- package/src/headers/26/node_worker.h +162 -0
- package/src/headers/26/path.h +36 -0
- package/src/headers/26/permission/boolean_permission.h +50 -0
- package/src/headers/26/permission/fs_permission.h +192 -0
- package/src/headers/26/permission/permission.h +155 -0
- package/src/headers/26/permission/permission_base.h +79 -0
- package/src/headers/26/pipe_wrap.h +80 -0
- package/src/headers/26/quic/application.h +279 -0
- package/src/headers/26/quic/arena.h +373 -0
- package/src/headers/26/quic/bindingdata.h +440 -0
- package/src/headers/26/quic/cid.h +127 -0
- package/src/headers/26/quic/data.h +358 -0
- package/src/headers/26/quic/defs.h +417 -0
- package/src/headers/26/quic/endpoint.h +519 -0
- package/src/headers/26/quic/guard.h +5 -0
- package/src/headers/26/quic/http3.h +25 -0
- package/src/headers/26/quic/packet.h +166 -0
- package/src/headers/26/quic/preferredaddress.h +72 -0
- package/src/headers/26/quic/session.h +770 -0
- package/src/headers/26/quic/session_manager.h +107 -0
- package/src/headers/26/quic/sessionticket.h +110 -0
- package/src/headers/26/quic/streams.h +518 -0
- package/src/headers/26/quic/tlscontext.h +353 -0
- package/src/headers/26/quic/tokens.h +263 -0
- package/src/headers/26/quic/transportparams.h +184 -0
- package/src/headers/26/req_wrap-inl.h +175 -0
- package/src/headers/26/req_wrap.h +79 -0
- package/src/headers/26/spawn_sync.h +243 -0
- package/src/headers/26/stream_base-inl.h +170 -0
- package/src/headers/26/stream_base.h +487 -0
- package/src/headers/26/stream_pipe.h +76 -0
- package/src/headers/26/stream_wrap.h +137 -0
- package/src/headers/26/string_bytes.h +114 -0
- package/src/headers/26/string_decoder-inl.h +31 -0
- package/src/headers/26/string_decoder.h +49 -0
- package/src/headers/26/tcp_wrap.h +138 -0
- package/src/headers/26/threadpoolwork-inl.h +70 -0
- package/src/headers/26/timer_wrap-inl.h +32 -0
- package/src/headers/26/timer_wrap.h +87 -0
- package/src/headers/26/timers.h +70 -0
- package/src/headers/26/tracing/agent.h +125 -0
- package/src/headers/26/tracing/agent_legacy.h +146 -0
- package/src/headers/26/tracing/agent_perfetto.h +145 -0
- package/src/headers/26/tracing/node_trace_buffer.h +91 -0
- package/src/headers/26/tracing/node_trace_writer.h +79 -0
- package/src/headers/26/tracing/trace_event.h +27 -0
- package/src/headers/26/tracing/trace_event_helper.h +40 -0
- package/src/headers/26/tracing/trace_event_legacy.h +1113 -0
- package/src/headers/26/tracing/trace_event_legacy_inl.h +711 -0
- package/src/headers/26/tracing/trace_event_perfetto.h +47 -0
- package/src/headers/26/tracing/traced_value.h +167 -0
- package/src/headers/26/tty_wrap.h +65 -0
- package/src/headers/26/udp_wrap.h +231 -0
- package/src/headers/26/undici_version.h +6 -0
- package/src/headers/26/util-inl.h +788 -0
- package/src/headers/26/util.h +1207 -0
- package/src/headers/26/v8-cpp-heap-external.h +56 -0
- package/src/headers/26/v8-external-memory-accounter.h +60 -0
- package/src/headers/26/v8-fast-api-calls.h +784 -0
- package/src/headers/26/v8-inspector-protocol.h +13 -0
- package/src/headers/26/v8-inspector.h +458 -0
- package/src/headers/26/v8-metrics.h +273 -0
- package/src/headers/26/v8-trace-categories.h +28 -0
- package/src/headers/26/v8-unwinder-state.h +30 -0
- package/src/headers/26/v8-util.h +549 -0
- package/src/headers/26/v8-value-serializer-version.h +24 -0
- package/src/headers/26/v8-version-string.h +38 -0
- package/src/headers/26/v8-wasm-trap-handler-posix.h +31 -0
- package/src/headers/26/v8-wasm-trap-handler-win.h +28 -0
- package/src/headers/26/zlib_version.h +6 -0
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
#ifndef SRC_HISTOGRAM_H_
|
|
2
|
+
#define SRC_HISTOGRAM_H_
|
|
3
|
+
|
|
4
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
+
|
|
6
|
+
#include <hdr/hdr_histogram.h>
|
|
7
|
+
#include "base_object.h"
|
|
8
|
+
#include "memory_tracker.h"
|
|
9
|
+
#include "node_messaging.h"
|
|
10
|
+
#include "util.h"
|
|
11
|
+
#include "uv.h"
|
|
12
|
+
#include "v8.h"
|
|
13
|
+
|
|
14
|
+
#include <limits>
|
|
15
|
+
|
|
16
|
+
namespace node {
|
|
17
|
+
|
|
18
|
+
class ExternalReferenceRegistry;
|
|
19
|
+
|
|
20
|
+
template <typename T>
|
|
21
|
+
void StartHandleHistogram(v8::Local<v8::Value> receiver, bool reset);
|
|
22
|
+
template <typename T>
|
|
23
|
+
void StopHandleHistogram(v8::Local<v8::Value> receiver);
|
|
24
|
+
|
|
25
|
+
constexpr int kDefaultHistogramFigures = 3;
|
|
26
|
+
|
|
27
|
+
class Histogram : public MemoryRetainer {
|
|
28
|
+
public:
|
|
29
|
+
struct Options {
|
|
30
|
+
int64_t lowest = 1;
|
|
31
|
+
int64_t highest = std::numeric_limits<int64_t>::max();
|
|
32
|
+
int figures = kDefaultHistogramFigures;
|
|
33
|
+
double half_life = 0; // EWMA half-life in number of samples (0 = off)
|
|
34
|
+
int64_t threshold = 0; // SLO threshold (0 = off). When set with
|
|
35
|
+
// half_life, tracks EWMA error rate for values
|
|
36
|
+
// exceeding this threshold.
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
explicit Histogram(const Options& options);
|
|
40
|
+
virtual ~Histogram() = default;
|
|
41
|
+
|
|
42
|
+
inline bool Record(int64_t value);
|
|
43
|
+
inline void Reset();
|
|
44
|
+
inline int64_t Min() const;
|
|
45
|
+
inline int64_t Max() const;
|
|
46
|
+
inline double Mean() const;
|
|
47
|
+
inline double Stddev() const;
|
|
48
|
+
inline double EwmaMean() const;
|
|
49
|
+
inline double EwmaStddev() const;
|
|
50
|
+
inline double EwmaErrorRate() const;
|
|
51
|
+
inline int64_t Percentile(double percentile) const;
|
|
52
|
+
inline size_t Exceeds() const;
|
|
53
|
+
inline size_t Count() const;
|
|
54
|
+
|
|
55
|
+
inline uint64_t RecordDelta();
|
|
56
|
+
|
|
57
|
+
inline double Add(const Histogram& other);
|
|
58
|
+
|
|
59
|
+
// Iterator is a function type that takes two doubles as argument, one for
|
|
60
|
+
// percentile and one for the value at that percentile.
|
|
61
|
+
template <typename Iterator>
|
|
62
|
+
inline void Percentiles(Iterator&& fn) const;
|
|
63
|
+
|
|
64
|
+
inline size_t GetMemorySize() const;
|
|
65
|
+
|
|
66
|
+
// Analysis methods
|
|
67
|
+
inline int64_t CountAt(int64_t value) const;
|
|
68
|
+
double Cdf(int64_t value) const;
|
|
69
|
+
double Skewness() const;
|
|
70
|
+
double Kurtosis() const;
|
|
71
|
+
double KsTest(const Histogram& other) const;
|
|
72
|
+
double Subtract(const Histogram& other);
|
|
73
|
+
void PercentilesAt(const double* percentiles,
|
|
74
|
+
int64_t* values,
|
|
75
|
+
size_t length) const;
|
|
76
|
+
|
|
77
|
+
// Statistical hypothesis testing
|
|
78
|
+
struct WelchTestResult {
|
|
79
|
+
double t_statistic;
|
|
80
|
+
double degrees_of_freedom;
|
|
81
|
+
double p_value;
|
|
82
|
+
double ci_lower;
|
|
83
|
+
double ci_upper;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
struct MannWhitneyResult {
|
|
87
|
+
double u_statistic;
|
|
88
|
+
double z_score;
|
|
89
|
+
double p_value;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
struct PercentileCIResult {
|
|
93
|
+
int64_t value;
|
|
94
|
+
int64_t lower;
|
|
95
|
+
int64_t upper;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
WelchTestResult WelchTest(const Histogram& other,
|
|
99
|
+
double confidence = 0.95) const;
|
|
100
|
+
MannWhitneyResult MannWhitneyTest(const Histogram& other) const;
|
|
101
|
+
double CohensD(const Histogram& other) const;
|
|
102
|
+
double CliffsD(const Histogram& other) const;
|
|
103
|
+
PercentileCIResult PercentileCI(double percentile,
|
|
104
|
+
double confidence = 0.95) const;
|
|
105
|
+
|
|
106
|
+
inline bool RecordCorrected(int64_t value, int64_t expected_interval);
|
|
107
|
+
|
|
108
|
+
template <typename Iterator>
|
|
109
|
+
void LinearBuckets(int64_t step_size, Iterator&& fn) const;
|
|
110
|
+
|
|
111
|
+
template <typename Iterator>
|
|
112
|
+
void LogBuckets(int64_t first_bucket, double log_base, Iterator&& fn) const;
|
|
113
|
+
|
|
114
|
+
bool IsCompatible(const Histogram& other) const;
|
|
115
|
+
|
|
116
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
117
|
+
SET_MEMORY_INFO_NAME(Histogram)
|
|
118
|
+
SET_SELF_SIZE(Histogram)
|
|
119
|
+
|
|
120
|
+
private:
|
|
121
|
+
inline void UpdateEwma(double value);
|
|
122
|
+
|
|
123
|
+
using HistogramPointer = DeleteFnPtr<hdr_histogram, hdr_close>;
|
|
124
|
+
HistogramPointer histogram_;
|
|
125
|
+
uint64_t prev_ = 0;
|
|
126
|
+
size_t exceeds_ = 0;
|
|
127
|
+
|
|
128
|
+
// EWMA state (active when ewma_alpha_ > 0)
|
|
129
|
+
double ewma_alpha_ = 0;
|
|
130
|
+
double ewma_mean_ = 0;
|
|
131
|
+
double ewma_variance_ = 0;
|
|
132
|
+
bool ewma_initialized_ = false;
|
|
133
|
+
|
|
134
|
+
// SLO error rate EWMA (active when threshold_ > 0 and ewma_alpha_ > 0)
|
|
135
|
+
int64_t threshold_ = 0;
|
|
136
|
+
double ewma_error_rate_ = 0;
|
|
137
|
+
|
|
138
|
+
RwLock mutex_;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
class HistogramImpl {
|
|
142
|
+
public:
|
|
143
|
+
enum InternalFields {
|
|
144
|
+
kSlot = BaseObject::kSlot,
|
|
145
|
+
kImplField = HandleWrap::kInternalFieldCount,
|
|
146
|
+
kInternalFieldCount
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
explicit HistogramImpl(
|
|
150
|
+
const Histogram::Options& options = Histogram::Options {});
|
|
151
|
+
explicit HistogramImpl(std::shared_ptr<Histogram> histogram);
|
|
152
|
+
|
|
153
|
+
Histogram* operator->() { return histogram_.get(); }
|
|
154
|
+
|
|
155
|
+
const std::shared_ptr<Histogram>& histogram() const { return histogram_; }
|
|
156
|
+
|
|
157
|
+
static void DoReset(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
158
|
+
static void GetCountBigInt(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
159
|
+
static void GetMinBigInt(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
160
|
+
static void GetMaxBigInt(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
161
|
+
static void GetExceedsBigInt(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
162
|
+
static void GetCount(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
163
|
+
static void GetMin(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
164
|
+
static void GetMax(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
165
|
+
static void GetMean(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
166
|
+
static void GetExceeds(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
167
|
+
static void GetStddev(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
168
|
+
static void GetPercentile(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
169
|
+
static void GetPercentileBigInt(
|
|
170
|
+
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
171
|
+
static void GetPercentiles(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
172
|
+
static void GetPercentilesBigInt(
|
|
173
|
+
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
174
|
+
|
|
175
|
+
static void GetSkewness(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
176
|
+
static void GetKurtosis(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
177
|
+
static void GetCdf(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
178
|
+
static void GetCountAt(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
179
|
+
static void GetKsTest(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
180
|
+
static void GetPercentilesAt(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
181
|
+
static void GetLinearBuckets(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
182
|
+
static void GetLogBuckets(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
183
|
+
static void GetWelchTest(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
184
|
+
static void GetMannWhitneyTest(
|
|
185
|
+
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
186
|
+
static void GetCohensD(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
187
|
+
static void GetCliffsD(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
188
|
+
static void GetPercentileCI(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
189
|
+
static void GetEwmaMean(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
190
|
+
static void GetEwmaStddev(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
191
|
+
static void GetEwmaErrorRate(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
192
|
+
|
|
193
|
+
static void FastReset(v8::Local<v8::Value> receiver);
|
|
194
|
+
static double FastGetCount(v8::Local<v8::Value> receiver);
|
|
195
|
+
static double FastGetMin(v8::Local<v8::Value> receiver);
|
|
196
|
+
static double FastGetMax(v8::Local<v8::Value> receiver);
|
|
197
|
+
static double FastGetMean(v8::Local<v8::Value> receiver);
|
|
198
|
+
static double FastGetExceeds(v8::Local<v8::Value> receiver);
|
|
199
|
+
static double FastGetStddev(v8::Local<v8::Value> receiver);
|
|
200
|
+
static double FastGetPercentile(v8::Local<v8::Value> receiver,
|
|
201
|
+
const double percentile);
|
|
202
|
+
static double FastGetSkewness(v8::Local<v8::Value> receiver);
|
|
203
|
+
static double FastGetKurtosis(v8::Local<v8::Value> receiver);
|
|
204
|
+
static double FastGetCdf(v8::Local<v8::Value> receiver, const int64_t value);
|
|
205
|
+
static double FastGetCountAt(v8::Local<v8::Value> receiver,
|
|
206
|
+
const int64_t value);
|
|
207
|
+
static double FastGetEwmaMean(v8::Local<v8::Value> receiver);
|
|
208
|
+
static double FastGetEwmaStddev(v8::Local<v8::Value> receiver);
|
|
209
|
+
static double FastGetEwmaErrorRate(v8::Local<v8::Value> receiver);
|
|
210
|
+
|
|
211
|
+
static void AddMethods(v8::Isolate* isolate,
|
|
212
|
+
v8::Local<v8::FunctionTemplate> tmpl);
|
|
213
|
+
|
|
214
|
+
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
|
215
|
+
|
|
216
|
+
static HistogramImpl* FromJSObject(v8::Local<v8::Value> value);
|
|
217
|
+
|
|
218
|
+
private:
|
|
219
|
+
std::shared_ptr<Histogram> histogram_;
|
|
220
|
+
|
|
221
|
+
static v8::CFunction fast_reset_;
|
|
222
|
+
static v8::CFunction fast_get_count_;
|
|
223
|
+
static v8::CFunction fast_get_min_;
|
|
224
|
+
static v8::CFunction fast_get_max_;
|
|
225
|
+
static v8::CFunction fast_get_mean_;
|
|
226
|
+
static v8::CFunction fast_get_exceeds_;
|
|
227
|
+
static v8::CFunction fast_get_stddev_;
|
|
228
|
+
static v8::CFunction fast_get_percentile_;
|
|
229
|
+
static v8::CFunction fast_get_skewness_;
|
|
230
|
+
static v8::CFunction fast_get_kurtosis_;
|
|
231
|
+
static v8::CFunction fast_get_cdf_;
|
|
232
|
+
static v8::CFunction fast_get_count_at_;
|
|
233
|
+
static v8::CFunction fast_get_ewma_mean_;
|
|
234
|
+
static v8::CFunction fast_get_ewma_stddev_;
|
|
235
|
+
static v8::CFunction fast_get_ewma_error_rate_;
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
class HistogramBase final : public BaseObject, public HistogramImpl {
|
|
239
|
+
public:
|
|
240
|
+
enum InternalFields {
|
|
241
|
+
kInternalFieldCount = std::max<uint32_t>(
|
|
242
|
+
BaseObject::kInternalFieldCount, HistogramImpl::kInternalFieldCount),
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
static v8::Local<v8::FunctionTemplate> GetConstructorTemplate(
|
|
246
|
+
IsolateData* isolate_data);
|
|
247
|
+
static void Initialize(IsolateData* isolate_data,
|
|
248
|
+
v8::Local<v8::ObjectTemplate> target);
|
|
249
|
+
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
|
250
|
+
|
|
251
|
+
static BaseObjectPtr<HistogramBase> Create(
|
|
252
|
+
Environment* env,
|
|
253
|
+
const Histogram::Options& options = Histogram::Options {});
|
|
254
|
+
|
|
255
|
+
static BaseObjectPtr<HistogramBase> Create(
|
|
256
|
+
Environment* env,
|
|
257
|
+
std::shared_ptr<Histogram> histogram);
|
|
258
|
+
|
|
259
|
+
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
260
|
+
|
|
261
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
262
|
+
SET_MEMORY_INFO_NAME(HistogramBase)
|
|
263
|
+
SET_SELF_SIZE(HistogramBase)
|
|
264
|
+
|
|
265
|
+
static void Record(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
266
|
+
static void RecordDelta(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
267
|
+
static void RecordCorrected(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
268
|
+
static void Add(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
269
|
+
static void Subtract(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
270
|
+
|
|
271
|
+
static void FastRecord(v8::Local<v8::Value> receiver, const int64_t value);
|
|
272
|
+
static void FastRecordDelta(v8::Local<v8::Value> receiver);
|
|
273
|
+
|
|
274
|
+
HistogramBase(
|
|
275
|
+
Environment* env,
|
|
276
|
+
v8::Local<v8::Object> wrap,
|
|
277
|
+
const Histogram::Options& options = Histogram::Options {});
|
|
278
|
+
|
|
279
|
+
HistogramBase(
|
|
280
|
+
Environment* env,
|
|
281
|
+
v8::Local<v8::Object> wrap,
|
|
282
|
+
std::shared_ptr<Histogram> histogram);
|
|
283
|
+
|
|
284
|
+
BaseObject::TransferMode GetTransferMode() const override {
|
|
285
|
+
return TransferMode::kCloneable;
|
|
286
|
+
}
|
|
287
|
+
std::unique_ptr<worker::TransferData> CloneForMessaging() const override;
|
|
288
|
+
|
|
289
|
+
class HistogramTransferData : public worker::TransferData {
|
|
290
|
+
public:
|
|
291
|
+
explicit HistogramTransferData(const HistogramBase* histogram)
|
|
292
|
+
: histogram_(histogram->histogram()) {}
|
|
293
|
+
|
|
294
|
+
explicit HistogramTransferData(std::shared_ptr<Histogram> histogram)
|
|
295
|
+
: histogram_(std::move(histogram)) {}
|
|
296
|
+
|
|
297
|
+
BaseObjectPtr<BaseObject> Deserialize(
|
|
298
|
+
Environment* env,
|
|
299
|
+
v8::Local<v8::Context> context,
|
|
300
|
+
std::unique_ptr<worker::TransferData> self) override;
|
|
301
|
+
|
|
302
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
303
|
+
SET_MEMORY_INFO_NAME(HistogramTransferData)
|
|
304
|
+
SET_SELF_SIZE(HistogramTransferData)
|
|
305
|
+
|
|
306
|
+
private:
|
|
307
|
+
std::shared_ptr<Histogram> histogram_;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
private:
|
|
311
|
+
static v8::CFunction fast_record_;
|
|
312
|
+
static v8::CFunction fast_record_delta_;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
// CRTP mixin for HandleWrap-based histograms with start/stop support.
|
|
316
|
+
// Provides: StartFlags enum, Start/Stop slow-path handlers, enabled_ flag,
|
|
317
|
+
// and InitTemplate (shared GetConstructorTemplate body).
|
|
318
|
+
// Derived must provide: fast_start_, fast_stop_ (static CFunction),
|
|
319
|
+
// FastStart, FastStop, OnStart, OnStop.
|
|
320
|
+
template <typename Derived>
|
|
321
|
+
class HandleHistogramMixin {
|
|
322
|
+
public:
|
|
323
|
+
enum class StartFlags { NONE, RESET };
|
|
324
|
+
|
|
325
|
+
static void Start(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|
326
|
+
StartHandleHistogram<Derived>(args.This(), args[0]->IsTrue());
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
static void Stop(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|
330
|
+
StopHandleHistogram<Derived>(args.This());
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
protected:
|
|
334
|
+
static void InitTemplate(v8::Isolate* isolate,
|
|
335
|
+
v8::Local<v8::FunctionTemplate> tmpl,
|
|
336
|
+
uint32_t internal_field_count) {
|
|
337
|
+
auto instance = tmpl->InstanceTemplate();
|
|
338
|
+
instance->SetInternalFieldCount(internal_field_count);
|
|
339
|
+
HistogramImpl::AddMethods(isolate, tmpl);
|
|
340
|
+
SetFastMethod(isolate, instance, "start", Start, &Derived::fast_start_);
|
|
341
|
+
SetFastMethod(isolate, instance, "stop", Stop, &Derived::fast_stop_);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
bool enabled_ = false;
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
class IntervalHistogram final : public HandleWrap,
|
|
348
|
+
public HistogramImpl,
|
|
349
|
+
public HandleHistogramMixin<IntervalHistogram> {
|
|
350
|
+
public:
|
|
351
|
+
enum InternalFields {
|
|
352
|
+
kInternalFieldCount = std::max<uint32_t>(
|
|
353
|
+
HandleWrap::kInternalFieldCount, HistogramImpl::kInternalFieldCount),
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
using OnInterval = void (*)(Histogram&);
|
|
357
|
+
|
|
358
|
+
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
|
359
|
+
|
|
360
|
+
static v8::Local<v8::FunctionTemplate> GetConstructorTemplate(
|
|
361
|
+
Environment* env);
|
|
362
|
+
|
|
363
|
+
static BaseObjectPtr<IntervalHistogram> Create(
|
|
364
|
+
Environment* env,
|
|
365
|
+
int32_t interval,
|
|
366
|
+
OnInterval on_interval,
|
|
367
|
+
const Histogram::Options& options,
|
|
368
|
+
AsyncWrap::ProviderType type = AsyncWrap::PROVIDER_ELDHISTOGRAM);
|
|
369
|
+
|
|
370
|
+
IntervalHistogram(Environment* env,
|
|
371
|
+
v8::Local<v8::Object> wrap,
|
|
372
|
+
AsyncWrap::ProviderType type,
|
|
373
|
+
int32_t interval,
|
|
374
|
+
OnInterval on_interval,
|
|
375
|
+
const Histogram::Options& options = Histogram::Options{});
|
|
376
|
+
|
|
377
|
+
static void FastStart(v8::Local<v8::Value> receiver, bool reset);
|
|
378
|
+
static void FastStop(v8::Local<v8::Value> receiver);
|
|
379
|
+
|
|
380
|
+
BaseObject::TransferMode GetTransferMode() const override {
|
|
381
|
+
return TransferMode::kCloneable;
|
|
382
|
+
}
|
|
383
|
+
std::unique_ptr<worker::TransferData> CloneForMessaging() const override;
|
|
384
|
+
|
|
385
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
386
|
+
SET_MEMORY_INFO_NAME(IntervalHistogram)
|
|
387
|
+
SET_SELF_SIZE(IntervalHistogram)
|
|
388
|
+
|
|
389
|
+
private:
|
|
390
|
+
static void TimerCB(uv_timer_t* handle);
|
|
391
|
+
void OnStart(StartFlags flags = StartFlags::RESET);
|
|
392
|
+
void OnStop();
|
|
393
|
+
|
|
394
|
+
friend class HandleHistogramMixin<IntervalHistogram>;
|
|
395
|
+
template <typename T>
|
|
396
|
+
friend void StartHandleHistogram(v8::Local<v8::Value>, bool);
|
|
397
|
+
template <typename T>
|
|
398
|
+
friend void StopHandleHistogram(v8::Local<v8::Value>);
|
|
399
|
+
|
|
400
|
+
int32_t interval_ = 0;
|
|
401
|
+
OnInterval on_interval_ = nullptr;
|
|
402
|
+
uv_timer_t timer_;
|
|
403
|
+
|
|
404
|
+
static v8::CFunction fast_start_;
|
|
405
|
+
static v8::CFunction fast_stop_;
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
class IterationHistogram final
|
|
409
|
+
: public HandleWrap,
|
|
410
|
+
public HistogramImpl,
|
|
411
|
+
public HandleHistogramMixin<IterationHistogram> {
|
|
412
|
+
public:
|
|
413
|
+
enum InternalFields {
|
|
414
|
+
kInternalFieldCount = std::max<uint32_t>(
|
|
415
|
+
HandleWrap::kInternalFieldCount, HistogramImpl::kInternalFieldCount),
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
|
419
|
+
|
|
420
|
+
static v8::Local<v8::FunctionTemplate> GetConstructorTemplate(
|
|
421
|
+
Environment* env);
|
|
422
|
+
|
|
423
|
+
static BaseObjectPtr<IterationHistogram> Create(
|
|
424
|
+
Environment* env,
|
|
425
|
+
const Histogram::Options& options,
|
|
426
|
+
AsyncWrap::ProviderType type = AsyncWrap::PROVIDER_ELDHISTOGRAM);
|
|
427
|
+
|
|
428
|
+
IterationHistogram(Environment* env,
|
|
429
|
+
v8::Local<v8::Object> wrap,
|
|
430
|
+
AsyncWrap::ProviderType type,
|
|
431
|
+
const Histogram::Options& options = Histogram::Options{});
|
|
432
|
+
|
|
433
|
+
static void FastStart(v8::Local<v8::Value> receiver, bool reset);
|
|
434
|
+
static void FastStop(v8::Local<v8::Value> receiver);
|
|
435
|
+
|
|
436
|
+
BaseObject::TransferMode GetTransferMode() const override {
|
|
437
|
+
return TransferMode::kCloneable;
|
|
438
|
+
}
|
|
439
|
+
std::unique_ptr<worker::TransferData> CloneForMessaging() const override;
|
|
440
|
+
|
|
441
|
+
void Close(
|
|
442
|
+
v8::Local<v8::Value> close_callback = v8::Local<v8::Value>()) override;
|
|
443
|
+
|
|
444
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
445
|
+
SET_MEMORY_INFO_NAME(IterationHistogram)
|
|
446
|
+
SET_SELF_SIZE(IterationHistogram)
|
|
447
|
+
|
|
448
|
+
private:
|
|
449
|
+
static void PrepareCB(uv_prepare_t* handle);
|
|
450
|
+
static void CheckCB(uv_check_t* handle);
|
|
451
|
+
void OnStart(StartFlags flags = StartFlags::RESET);
|
|
452
|
+
void OnStop();
|
|
453
|
+
|
|
454
|
+
friend class HandleHistogramMixin<IterationHistogram>;
|
|
455
|
+
template <typename T>
|
|
456
|
+
friend void StartHandleHistogram(v8::Local<v8::Value>, bool);
|
|
457
|
+
template <typename T>
|
|
458
|
+
friend void StopHandleHistogram(v8::Local<v8::Value>);
|
|
459
|
+
|
|
460
|
+
uv_prepare_t prepare_handle_;
|
|
461
|
+
uv_check_t check_handle_;
|
|
462
|
+
uint64_t prepare_time_ = 0;
|
|
463
|
+
uint64_t check_time_ = 0;
|
|
464
|
+
int64_t timeout_ = 0;
|
|
465
|
+
|
|
466
|
+
static v8::CFunction fast_start_;
|
|
467
|
+
static v8::CFunction fast_stop_;
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
} // namespace node
|
|
471
|
+
|
|
472
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
473
|
+
|
|
474
|
+
#endif // SRC_HISTOGRAM_H_
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#ifndef SRC_INSPECTOR_DOM_STORAGE_AGENT_H_
|
|
2
|
+
#define SRC_INSPECTOR_DOM_STORAGE_AGENT_H_
|
|
3
|
+
|
|
4
|
+
#include <optional>
|
|
5
|
+
#include <string>
|
|
6
|
+
#include "env.h"
|
|
7
|
+
#include "node/inspector/protocol/DOMStorage.h"
|
|
8
|
+
#include "node_webstorage.h"
|
|
9
|
+
#include "notification_emitter.h"
|
|
10
|
+
#include "v8.h"
|
|
11
|
+
|
|
12
|
+
namespace node {
|
|
13
|
+
namespace inspector {
|
|
14
|
+
|
|
15
|
+
class DOMStorageAgent : public protocol::DOMStorage::Backend,
|
|
16
|
+
public NotificationEmitter {
|
|
17
|
+
public:
|
|
18
|
+
explicit DOMStorageAgent(Environment* env);
|
|
19
|
+
~DOMStorageAgent() override;
|
|
20
|
+
|
|
21
|
+
void Wire(protocol::UberDispatcher* dispatcher);
|
|
22
|
+
|
|
23
|
+
protocol::DispatchResponse enable() override;
|
|
24
|
+
protocol::DispatchResponse disable() override;
|
|
25
|
+
protocol::DispatchResponse getDOMStorageItems(
|
|
26
|
+
std::unique_ptr<protocol::DOMStorage::StorageId> storageId,
|
|
27
|
+
std::unique_ptr<protocol::Array<protocol::Array<protocol::String>>>*
|
|
28
|
+
items) override;
|
|
29
|
+
protocol::DispatchResponse setDOMStorageItem(
|
|
30
|
+
std::unique_ptr<protocol::DOMStorage::StorageId> storageId,
|
|
31
|
+
const std::string& key,
|
|
32
|
+
const std::string& value) override;
|
|
33
|
+
protocol::DispatchResponse removeDOMStorageItem(
|
|
34
|
+
std::unique_ptr<protocol::DOMStorage::StorageId> storageId,
|
|
35
|
+
const std::string& key) override;
|
|
36
|
+
protocol::DispatchResponse clear(
|
|
37
|
+
std::unique_ptr<protocol::DOMStorage::StorageId> storageId) override;
|
|
38
|
+
|
|
39
|
+
void domStorageItemAdded(v8::Local<v8::Context> context,
|
|
40
|
+
v8::Local<v8::Object> params);
|
|
41
|
+
void domStorageItemRemoved(v8::Local<v8::Context> context,
|
|
42
|
+
v8::Local<v8::Object> params);
|
|
43
|
+
void domStorageItemUpdated(v8::Local<v8::Context> context,
|
|
44
|
+
v8::Local<v8::Object> params);
|
|
45
|
+
void domStorageItemsCleared(v8::Local<v8::Context> context,
|
|
46
|
+
v8::Local<v8::Object> params);
|
|
47
|
+
void registerStorage(v8::Local<v8::Context> context,
|
|
48
|
+
v8::Local<v8::Object> params);
|
|
49
|
+
bool canEmit(const std::string& domain) override;
|
|
50
|
+
|
|
51
|
+
DOMStorageAgent(const DOMStorageAgent&) = delete;
|
|
52
|
+
DOMStorageAgent& operator=(const DOMStorageAgent&) = delete;
|
|
53
|
+
|
|
54
|
+
private:
|
|
55
|
+
typedef std::unordered_map<std::u16string, std::u16string> StorageMap;
|
|
56
|
+
std::optional<node::webstorage::Storage*> getWebStorage(
|
|
57
|
+
bool is_local_storage);
|
|
58
|
+
std::unique_ptr<protocol::DOMStorage::Frontend> frontend_;
|
|
59
|
+
StorageMap local_storage_map_ = {};
|
|
60
|
+
StorageMap session_storage_map_ = {};
|
|
61
|
+
bool enabled_ = false;
|
|
62
|
+
Environment* env_;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
} // namespace inspector
|
|
66
|
+
} // namespace node
|
|
67
|
+
|
|
68
|
+
#endif // SRC_INSPECTOR_DOM_STORAGE_AGENT_H_
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#ifndef SRC_INSPECTOR_INSPECTOR_OBJECT_UTILS_H_
|
|
2
|
+
#define SRC_INSPECTOR_INSPECTOR_OBJECT_UTILS_H_
|
|
3
|
+
|
|
4
|
+
#include <v8.h>
|
|
5
|
+
#include "node/inspector/protocol/Protocol.h"
|
|
6
|
+
|
|
7
|
+
namespace node {
|
|
8
|
+
namespace inspector {
|
|
9
|
+
|
|
10
|
+
v8::Maybe<protocol::String> ObjectGetProtocolString(
|
|
11
|
+
v8::Local<v8::Context> context,
|
|
12
|
+
v8::Local<v8::Object> object,
|
|
13
|
+
v8::Local<v8::String> property);
|
|
14
|
+
|
|
15
|
+
v8::Maybe<protocol::String> ObjectGetProtocolString(
|
|
16
|
+
v8::Local<v8::Context> context,
|
|
17
|
+
v8::Local<v8::Object> object,
|
|
18
|
+
const char* property);
|
|
19
|
+
|
|
20
|
+
v8::Maybe<double> ObjectGetDouble(v8::Local<v8::Context> context,
|
|
21
|
+
v8::Local<v8::Object> object,
|
|
22
|
+
const char* property);
|
|
23
|
+
|
|
24
|
+
v8::Maybe<int> ObjectGetInt(v8::Local<v8::Context> context,
|
|
25
|
+
v8::Local<v8::Object> object,
|
|
26
|
+
const char* property);
|
|
27
|
+
|
|
28
|
+
v8::Maybe<bool> ObjectGetBool(v8::Local<v8::Context> context,
|
|
29
|
+
v8::Local<v8::Object> object,
|
|
30
|
+
const char* property);
|
|
31
|
+
|
|
32
|
+
v8::MaybeLocal<v8::Object> ObjectGetObject(v8::Local<v8::Context> context,
|
|
33
|
+
v8::Local<v8::Object> object,
|
|
34
|
+
const char* property);
|
|
35
|
+
|
|
36
|
+
} // namespace inspector
|
|
37
|
+
} // namespace node
|
|
38
|
+
#endif // SRC_INSPECTOR_INSPECTOR_OBJECT_UTILS_H_
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#ifndef SRC_INSPECTOR_IO_AGENT_H_
|
|
2
|
+
#define SRC_INSPECTOR_IO_AGENT_H_
|
|
3
|
+
|
|
4
|
+
#include <memory>
|
|
5
|
+
#include "inspector/network_resource_manager.h"
|
|
6
|
+
#include "node/inspector/protocol/IO.h"
|
|
7
|
+
|
|
8
|
+
namespace node::inspector::protocol {
|
|
9
|
+
|
|
10
|
+
class IoAgent : public IO::Backend {
|
|
11
|
+
public:
|
|
12
|
+
explicit IoAgent(
|
|
13
|
+
std::shared_ptr<NetworkResourceManager> network_resource_manager)
|
|
14
|
+
: network_resource_manager_(std::move(network_resource_manager)) {}
|
|
15
|
+
void Wire(UberDispatcher* dispatcher);
|
|
16
|
+
DispatchResponse read(const String& in_handle,
|
|
17
|
+
std::optional<int> in_offset,
|
|
18
|
+
std::optional<int> in_size,
|
|
19
|
+
String* out_data,
|
|
20
|
+
bool* out_eof) override;
|
|
21
|
+
DispatchResponse close(const String& in_handle) override;
|
|
22
|
+
|
|
23
|
+
private:
|
|
24
|
+
std::shared_ptr<IO::Frontend> frontend_;
|
|
25
|
+
std::unordered_map<std::string, int> offset_map_ =
|
|
26
|
+
{}; // Maps stream_id to offset
|
|
27
|
+
std::shared_ptr<NetworkResourceManager> network_resource_manager_;
|
|
28
|
+
};
|
|
29
|
+
} // namespace node::inspector::protocol
|
|
30
|
+
#endif // SRC_INSPECTOR_IO_AGENT_H_
|