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: make Http2Settings constructors delegate #23326

Closed
wants to merge 1 commit 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
27 changes: 11 additions & 16 deletions src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -225,32 +225,27 @@ void Http2Session::Http2Settings::Init() {
count_ = n;
}

Http2Session::Http2Settings::Http2Settings(
Environment* env)
Http2Session::Http2Settings::Http2Settings(Environment* env,
Http2Session* session, uint64_t start_time)
: AsyncWrap(env,
env->http2settings_constructor_template()
->NewInstance(env->context())
.ToLocalChecked(),
AsyncWrap::PROVIDER_HTTP2SETTINGS),
session_(nullptr),
startTime_(0) {
PROVIDER_HTTP2SETTINGS),
session_(session),
startTime_(start_time) {
Init();
}


Http2Session::Http2Settings::Http2Settings(Environment* env)
: Http2Settings(env, nullptr, 0) {}

// The Http2Settings class is used to configure a SETTINGS frame that is
// to be sent to the connected peer. The settings are set using a TypedArray
// that is shared with the JavaScript side.
Http2Session::Http2Settings::Http2Settings(
Http2Session* session)
: AsyncWrap(session->env(),
session->env()->http2settings_constructor_template()
->NewInstance(session->env()->context())
.ToLocalChecked(),
AsyncWrap::PROVIDER_HTTP2SETTINGS),
session_(session),
startTime_(uv_hrtime()) {
Init();
}
Http2Session::Http2Settings::Http2Settings(Http2Session* session)
: Http2Settings(session->env(), session, uv_hrtime()) {}

// Generates a Buffer that contains the serialized payload of a SETTINGS
// frame. This can be used, for instance, to create the Base64-encoded
Expand Down
1 change: 1 addition & 0 deletions src/node_http2.h
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,7 @@ class Http2Session::Http2Settings : public AsyncWrap {
get_setting fn);

private:
Http2Settings(Environment* env, Http2Session* session, uint64_t start_time);
void Init();
Http2Session* session_;
uint64_t startTime_;
Expand Down