summaryrefslogtreecommitdiff
path: root/src/tracing/node_trace_buffer.cc
diff options
context:
space:
mode:
authorEugene Ostroukhov <eostroukhov@google.com>2018-04-27 17:20:37 -0700
committerEugene Ostroukhov <eostroukhov@google.com>2018-05-17 13:14:26 -0700
commit47bdc716f83462b6ab938315d11de6c92be082ac (patch)
tree8bdfd8c487cdcfb4e5b573b24d7809d053c675a6 /src/tracing/node_trace_buffer.cc
parent5248401174ff1ec02f5e1a247a97594341bbfd89 (diff)
downloadandroid-node-v8-47bdc716f83462b6ab938315d11de6c92be082ac.tar.gz
android-node-v8-47bdc716f83462b6ab938315d11de6c92be082ac.tar.bz2
android-node-v8-47bdc716f83462b6ab938315d11de6c92be082ac.zip
inspector: add a "NodeTracing" domain support
This change adds a new inspector domain for receiving Node tracing data. 1. Node.js now can extend Inspector protocol with new domains with the API defined in the src/inspector/node_protocol.pdl. 2. Plumbing code will be generated at the build time. /json/protocol HTTP endpoint returns both V8 and Node.js inspector protocol. 3. "NodeTracing" domain was introduced. It is based on the Chrome "Tracing" domain. PR-URL: https://github.com/nodejs/node/pull/20608 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'src/tracing/node_trace_buffer.cc')
-rw-r--r--src/tracing/node_trace_buffer.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/tracing/node_trace_buffer.cc b/src/tracing/node_trace_buffer.cc
index 4c9f7c658f..1765b88df1 100644
--- a/src/tracing/node_trace_buffer.cc
+++ b/src/tracing/node_trace_buffer.cc
@@ -4,9 +4,9 @@ namespace node {
namespace tracing {
InternalTraceBuffer::InternalTraceBuffer(size_t max_chunks, uint32_t id,
- NodeTraceWriter* trace_writer)
+ Agent* agent)
: flushing_(false), max_chunks_(max_chunks),
- trace_writer_(trace_writer), id_(id) {
+ agent_(agent), id_(id) {
chunks_.resize(max_chunks);
}
@@ -59,14 +59,14 @@ void InternalTraceBuffer::Flush(bool blocking) {
for (size_t i = 0; i < total_chunks_; ++i) {
auto& chunk = chunks_[i];
for (size_t j = 0; j < chunk->size(); ++j) {
- trace_writer_->AppendTraceEvent(chunk->GetEventAt(j));
+ agent_->AppendTraceEvent(chunk->GetEventAt(j));
}
}
total_chunks_ = 0;
flushing_ = false;
}
}
- trace_writer_->Flush(blocking);
+ agent_->Flush(blocking);
}
uint64_t InternalTraceBuffer::MakeHandle(
@@ -87,10 +87,10 @@ void InternalTraceBuffer::ExtractHandle(
}
NodeTraceBuffer::NodeTraceBuffer(size_t max_chunks,
- NodeTraceWriter* trace_writer, uv_loop_t* tracing_loop)
- : tracing_loop_(tracing_loop), trace_writer_(trace_writer),
- buffer1_(max_chunks, 0, trace_writer),
- buffer2_(max_chunks, 1, trace_writer) {
+ Agent* agent, uv_loop_t* tracing_loop)
+ : tracing_loop_(tracing_loop), agent_(agent),
+ buffer1_(max_chunks, 0, agent),
+ buffer2_(max_chunks, 1, agent) {
current_buf_.store(&buffer1_);
flush_signal_.data = this;