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: 4 4 100.0 %
Date: 2019-02-23 22:23:05 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
namespace node {
9
namespace http2 {
10
11
  enum Http2SettingsIndex {
12
    IDX_SETTINGS_HEADER_TABLE_SIZE,
13
    IDX_SETTINGS_ENABLE_PUSH,
14
    IDX_SETTINGS_INITIAL_WINDOW_SIZE,
15
    IDX_SETTINGS_MAX_FRAME_SIZE,
16
    IDX_SETTINGS_MAX_CONCURRENT_STREAMS,
17
    IDX_SETTINGS_MAX_HEADER_LIST_SIZE,
18
    IDX_SETTINGS_ENABLE_CONNECT_PROTOCOL,
19
    IDX_SETTINGS_COUNT
20
  };
21
22
  enum Http2SessionStateIndex {
23
    IDX_SESSION_STATE_EFFECTIVE_LOCAL_WINDOW_SIZE,
24
    IDX_SESSION_STATE_EFFECTIVE_RECV_DATA_LENGTH,
25
    IDX_SESSION_STATE_NEXT_STREAM_ID,
26
    IDX_SESSION_STATE_LOCAL_WINDOW_SIZE,
27
    IDX_SESSION_STATE_LAST_PROC_STREAM_ID,
28
    IDX_SESSION_STATE_REMOTE_WINDOW_SIZE,
29
    IDX_SESSION_STATE_OUTBOUND_QUEUE_SIZE,
30
    IDX_SESSION_STATE_HD_DEFLATE_DYNAMIC_TABLE_SIZE,
31
    IDX_SESSION_STATE_HD_INFLATE_DYNAMIC_TABLE_SIZE,
32
    IDX_SESSION_STATE_COUNT
33
  };
34
35
  enum Http2StreamStateIndex {
36
    IDX_STREAM_STATE,
37
    IDX_STREAM_STATE_WEIGHT,
38
    IDX_STREAM_STATE_SUM_DEPENDENCY_WEIGHT,
39
    IDX_STREAM_STATE_LOCAL_CLOSE,
40
    IDX_STREAM_STATE_REMOTE_CLOSE,
41
    IDX_STREAM_STATE_LOCAL_WINDOW_SIZE,
42
    IDX_STREAM_STATE_COUNT
43
  };
44
45
  enum Http2OptionsIndex {
46
    IDX_OPTIONS_MAX_DEFLATE_DYNAMIC_TABLE_SIZE,
47
    IDX_OPTIONS_MAX_RESERVED_REMOTE_STREAMS,
48
    IDX_OPTIONS_MAX_SEND_HEADER_BLOCK_LENGTH,
49
    IDX_OPTIONS_PEER_MAX_CONCURRENT_STREAMS,
50
    IDX_OPTIONS_PADDING_STRATEGY,
51
    IDX_OPTIONS_MAX_HEADER_LIST_PAIRS,
52
    IDX_OPTIONS_MAX_OUTSTANDING_PINGS,
53
    IDX_OPTIONS_MAX_OUTSTANDING_SETTINGS,
54
    IDX_OPTIONS_MAX_SESSION_MEMORY,
55
    IDX_OPTIONS_FLAGS
56
  };
57
58
  enum Http2PaddingBufferFields {
59
    PADDING_BUF_FRAME_LENGTH,
60
    PADDING_BUF_MAX_PAYLOAD_LENGTH,
61
    PADDING_BUF_RETURN_VALUE,
62
    PADDING_BUF_FIELD_COUNT
63
  };
64
65
  enum Http2StreamStatisticsIndex {
66
    IDX_STREAM_STATS_ID,
67
    IDX_STREAM_STATS_TIMETOFIRSTBYTE,
68
    IDX_STREAM_STATS_TIMETOFIRSTHEADER,
69
    IDX_STREAM_STATS_TIMETOFIRSTBYTESENT,
70
    IDX_STREAM_STATS_SENTBYTES,
71
    IDX_STREAM_STATS_RECEIVEDBYTES,
72
    IDX_STREAM_STATS_COUNT
73
  };
74
75
  enum Http2SessionStatisticsIndex {
76
    IDX_SESSION_STATS_TYPE,
77
    IDX_SESSION_STATS_PINGRTT,
78
    IDX_SESSION_STATS_FRAMESRECEIVED,
79
    IDX_SESSION_STATS_FRAMESSENT,
80
    IDX_SESSION_STATS_STREAMCOUNT,
81
    IDX_SESSION_STATS_STREAMAVERAGEDURATION,
82
    IDX_SESSION_STATS_DATA_SENT,
83
    IDX_SESSION_STATS_DATA_RECEIVED,
84
    IDX_SESSION_STATS_MAX_CONCURRENT_STREAMS,
85
    IDX_SESSION_STATS_COUNT
86
  };
87
88
219
class Http2State {
89
 public:
90
220
  explicit Http2State(v8::Isolate* isolate) :
91
    root_buffer(
92
      isolate,
93
      sizeof(http2_state_internal)),
94
    session_state_buffer(
95
      isolate,
96
      offsetof(http2_state_internal, session_state_buffer),
97
      IDX_SESSION_STATE_COUNT,
98
      root_buffer),
99
    stream_state_buffer(
100
      isolate,
101
      offsetof(http2_state_internal, stream_state_buffer),
102
      IDX_STREAM_STATE_COUNT,
103
      root_buffer),
104
    stream_stats_buffer(
105
      isolate,
106
      offsetof(http2_state_internal, stream_stats_buffer),
107
      IDX_STREAM_STATS_COUNT,
108
      root_buffer),
109
    session_stats_buffer(
110
      isolate,
111
      offsetof(http2_state_internal, session_stats_buffer),
112
      IDX_SESSION_STATS_COUNT,
113
      root_buffer),
114
    padding_buffer(
115
      isolate,
116
      offsetof(http2_state_internal, padding_buffer),
117
      PADDING_BUF_FIELD_COUNT,
118
      root_buffer),
119
    options_buffer(
120
      isolate,
121
      offsetof(http2_state_internal, options_buffer),
122
      IDX_OPTIONS_FLAGS + 1,
123
      root_buffer),
124
    settings_buffer(
125
      isolate,
126
      offsetof(http2_state_internal, settings_buffer),
127
      IDX_SETTINGS_COUNT + 1,
128
220
      root_buffer) {
129
220
  }
130
131
  AliasedBuffer<uint8_t, v8::Uint8Array> root_buffer;
132
  AliasedBuffer<double, v8::Float64Array> session_state_buffer;
133
  AliasedBuffer<double, v8::Float64Array> stream_state_buffer;
134
  AliasedBuffer<double, v8::Float64Array> stream_stats_buffer;
135
  AliasedBuffer<double, v8::Float64Array> session_stats_buffer;
136
  AliasedBuffer<uint32_t, v8::Uint32Array> padding_buffer;
137
  AliasedBuffer<uint32_t, v8::Uint32Array> options_buffer;
138
  AliasedBuffer<uint32_t, v8::Uint32Array> settings_buffer;
139
140
 private:
141
  struct http2_state_internal {
142
    // doubles first so that they are always sizeof(double)-aligned
143
    double session_state_buffer[IDX_SESSION_STATE_COUNT];
144
    double stream_state_buffer[IDX_STREAM_STATE_COUNT];
145
    double stream_stats_buffer[IDX_STREAM_STATS_COUNT];
146
    double session_stats_buffer[IDX_SESSION_STATS_COUNT];
147
    uint32_t padding_buffer[PADDING_BUF_FIELD_COUNT];
148
    uint32_t options_buffer[IDX_OPTIONS_FLAGS + 1];
149
    uint32_t settings_buffer[IDX_SETTINGS_COUNT + 1];
150
  };
151
};
152
153
}  // namespace http2
154
}  // namespace node
155
156
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
157
158
#endif  // SRC_NODE_HTTP2_STATE_H_