@@ -651,7 +651,9 @@ Http2Session::Http2Session(Environment* env,
651651 {
652652 // Make the js_fields_ property accessible to JS land.
653653 Local<ArrayBuffer> ab =
654- ArrayBuffer::New(env->isolate(), js_fields_, kSessionUint8FieldCount);
654+ ArrayBuffer::New(env->isolate(),
655+ reinterpret_cast<uint8_t*>(&js_fields_),
656+ kSessionUint8FieldCount);
655657 Local<Uint8Array> uint8_arr =
656658 Uint8Array::New(ab, 0, kSessionUint8FieldCount);
657659 USE(wrap->Set(env->context(), env->fields_string(), uint8_arr));
@@ -1082,7 +1084,7 @@ int Http2Session::OnFrameNotSent(nghttp2_session* handle,
10821084 if (error_code == NGHTTP2_ERR_SESSION_CLOSING ||
10831085 error_code == NGHTTP2_ERR_STREAM_CLOSED ||
10841086 error_code == NGHTTP2_ERR_STREAM_CLOSING ||
1085- session->js_fields_[kSessionFrameErrorListenerCount] == 0) {
1087+ session->js_fields_.frame_error_listener_count == 0) {
10861088 return 0;
10871089 }
10881090
@@ -1388,7 +1390,7 @@ void Http2Session::HandleHeadersFrame(const nghttp2_frame* frame) {
13881390// are considered advisory only, so this has no real effect other than to
13891391// simply let user code know that the priority has changed.
13901392void Http2Session::HandlePriorityFrame(const nghttp2_frame* frame) {
1391- if (js_fields_[kSessionPriorityListenerCount] == 0) return;
1393+ if (js_fields_.priority_listener_count == 0) return;
13921394 Isolate* isolate = env()->isolate();
13931395 HandleScope scope(isolate);
13941396 Local<Context> context = env()->context();
@@ -1458,7 +1460,7 @@ void Http2Session::HandleGoawayFrame(const nghttp2_frame* frame) {
14581460
14591461// Called by OnFrameReceived when a complete ALTSVC frame has been received.
14601462void Http2Session::HandleAltSvcFrame(const nghttp2_frame* frame) {
1461- if (!(js_fields_[kBitfield] & (1 << kSessionHasAltsvcListeners))) return;
1463+ if (!(js_fields_.bitfield & (1 << kSessionHasAltsvcListeners))) return;
14621464 Isolate* isolate = env()->isolate();
14631465 HandleScope scope(isolate);
14641466 Local<Context> context = env()->context();
@@ -1537,7 +1539,7 @@ void Http2Session::HandlePingFrame(const nghttp2_frame* frame) {
15371539 return;
15381540 }
15391541
1540- if (!(js_fields_[kBitfield] & (1 << kSessionHasPingListeners))) return;
1542+ if (!(js_fields_.bitfield & (1 << kSessionHasPingListeners))) return;
15411543 // Notify the session that a ping occurred
15421544 arg = Buffer::Copy(env(),
15431545 reinterpret_cast<const char*>(frame->ping.opaque_data),
@@ -1549,8 +1551,8 @@ void Http2Session::HandlePingFrame(const nghttp2_frame* frame) {
15491551void Http2Session::HandleSettingsFrame(const nghttp2_frame* frame) {
15501552 bool ack = frame->hd.flags & NGHTTP2_FLAG_ACK;
15511553 if (!ack) {
1552- js_fields_[kBitfield] &= ~(1 << kSessionRemoteSettingsIsUpToDate);
1553- if (!(js_fields_[kBitfield] & (1 << kSessionHasRemoteSettingsListeners)))
1554+ js_fields_.bitfield &= ~(1 << kSessionRemoteSettingsIsUpToDate);
1555+ if (!(js_fields_.bitfield & (1 << kSessionHasRemoteSettingsListeners)))
15541556 return;
15551557 // This is not a SETTINGS acknowledgement, notify and return
15561558 MakeCallback(env()->http2session_on_settings_function(), 0, nullptr);
0 commit comments