Skip to content

Commit 3fa643b

Browse files
bnoordhuisFishrock123
authored andcommitted
src: fix whitespace/indent cpplint warnings
PR-URL: #7462 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
1 parent f72259a commit 3fa643b

File tree

4 files changed

+249
-248
lines changed

4 files changed

+249
-248
lines changed

src/node_internals.h

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -231,82 +231,82 @@ void ClearFatalExceptionHandlers(Environment* env);
231231
enum NodeInstanceType { MAIN, WORKER, REMOTE_DEBUG_SERVER };
232232

233233
class NodeInstanceData {
234-
public:
235-
NodeInstanceData(NodeInstanceType node_instance_type,
236-
uv_loop_t* event_loop,
237-
int argc,
238-
const char** argv,
239-
int exec_argc,
240-
const char** exec_argv,
241-
bool use_debug_agent_flag)
242-
: node_instance_type_(node_instance_type),
243-
exit_code_(1),
244-
event_loop_(event_loop),
245-
argc_(argc),
246-
argv_(argv),
247-
exec_argc_(exec_argc),
248-
exec_argv_(exec_argv),
249-
use_debug_agent_flag_(use_debug_agent_flag) {
250-
CHECK_NE(event_loop_, nullptr);
251-
}
252-
253-
uv_loop_t* event_loop() const {
254-
return event_loop_;
255-
}
256-
257-
int exit_code() {
258-
CHECK(is_main());
259-
return exit_code_;
260-
}
261-
262-
void set_exit_code(int exit_code) {
263-
CHECK(is_main());
264-
exit_code_ = exit_code;
265-
}
266-
267-
bool is_main() {
268-
return node_instance_type_ == MAIN;
269-
}
270-
271-
bool is_worker() {
272-
return node_instance_type_ == WORKER;
273-
}
274-
275-
bool is_remote_debug_server() {
276-
return node_instance_type_ == REMOTE_DEBUG_SERVER;
277-
}
278-
279-
int argc() {
280-
return argc_;
281-
}
282-
283-
const char** argv() {
284-
return argv_;
285-
}
286-
287-
int exec_argc() {
288-
return exec_argc_;
289-
}
290-
291-
const char** exec_argv() {
292-
return exec_argv_;
293-
}
294-
295-
bool use_debug_agent() {
296-
return is_main() && use_debug_agent_flag_;
297-
}
298-
299-
private:
300-
const NodeInstanceType node_instance_type_;
301-
int exit_code_;
302-
uv_loop_t* const event_loop_;
303-
const int argc_;
304-
const char** argv_;
305-
const int exec_argc_;
306-
const char** exec_argv_;
307-
const bool use_debug_agent_flag_;
308-
309-
DISALLOW_COPY_AND_ASSIGN(NodeInstanceData);
234+
public:
235+
NodeInstanceData(NodeInstanceType node_instance_type,
236+
uv_loop_t* event_loop,
237+
int argc,
238+
const char** argv,
239+
int exec_argc,
240+
const char** exec_argv,
241+
bool use_debug_agent_flag)
242+
: node_instance_type_(node_instance_type),
243+
exit_code_(1),
244+
event_loop_(event_loop),
245+
argc_(argc),
246+
argv_(argv),
247+
exec_argc_(exec_argc),
248+
exec_argv_(exec_argv),
249+
use_debug_agent_flag_(use_debug_agent_flag) {
250+
CHECK_NE(event_loop_, nullptr);
251+
}
252+
253+
uv_loop_t* event_loop() const {
254+
return event_loop_;
255+
}
256+
257+
int exit_code() {
258+
CHECK(is_main());
259+
return exit_code_;
260+
}
261+
262+
void set_exit_code(int exit_code) {
263+
CHECK(is_main());
264+
exit_code_ = exit_code;
265+
}
266+
267+
bool is_main() {
268+
return node_instance_type_ == MAIN;
269+
}
270+
271+
bool is_worker() {
272+
return node_instance_type_ == WORKER;
273+
}
274+
275+
bool is_remote_debug_server() {
276+
return node_instance_type_ == REMOTE_DEBUG_SERVER;
277+
}
278+
279+
int argc() {
280+
return argc_;
281+
}
282+
283+
const char** argv() {
284+
return argv_;
285+
}
286+
287+
int exec_argc() {
288+
return exec_argc_;
289+
}
290+
291+
const char** exec_argv() {
292+
return exec_argv_;
293+
}
294+
295+
bool use_debug_agent() {
296+
return is_main() && use_debug_agent_flag_;
297+
}
298+
299+
private:
300+
const NodeInstanceType node_instance_type_;
301+
int exit_code_;
302+
uv_loop_t* const event_loop_;
303+
const int argc_;
304+
const char** argv_;
305+
const int exec_argc_;
306+
const char** exec_argv_;
307+
const bool use_debug_agent_flag_;
308+
309+
DISALLOW_COPY_AND_ASSIGN(NodeInstanceData);
310310
};
311311

312312
namespace Buffer {

src/node_watchdog.h

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -39,56 +39,57 @@ class Watchdog {
3939
};
4040

4141
class SigintWatchdog {
42-
public:
43-
explicit SigintWatchdog(v8::Isolate* isolate);
44-
~SigintWatchdog();
42+
public:
43+
explicit SigintWatchdog(v8::Isolate* isolate);
44+
~SigintWatchdog();
4545

46-
void Dispose();
46+
void Dispose();
4747

48-
v8::Isolate* isolate() { return isolate_; }
49-
bool HasReceivedSignal() { return received_signal_; }
50-
void HandleSigint();
51-
private:
52-
void Destroy();
48+
v8::Isolate* isolate() { return isolate_; }
49+
bool HasReceivedSignal() { return received_signal_; }
50+
void HandleSigint();
51+
52+
private:
53+
void Destroy();
5354

54-
v8::Isolate* isolate_;
55-
bool received_signal_;
56-
bool destroyed_;
55+
v8::Isolate* isolate_;
56+
bool received_signal_;
57+
bool destroyed_;
5758
};
5859

5960
class SigintWatchdogHelper {
60-
public:
61-
static SigintWatchdogHelper* GetInstance() { return &instance; }
62-
void Register(SigintWatchdog* watchdog);
63-
void Unregister(SigintWatchdog* watchdog);
61+
public:
62+
static SigintWatchdogHelper* GetInstance() { return &instance; }
63+
void Register(SigintWatchdog* watchdog);
64+
void Unregister(SigintWatchdog* watchdog);
6465

65-
int Start();
66-
bool Stop();
66+
int Start();
67+
bool Stop();
6768

68-
private:
69-
SigintWatchdogHelper();
70-
~SigintWatchdogHelper();
69+
private:
70+
SigintWatchdogHelper();
71+
~SigintWatchdogHelper();
7172

72-
static bool InformWatchdogsAboutSignal();
73-
static SigintWatchdogHelper instance;
73+
static bool InformWatchdogsAboutSignal();
74+
static SigintWatchdogHelper instance;
7475

75-
int start_stop_count_;
76+
int start_stop_count_;
7677

77-
uv_mutex_t mutex_;
78-
uv_mutex_t list_mutex_;
79-
std::vector<SigintWatchdog*> watchdogs_;
80-
bool has_pending_signal_;
78+
uv_mutex_t mutex_;
79+
uv_mutex_t list_mutex_;
80+
std::vector<SigintWatchdog*> watchdogs_;
81+
bool has_pending_signal_;
8182

8283
#ifdef __POSIX__
83-
pthread_t thread_;
84-
uv_sem_t sem_;
85-
bool has_running_thread_;
86-
bool stopping_;
84+
pthread_t thread_;
85+
uv_sem_t sem_;
86+
bool has_running_thread_;
87+
bool stopping_;
8788

88-
static void* RunSigintWatchdog(void* arg);
89-
static void HandleSignal(int signum);
89+
static void* RunSigintWatchdog(void* arg);
90+
static void HandleSignal(int signum);
9091
#else
91-
static BOOL WINAPI WinCtrlCHandlerRoutine(DWORD dwCtrlType);
92+
static BOOL WINAPI WinCtrlCHandlerRoutine(DWORD dwCtrlType);
9293
#endif
9394
};
9495

src/string_bytes.cc

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -27,78 +27,78 @@ using v8::Value;
2727

2828
template <typename ResourceType, typename TypeName>
2929
class ExternString: public ResourceType {
30-
public:
31-
~ExternString() override {
32-
free(const_cast<TypeName*>(data_));
33-
isolate()->AdjustAmountOfExternalAllocatedMemory(-byte_length());
34-
}
35-
36-
const TypeName* data() const override {
37-
return data_;
38-
}
30+
public:
31+
~ExternString() override {
32+
free(const_cast<TypeName*>(data_));
33+
isolate()->AdjustAmountOfExternalAllocatedMemory(-byte_length());
34+
}
3935

40-
size_t length() const override {
41-
return length_;
42-
}
36+
const TypeName* data() const override {
37+
return data_;
38+
}
4339

44-
int64_t byte_length() const {
45-
return length() * sizeof(*data());
46-
}
40+
size_t length() const override {
41+
return length_;
42+
}
4743

48-
static Local<String> NewFromCopy(Isolate* isolate,
49-
const TypeName* data,
50-
size_t length) {
51-
EscapableHandleScope scope(isolate);
44+
int64_t byte_length() const {
45+
return length() * sizeof(*data());
46+
}
5247

53-
if (length == 0)
54-
return scope.Escape(String::Empty(isolate));
48+
static Local<String> NewFromCopy(Isolate* isolate,
49+
const TypeName* data,
50+
size_t length) {
51+
EscapableHandleScope scope(isolate);
5552

56-
TypeName* new_data =
57-
static_cast<TypeName*>(malloc(length * sizeof(*new_data)));
58-
if (new_data == nullptr) {
59-
return Local<String>();
60-
}
61-
memcpy(new_data, data, length * sizeof(*new_data));
53+
if (length == 0)
54+
return scope.Escape(String::Empty(isolate));
6255

63-
return scope.Escape(ExternString<ResourceType, TypeName>::New(isolate,
64-
new_data,
65-
length));
56+
TypeName* new_data =
57+
static_cast<TypeName*>(malloc(length * sizeof(*new_data)));
58+
if (new_data == nullptr) {
59+
return Local<String>();
6660
}
61+
memcpy(new_data, data, length * sizeof(*new_data));
6762

68-
// uses "data" for external resource, and will be free'd on gc
69-
static Local<String> New(Isolate* isolate,
70-
const TypeName* data,
71-
size_t length) {
72-
EscapableHandleScope scope(isolate);
63+
return scope.Escape(ExternString<ResourceType, TypeName>::New(isolate,
64+
new_data,
65+
length));
66+
}
7367

74-
if (length == 0)
75-
return scope.Escape(String::Empty(isolate));
68+
// uses "data" for external resource, and will be free'd on gc
69+
static Local<String> New(Isolate* isolate,
70+
const TypeName* data,
71+
size_t length) {
72+
EscapableHandleScope scope(isolate);
7673

77-
ExternString* h_str = new ExternString<ResourceType, TypeName>(isolate,
78-
data,
79-
length);
80-
MaybeLocal<String> str = NewExternal(isolate, h_str);
81-
isolate->AdjustAmountOfExternalAllocatedMemory(h_str->byte_length());
74+
if (length == 0)
75+
return scope.Escape(String::Empty(isolate));
8276

83-
if (str.IsEmpty()) {
84-
delete h_str;
85-
return Local<String>();
86-
}
77+
ExternString* h_str = new ExternString<ResourceType, TypeName>(isolate,
78+
data,
79+
length);
80+
MaybeLocal<String> str = NewExternal(isolate, h_str);
81+
isolate->AdjustAmountOfExternalAllocatedMemory(h_str->byte_length());
8782

88-
return scope.Escape(str.ToLocalChecked());
83+
if (str.IsEmpty()) {
84+
delete h_str;
85+
return Local<String>();
8986
}
9087

91-
inline Isolate* isolate() const { return isolate_; }
88+
return scope.Escape(str.ToLocalChecked());
89+
}
90+
91+
inline Isolate* isolate() const { return isolate_; }
9292

93-
private:
94-
ExternString(Isolate* isolate, const TypeName* data, size_t length)
95-
: isolate_(isolate), data_(data), length_(length) { }
96-
static MaybeLocal<String> NewExternal(Isolate* isolate,
97-
ExternString* h_str);
93+
private:
94+
ExternString(Isolate* isolate, const TypeName* data, size_t length)
95+
: isolate_(isolate), data_(data), length_(length) { }
96+
static MaybeLocal<String> NewExternal(Isolate* isolate,
97+
ExternString* h_str);
9898

99-
Isolate* isolate_;
100-
const TypeName* data_;
101-
size_t length_;
99+
Isolate* isolate_;
100+
const TypeName* data_;
101+
size_t length_;
102102
};
103103

104104

0 commit comments

Comments
 (0)