diff --git a/src/node_http2.cc b/src/node_http2.cc index 15b83da564bfa9..3d2ca98743fced 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -347,11 +347,11 @@ Http2Priority::Http2Priority(Environment* env, Local context = env->context(); int32_t parent_ = parent->Int32Value(context).ToChecked(); int32_t weight_ = weight->Int32Value(context).ToChecked(); - bool exclusive_ = exclusive->BooleanValue(env->isolate()); + bool exclusive_ = exclusive->IsTrue(); Debug(env, DebugCategory::HTTP2STREAM, "Http2Priority: parent: %d, weight: %d, exclusive: %s\n", parent_, weight_, exclusive_ ? "yes" : "no"); - nghttp2_priority_spec_init(&spec, parent_, weight_, exclusive_ ? 1 : 0); + nghttp2_priority_spec_init(this, parent_, weight_, exclusive_ ? 1 : 0); } @@ -995,8 +995,7 @@ int Http2Session::OnStreamClose(nghttp2_session* handle, MaybeLocal answer = stream->MakeCallback(env->http2session_on_stream_close_function(), 1, &arg); - if (answer.IsEmpty() || - !(answer.ToLocalChecked()->BooleanValue(env->isolate()))) { + if (answer.IsEmpty() || answer.ToLocalChecked()->IsFalse()) { // Skip to destroy stream->Destroy(); } @@ -2443,9 +2442,7 @@ void Http2Session::Destroy(const FunctionCallbackInfo& args) { Local context = env->context(); uint32_t code = args[0]->Uint32Value(context).ToChecked(); - bool socketDestroyed = args[1]->BooleanValue(env->isolate()); - - session->Close(code, socketDestroyed); + session->Close(code, args[1]->IsTrue()); } // Submits a new request on the Http2Session and returns either an error code @@ -2464,7 +2461,7 @@ void Http2Session::Request(const FunctionCallbackInfo& args) { int32_t ret = 0; Http2Stream* stream = session->Http2Session::SubmitRequest( - *priority, + &priority, Http2Headers(env, headers), &ret, static_cast(options)); @@ -2637,9 +2634,9 @@ void Http2Stream::Priority(const FunctionCallbackInfo& args) { ASSIGN_OR_RETURN_UNWRAP(&stream, args.Holder()); Http2Priority priority(env, args[0], args[1], args[2]); - bool silent = args[3]->BooleanValue(env->isolate()); + bool silent = args[3]->IsTrue(); - CHECK_EQ(stream->SubmitPriority(*priority, silent), 0); + CHECK_EQ(stream->SubmitPriority(&priority, silent), 0); Debug(stream, "priority submitted"); } diff --git a/src/node_http2.h b/src/node_http2.h index 1c42fa1b52e532..8881ce7ca05611 100644 --- a/src/node_http2.h +++ b/src/node_http2.h @@ -246,18 +246,11 @@ class Http2Options { size_t max_outstanding_settings_ = kDefaultMaxSettings; }; -class Http2Priority { - public: +struct Http2Priority : public nghttp2_priority_spec { Http2Priority(Environment* env, v8::Local parent, v8::Local weight, v8::Local exclusive); - - nghttp2_priority_spec* operator*() { - return &spec; - } - private: - nghttp2_priority_spec spec; }; class Http2StreamListener : public StreamListener {