GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage-daily/nodes/benchmark/out/../src/node_http2_state.h Lines: 6 6 100.0 %
Date: 2020-05-27 22:15:15 Branches: 0 0 - %

Line Branch Exec Source
1
#ifndef SRC_NODE_HTTP2_STATE_H_
2
#define SRC_NODE_HTTP2_STATE_H_
3
4
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
6
#include "aliased_buffer.h"
7
8
struct nghttp2_rcbuf;
9
10
namespace node {
11
namespace http2 {
12
13
  enum Http2SettingsIndex {
14
    IDX_SETTINGS_HEADER_TABLE_SIZE,
15
    IDX_SETTINGS_ENABLE_PUSH,
16
    IDX_SETTINGS_INITIAL_WINDOW_SIZE,
17
    IDX_SETTINGS_MAX_FRAME_SIZE,
18
    IDX_SETTINGS_MAX_CONCURRENT_STREAMS,
19
    IDX_SETTINGS_MAX_HEADER_LIST_SIZE,
20
    IDX_SETTINGS_ENABLE_CONNECT_PROTOCOL,
21
    IDX_SETTINGS_COUNT
22
  };
23
24
  enum Http2SessionStateIndex {
25
    IDX_SESSION_STATE_EFFECTIVE_LOCAL_WINDOW_SIZE,
26
    IDX_SESSION_STATE_EFFECTIVE_RECV_DATA_LENGTH,
27
    IDX_SESSION_STATE_NEXT_STREAM_ID,
28
    IDX_SESSION_STATE_LOCAL_WINDOW_SIZE,
29
    IDX_SESSION_STATE_LAST_PROC_STREAM_ID,
30
    IDX_SESSION_STATE_REMOTE_WINDOW_SIZE,
31
    IDX_SESSION_STATE_OUTBOUND_QUEUE_SIZE,
32
    IDX_SESSION_STATE_HD_DEFLATE_DYNAMIC_TABLE_SIZE,
33
    IDX_SESSION_STATE_HD_INFLATE_DYNAMIC_TABLE_SIZE,
34
    IDX_SESSION_STATE_COUNT
35
  };
36
37
  enum Http2StreamStateIndex {
38
    IDX_STREAM_STATE,
39
    IDX_STREAM_STATE_WEIGHT,
40
    IDX_STREAM_STATE_SUM_DEPENDENCY_WEIGHT,
41
    IDX_STREAM_STATE_LOCAL_CLOSE,
42
    IDX_STREAM_STATE_REMOTE_CLOSE,
43
    IDX_STREAM_STATE_LOCAL_WINDOW_SIZE,
44
    IDX_STREAM_STATE_COUNT
45
  };
46
47
  enum Http2OptionsIndex {
48
    IDX_OPTIONS_MAX_DEFLATE_DYNAMIC_TABLE_SIZE,
49
    IDX_OPTIONS_MAX_RESERVED_REMOTE_STREAMS,
50
    IDX_OPTIONS_MAX_SEND_HEADER_BLOCK_LENGTH,
51
    IDX_OPTIONS_PEER_MAX_CONCURRENT_STREAMS,
52
    IDX_OPTIONS_PADDING_STRATEGY,
53
    IDX_OPTIONS_MAX_HEADER_LIST_PAIRS,
54
    IDX_OPTIONS_MAX_OUTSTANDING_PINGS,
55
    IDX_OPTIONS_MAX_OUTSTANDING_SETTINGS,
56
    IDX_OPTIONS_MAX_SESSION_MEMORY,
57
    IDX_OPTIONS_FLAGS
58
  };
59
60
  enum Http2StreamStatisticsIndex {
61
    IDX_STREAM_STATS_ID,
62
    IDX_STREAM_STATS_TIMETOFIRSTBYTE,
63
    IDX_STREAM_STATS_TIMETOFIRSTHEADER,
64
    IDX_STREAM_STATS_TIMETOFIRSTBYTESENT,
65
    IDX_STREAM_STATS_SENTBYTES,
66
    IDX_STREAM_STATS_RECEIVEDBYTES,
67
    IDX_STREAM_STATS_COUNT
68
  };
69
70
  enum Http2SessionStatisticsIndex {
71
    IDX_SESSION_STATS_TYPE,
72
    IDX_SESSION_STATS_PINGRTT,
73
    IDX_SESSION_STATS_FRAMESRECEIVED,
74
    IDX_SESSION_STATS_FRAMESSENT,
75
    IDX_SESSION_STATS_STREAMCOUNT,
76
    IDX_SESSION_STATS_STREAMAVERAGEDURATION,
77
    IDX_SESSION_STATS_DATA_SENT,
78
    IDX_SESSION_STATS_DATA_RECEIVED,
79
    IDX_SESSION_STATS_MAX_CONCURRENT_STREAMS,
80
    IDX_SESSION_STATS_COUNT
81
  };
82
83
458
class Http2State : public BaseObject {
84
 public:
85
230
  Http2State(Environment* env, v8::Local<v8::Object> obj)
86
230
      : BaseObject(env, obj),
87
        root_buffer(env->isolate(), sizeof(http2_state_internal)),
88
        session_state_buffer(
89
            env->isolate(),
90
            offsetof(http2_state_internal, session_state_buffer),
91
            IDX_SESSION_STATE_COUNT,
92
            root_buffer),
93
        stream_state_buffer(
94
            env->isolate(),
95
            offsetof(http2_state_internal, stream_state_buffer),
96
            IDX_STREAM_STATE_COUNT,
97
            root_buffer),
98
        stream_stats_buffer(
99
            env->isolate(),
100
            offsetof(http2_state_internal, stream_stats_buffer),
101
            IDX_STREAM_STATS_COUNT,
102
            root_buffer),
103
        session_stats_buffer(
104
            env->isolate(),
105
            offsetof(http2_state_internal, session_stats_buffer),
106
            IDX_SESSION_STATS_COUNT,
107
            root_buffer),
108
        options_buffer(env->isolate(),
109
                        offsetof(http2_state_internal, options_buffer),
110
                        IDX_OPTIONS_FLAGS + 1,
111
                        root_buffer),
112
        settings_buffer(env->isolate(),
113
                        offsetof(http2_state_internal, settings_buffer),
114
                        IDX_SETTINGS_COUNT + 1,
115
230
                        root_buffer) {}
116
117
  AliasedUint8Array root_buffer;
118
  AliasedFloat64Array session_state_buffer;
119
  AliasedFloat64Array stream_state_buffer;
120
  AliasedFloat64Array stream_stats_buffer;
121
  AliasedFloat64Array session_stats_buffer;
122
  AliasedUint32Array options_buffer;
123
  AliasedUint32Array settings_buffer;
124
125
  void MemoryInfo(MemoryTracker* tracker) const override;
126
2
  SET_SELF_SIZE(Http2State)
127
2
  SET_MEMORY_INFO_NAME(Http2State)
128
129
  static constexpr FastStringKey binding_data_name { "http2" };
130
131
 private:
132
  struct http2_state_internal {
133
    // doubles first so that they are always sizeof(double)-aligned
134
    double session_state_buffer[IDX_SESSION_STATE_COUNT];
135
    double stream_state_buffer[IDX_STREAM_STATE_COUNT];
136
    double stream_stats_buffer[IDX_STREAM_STATS_COUNT];
137
    double session_stats_buffer[IDX_SESSION_STATS_COUNT];
138
    uint32_t options_buffer[IDX_OPTIONS_FLAGS + 1];
139
    uint32_t settings_buffer[IDX_SETTINGS_COUNT + 1];
140
  };
141
};
142
143
}  // namespace http2
144
}  // namespace node
145
146
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
147
148
#endif  // SRC_NODE_HTTP2_STATE_H_