Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http2: rename http2_state class to Http2State #20423

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CPP_STYLE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* [CamelCase for methods, functions, and classes](#camelcase-for-methods-functions-and-classes)
* [snake\_case for local variables and parameters](#snake_case-for-local-variables-and-parameters)
* [snake\_case\_ for private class fields](#snake_case_-for-private-class-fields)
* [snake\_case\_ for C-like structs](#snake_case_-for-c-like-structs)
* [Space after `template`](#space-after-template)
* [Memory Management](#memory-management)
* [Memory allocation](#memory-allocation)
Expand Down Expand Up @@ -147,6 +148,15 @@ class Foo {
};
```

## snake\_case\_ for C-like structs
For plain C-like structs snake_case can be used.

```c++
struct foo_bar {
int name;
}
```

## Space after `template`

```c++
Expand Down
4 changes: 2 additions & 2 deletions src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,12 @@ inline void Environment::set_http_parser_buffer_in_use(bool in_use) {
http_parser_buffer_in_use_ = in_use;
}

inline http2::http2_state* Environment::http2_state() const {
inline http2::Http2State* Environment::http2_state() const {
return http2_state_.get();
}

inline void Environment::set_http2_state(
std::unique_ptr<http2::http2_state> buffer) {
std::unique_ptr<http2::Http2State> buffer) {
CHECK(!http2_state_); // Should be set only once.
http2_state_ = std::move(buffer);
}
Expand Down
6 changes: 3 additions & 3 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,8 @@ class Environment {
inline bool http_parser_buffer_in_use() const;
inline void set_http_parser_buffer_in_use(bool in_use);

inline http2::http2_state* http2_state() const;
inline void set_http2_state(std::unique_ptr<http2::http2_state> state);
inline http2::Http2State* http2_state() const;
inline void set_http2_state(std::unique_ptr<http2::Http2State> state);

inline AliasedBuffer<double, v8::Float64Array>* fs_stats_field_array();

Expand Down Expand Up @@ -829,7 +829,7 @@ class Environment {

char* http_parser_buffer_;
bool http_parser_buffer_in_use_ = false;
std::unique_ptr<http2::http2_state> http2_state_;
std::unique_ptr<http2::Http2State> http2_state_;

AliasedBuffer<double, v8::Float64Array> fs_stats_field_array_;

Expand Down
2 changes: 1 addition & 1 deletion src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2660,7 +2660,7 @@ void Initialize(Local<Object> target,
Isolate* isolate = env->isolate();
HandleScope scope(isolate);

std::unique_ptr<http2_state> state(new http2_state(isolate));
std::unique_ptr<Http2State> state(new Http2State(isolate));

#define SET_STATE_TYPEDARRAY(name, field) \
target->Set(context, \
Expand Down
4 changes: 2 additions & 2 deletions src/node_http2_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ namespace http2 {
IDX_SESSION_STATS_COUNT
};

class http2_state {
class Http2State {
public:
explicit http2_state(v8::Isolate* isolate) :
explicit Http2State(v8::Isolate* isolate) :
root_buffer(
isolate,
sizeof(http2_state_internal)),
Expand Down