Permalink
Browse files

build: enable C++ linting for src/*/*

Fixes: #14490
PR-URL: #14497
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Refael Ackermann <refack@gmail.com>
  • Loading branch information...
Jeyanthinath authored and TimothyGu committed Jul 26, 2017
1 parent 5fd2f03 commit e88908d8684d4108a3079a6b6af0e5f4ce1b09b9
View
@@ -891,11 +891,16 @@ CPPLINT_EXCLUDE += src/queue.h
CPPLINT_EXCLUDE += src/tree.h
CPPLINT_EXCLUDE += $(wildcard test/addons/??_*/*.cc test/addons/??_*/*.h)
CPPLINT_EXCLUDE += $(wildcard test/addons-napi/??_*/*.cc test/addons-napi/??_*/*.h)
# These files were copied more or less verbatim from V8.
CPPLINT_EXCLUDE += src/tracing/trace_event.h src/tracing/trace_event_common.h
CPPLINT_FILES = $(filter-out $(CPPLINT_EXCLUDE), $(wildcard \
src/*.c \
src/*.cc \
src/*.h \
src/*/*.c \
src/*/*.cc \
src/*/*.h \
test/addons/*/*.cc \
test/addons/*/*.h \
test/cctest/*.cc \
View
@@ -11,7 +11,7 @@ namespace tracing {
class Agent {
public:
explicit Agent();
Agent();
void Start(v8::Platform* platform, const std::string& enabled_categories);
void Stop();
@@ -94,7 +94,8 @@ NodeTraceBuffer::NodeTraceBuffer(size_t max_chunks,
current_buf_.store(&buffer1_);
flush_signal_.data = this;
int err = uv_async_init(tracing_loop_, &flush_signal_, NonBlockingFlushSignalCb);
int err = uv_async_init(tracing_loop_, &flush_signal_,
NonBlockingFlushSignalCb);
CHECK_EQ(err, 0);
exit_signal_.data = this;
@@ -105,7 +106,7 @@ NodeTraceBuffer::NodeTraceBuffer(size_t max_chunks,
NodeTraceBuffer::~NodeTraceBuffer() {
uv_async_send(&exit_signal_);
Mutex::ScopedLock scoped_lock(exit_mutex_);
while(!exited_) {
while (!exited_) {
exit_cond_.Wait(scoped_lock);
}
}
@@ -138,7 +139,7 @@ bool NodeTraceBuffer::Flush() {
bool NodeTraceBuffer::TryLoadAvailableBuffer() {
InternalTraceBuffer* prev_buf = current_buf_.load();
if (prev_buf->IsFull()) {
uv_async_send(&flush_signal_); // trigger flush on a separate thread
uv_async_send(&flush_signal_); // trigger flush on a separate thread
InternalTraceBuffer* other_buf = prev_buf == &buffer1_ ?
&buffer2_ : &buffer1_;
if (!other_buf->IsFull()) {
@@ -165,8 +166,10 @@ void NodeTraceBuffer::NonBlockingFlushSignalCb(uv_async_t* signal) {
void NodeTraceBuffer::ExitSignalCb(uv_async_t* signal) {
NodeTraceBuffer* buffer = reinterpret_cast<NodeTraceBuffer*>(signal->data);
uv_close(reinterpret_cast<uv_handle_t*>(&buffer->flush_signal_), nullptr);
uv_close(reinterpret_cast<uv_handle_t*>(&buffer->exit_signal_), [](uv_handle_t* signal) {
NodeTraceBuffer* buffer = reinterpret_cast<NodeTraceBuffer*>(signal->data);
uv_close(reinterpret_cast<uv_handle_t*>(&buffer->exit_signal_),
[](uv_handle_t* signal) {
NodeTraceBuffer* buffer =
reinterpret_cast<NodeTraceBuffer*>(signal->data);
Mutex::ScopedLock scoped_lock(buffer->exit_mutex_);
buffer->exited_ = true;
buffer->exit_cond_.Signal(scoped_lock);
@@ -1,5 +1,5 @@
#ifndef SRC_NODE_TRACE_BUFFER_H_
#define SRC_NODE_TRACE_BUFFER_H_
#ifndef SRC_TRACING_NODE_TRACE_BUFFER_H_
#define SRC_TRACING_NODE_TRACE_BUFFER_H_
#include "node_mutex.h"
#include "tracing/node_trace_writer.h"
@@ -75,7 +75,6 @@ class NodeTraceBuffer : public TraceBuffer {
// Used to wait until async handles have been closed.
ConditionVariable exit_cond_;
std::unique_ptr<NodeTraceWriter> trace_writer_;
// TODO: Change std::atomic to something less contentious.
std::atomic<InternalTraceBuffer*> current_buf_;
InternalTraceBuffer buffer1_;
InternalTraceBuffer buffer2_;
@@ -84,4 +83,4 @@ class NodeTraceBuffer : public TraceBuffer {
} // namespace tracing
} // namespace node
#endif // SRC_NODE_TRACING_CONTROLLER_H_
#endif // SRC_TRACING_NODE_TRACE_BUFFER_H_
@@ -27,7 +27,7 @@ void NodeTraceWriter::WriteSuffix() {
{
Mutex::ScopedLock scoped_lock(stream_mutex_);
if (total_traces_ > 0) {
total_traces_ = 0; // so we don't write it again in FlushPrivate
total_traces_ = 0; // so we don't write it again in FlushPrivate
// Appends "]}" to stream_.
delete json_trace_writer_;
should_flush = true;
@@ -49,7 +49,7 @@ NodeTraceWriter::~NodeTraceWriter() {
}
uv_async_send(&exit_signal_);
Mutex::ScopedLock scoped_lock(request_mutex_);
while(!exited_) {
while (!exited_) {
exit_cond_.Wait(scoped_lock);
}
}
@@ -110,8 +110,8 @@ void NodeTraceWriter::FlushSignalCb(uv_async_t* signal) {
trace_writer->FlushPrivate();
}
// TODO: Remove (is it necessary to change the API? Since because of WriteSuffix
// it no longer matters whether it's true or false)
// TODO(matthewloring): Remove (is it necessary to change the API?
// Since because of WriteSuffix it no longer matters whether it's true or false)
void NodeTraceWriter::Flush() {
Flush(true);
}
@@ -172,9 +172,12 @@ void NodeTraceWriter::WriteCb(uv_fs_t* req) {
// static
void NodeTraceWriter::ExitSignalCb(uv_async_t* signal) {
NodeTraceWriter* trace_writer = static_cast<NodeTraceWriter*>(signal->data);
uv_close(reinterpret_cast<uv_handle_t*>(&trace_writer->flush_signal_), nullptr);
uv_close(reinterpret_cast<uv_handle_t*>(&trace_writer->exit_signal_), [](uv_handle_t* signal) {
NodeTraceWriter* trace_writer = static_cast<NodeTraceWriter*>(signal->data);
uv_close(reinterpret_cast<uv_handle_t*>(&trace_writer->flush_signal_),
nullptr);
uv_close(reinterpret_cast<uv_handle_t*>(&trace_writer->exit_signal_),
[](uv_handle_t* signal) {
NodeTraceWriter* trace_writer =
static_cast<NodeTraceWriter*>(signal->data);
Mutex::ScopedLock scoped_lock(trace_writer->request_mutex_);
trace_writer->exited_ = true;
trace_writer->exit_cond_.Signal(scoped_lock);
@@ -1,5 +1,5 @@
#ifndef SRC_NODE_TRACE_WRITER_H_
#define SRC_NODE_TRACE_WRITER_H_
#ifndef SRC_TRACING_NODE_TRACE_WRITER_H_
#define SRC_TRACING_NODE_TRACE_WRITER_H_
#include <sstream>
#include <queue>
@@ -17,7 +17,7 @@ using v8::platform::tracing::TracingController;
class NodeTraceWriter : public TraceWriter {
public:
NodeTraceWriter(uv_loop_t* tracing_loop);
explicit NodeTraceWriter(uv_loop_t* tracing_loop);
~NodeTraceWriter();
void AppendTraceEvent(TraceObject* trace_event) override;
@@ -71,4 +71,4 @@ class NodeTraceWriter : public TraceWriter {
} // namespace tracing
} // namespace node
#endif // SRC_NODE_TRACE_WRITER_H_
#endif // SRC_TRACING_NODE_TRACE_WRITER_H_

0 comments on commit e88908d

Please sign in to comment.