@@ -3070,9 +3070,6 @@ void Initialize(Local<Object> target,
3070
3070
env->SetMethod (target, " packSettings" , PackSettings);
3071
3071
env->SetMethod (target, " setCallbackFunctions" , SetCallbackFunctions);
3072
3072
3073
- Local<String> http2SessionClassName =
3074
- FIXED_ONE_BYTE_STRING (isolate, " Http2Session" );
3075
-
3076
3073
Local<FunctionTemplate> ping = FunctionTemplate::New (env->isolate ());
3077
3074
ping->SetClassName (FIXED_ONE_BYTE_STRING (env->isolate (), " Http2Ping" ));
3078
3075
ping->Inherit (AsyncWrap::GetConstructorTemplate (env));
@@ -3081,14 +3078,12 @@ void Initialize(Local<Object> target,
3081
3078
env->set_http2ping_constructor_template (pingt);
3082
3079
3083
3080
Local<FunctionTemplate> setting = FunctionTemplate::New (env->isolate ());
3084
- setting->SetClassName (FIXED_ONE_BYTE_STRING (env->isolate (), " Http2Setting" ));
3085
3081
setting->Inherit (AsyncWrap::GetConstructorTemplate (env));
3086
3082
Local<ObjectTemplate> settingt = setting->InstanceTemplate ();
3087
3083
settingt->SetInternalFieldCount (AsyncWrap::kInternalFieldCount );
3088
3084
env->set_http2settings_constructor_template (settingt);
3089
3085
3090
3086
Local<FunctionTemplate> stream = FunctionTemplate::New (env->isolate ());
3091
- stream->SetClassName (FIXED_ONE_BYTE_STRING (env->isolate (), " Http2Stream" ));
3092
3087
env->SetProtoMethod (stream, " id" , Http2Stream::GetID);
3093
3088
env->SetProtoMethod (stream, " destroy" , Http2Stream::Destroy);
3094
3089
env->SetProtoMethod (stream, " priority" , Http2Stream::Priority);
@@ -3103,13 +3098,10 @@ void Initialize(Local<Object> target,
3103
3098
Local<ObjectTemplate> streamt = stream->InstanceTemplate ();
3104
3099
streamt->SetInternalFieldCount (StreamBase::kInternalFieldCount );
3105
3100
env->set_http2stream_constructor_template (streamt);
3106
- target->Set (context,
3107
- FIXED_ONE_BYTE_STRING (env->isolate (), " Http2Stream" ),
3108
- stream->GetFunction (env->context ()).ToLocalChecked ()).Check ();
3101
+ env->SetConstructorFunction (target, " Http2Stream" , stream);
3109
3102
3110
3103
Local<FunctionTemplate> session =
3111
3104
env->NewFunctionTemplate (Http2Session::New);
3112
- session->SetClassName (http2SessionClassName);
3113
3105
session->InstanceTemplate ()->SetInternalFieldCount (
3114
3106
Http2Session::kInternalFieldCount );
3115
3107
session->Inherit (AsyncWrap::GetConstructorTemplate (env));
@@ -3135,9 +3127,7 @@ void Initialize(Local<Object> target,
3135
3127
env->SetProtoMethod (
3136
3128
session, " remoteSettings" ,
3137
3129
Http2Session::RefreshSettings<nghttp2_session_get_remote_settings>);
3138
- target->Set (context,
3139
- http2SessionClassName,
3140
- session->GetFunction (env->context ()).ToLocalChecked ()).Check ();
3130
+ env->SetConstructorFunction (target, " Http2Session" , session);
3141
3131
3142
3132
Local<Object> constants = Object::New (isolate);
3143
3133
0 commit comments