Skip to content

Commit 409ff8e

Browse files
committed
lint
1 parent c03e722 commit 409ff8e

File tree

1 file changed

+20
-32
lines changed

1 file changed

+20
-32
lines changed

src/heap_utils.cc

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
#include "stream_base-inl.h"
88
#include "util-inl.h"
99

10-
// Copied from https://github.com/nodejs/node/blob/b07dc4d19fdbc15b4f76557dc45b3ce3a43ad0c3/src/util.cc#L36-L41.
10+
// Copied from
11+
// https://github.com/nodejs/node/blob/b07dc4d19fdbc15b4f76557dc45b3ce3a43ad0c3/src/util.cc#L36-L41.
1112
#ifdef _WIN32
1213
#include <io.h> // _S_IREAD _S_IWRITE
1314
#ifndef S_IRUSR
@@ -80,10 +81,9 @@ class JSGraph : public EmbedderGraph {
8081
explicit JSGraph(Isolate* isolate) : isolate_(isolate) {}
8182

8283
Node* V8Node(const Local<v8::Data>& value) override {
83-
std::unique_ptr<JSGraphJSNode> n { new JSGraphJSNode(isolate_, value) };
84+
std::unique_ptr<JSGraphJSNode> n{new JSGraphJSNode(isolate_, value)};
8485
auto it = engine_nodes_.find(n.get());
85-
if (it != engine_nodes_.end())
86-
return *it;
86+
if (it != engine_nodes_.end()) return *it;
8787
engine_nodes_.insert(n.get());
8888
return AddNode(std::unique_ptr<Node>(n.release()));
8989
}
@@ -188,13 +188,14 @@ class JSGraph : public EmbedderGraph {
188188
const char* edge_name = edge.first;
189189
if (edge_name != nullptr) {
190190
if (!String::NewFromUtf8(isolate_, edge_name)
191-
.ToLocal(&edge_name_value)) {
191+
.ToLocal(&edge_name_value)) {
192192
return MaybeLocal<Array>();
193193
}
194194
} else {
195195
edge_name_value = Number::New(isolate_, static_cast<double>(j++));
196196
}
197-
if (edge_obj->Set(context, name_string, edge_name_value).IsNothing() ||
197+
if (edge_obj->Set(context, name_string, edge_name_value)
198+
.IsNothing() ||
198199
edge_obj->Set(context, to_string, to_object).IsNothing() ||
199200
edges.As<Array>()->Set(context, i++, edge_obj).IsNothing()) {
200201
return MaybeLocal<Array>();
@@ -218,8 +219,7 @@ void BuildEmbedderGraph(const FunctionCallbackInfo<Value>& args) {
218219
JSGraph graph(env->isolate());
219220
Environment::BuildEmbedderGraph(env->isolate(), &graph, env);
220221
Local<Array> ret;
221-
if (graph.CreateObject().ToLocal(&ret))
222-
args.GetReturnValue().Set(ret);
222+
if (graph.CreateObject().ToLocal(&ret)) args.GetReturnValue().Set(ret);
223223
}
224224

225225
namespace {
@@ -238,13 +238,8 @@ class FileOutputStream : public v8::OutputStream {
238238
int offset = 0;
239239
while (offset < size) {
240240
const uv_buf_t buf = uv_buf_init(data + offset, size - offset);
241-
const int num_bytes_written = uv_fs_write(nullptr,
242-
req_,
243-
fd_,
244-
&buf,
245-
1,
246-
-1,
247-
nullptr);
241+
const int num_bytes_written =
242+
uv_fs_write(nullptr, req_, fd_, &buf, 1, -1, nullptr);
248243
uv_fs_req_cleanup(req_);
249244
if (num_bytes_written < 0) {
250245
status_ = num_bytes_written;
@@ -269,13 +264,12 @@ class HeapSnapshotStream : public AsyncWrap,
269264
public StreamBase,
270265
public v8::OutputStream {
271266
public:
272-
HeapSnapshotStream(
273-
Environment* env,
274-
HeapSnapshotPointer&& snapshot,
275-
Local<Object> obj) :
276-
AsyncWrap(env, obj, AsyncWrap::PROVIDER_HEAPSNAPSHOT),
277-
StreamBase(env),
278-
snapshot_(std::move(snapshot)) {
267+
HeapSnapshotStream(Environment* env,
268+
HeapSnapshotPointer&& snapshot,
269+
Local<Object> obj)
270+
: AsyncWrap(env, obj, AsyncWrap::PROVIDER_HEAPSNAPSHOT),
271+
StreamBase(env),
272+
snapshot_(std::move(snapshot)) {
279273
MakeWeak();
280274
StreamBase::AttachToObject(GetObject());
281275
}
@@ -296,8 +290,7 @@ class HeapSnapshotStream : public AsyncWrap,
296290
while (len != 0) {
297291
uv_buf_t buf = EmitAlloc(size);
298292
ssize_t avail = len;
299-
if (static_cast<ssize_t>(buf.len) < avail)
300-
avail = buf.len;
293+
if (static_cast<ssize_t>(buf.len) < avail) avail = buf.len;
301294
memcpy(buf.base, data, avail);
302295
data += avail;
303296
len -= static_cast<int>(avail);
@@ -312,13 +305,9 @@ class HeapSnapshotStream : public AsyncWrap,
312305
return 0;
313306
}
314307

315-
int ReadStop() override {
316-
return 0;
317-
}
308+
int ReadStop() override { return 0; }
318309

319-
int DoShutdown(ShutdownWrap* req_wrap) override {
320-
UNREACHABLE();
321-
}
310+
int DoShutdown(ShutdownWrap* req_wrap) override { UNREACHABLE(); }
322311

323312
int DoWrite(WriteWrap* w,
324313
uv_buf_t* bufs,
@@ -444,8 +433,7 @@ void CreateHeapSnapshotStream(const FunctionCallbackInfo<Value>& args) {
444433
CHECK(snapshot);
445434
BaseObjectPtr<AsyncWrap> stream =
446435
CreateHeapSnapshotStream(env, std::move(snapshot));
447-
if (stream)
448-
args.GetReturnValue().Set(stream->object());
436+
if (stream) args.GetReturnValue().Set(stream->object());
449437
}
450438

451439
void TriggerHeapSnapshot(const FunctionCallbackInfo<Value>& args) {

0 commit comments

Comments
 (0)