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-09-12 22:30:12 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 Http2StreamStatisticsIndex {
59
    IDX_STREAM_STATS_ID,
60
    IDX_STREAM_STATS_TIMETOFIRSTBYTE,
61
    IDX_STREAM_STATS_TIMETOFIRSTHEADER,
62
    IDX_STREAM_STATS_TIMETOFIRSTBYTESENT,
63
    IDX_STREAM_STATS_SENTBYTES,
64
    IDX_STREAM_STATS_RECEIVEDBYTES,
65
    IDX_STREAM_STATS_COUNT
66
  };
67
68
  enum Http2SessionStatisticsIndex {
69
    IDX_SESSION_STATS_TYPE,
70
    IDX_SESSION_STATS_PINGRTT,
71
    IDX_SESSION_STATS_FRAMESRECEIVED,
72
    IDX_SESSION_STATS_FRAMESSENT,
73
    IDX_SESSION_STATS_STREAMCOUNT,
74
    IDX_SESSION_STATS_STREAMAVERAGEDURATION,
75
    IDX_SESSION_STATS_DATA_SENT,
76
    IDX_SESSION_STATS_DATA_RECEIVED,
77
    IDX_SESSION_STATS_MAX_CONCURRENT_STREAMS,
78
    IDX_SESSION_STATS_COUNT
79
  };
80
81
231
class Http2State {
82
 public:
83
232
  explicit Http2State(v8::Isolate* isolate) :
84
    root_buffer(
85
      isolate,
86
      sizeof(http2_state_internal)),
87
    session_state_buffer(
88
      isolate,
89
      offsetof(http2_state_internal, session_state_buffer),
90
      IDX_SESSION_STATE_COUNT,
91
      root_buffer),
92
    stream_state_buffer(
93
      isolate,
94
      offsetof(http2_state_internal, stream_state_buffer),
95
      IDX_STREAM_STATE_COUNT,
96
      root_buffer),
97
    stream_stats_buffer(
98
      isolate,
99
      offsetof(http2_state_internal, stream_stats_buffer),
100
      IDX_STREAM_STATS_COUNT,
101
      root_buffer),
102
    session_stats_buffer(
103
      isolate,
104
      offsetof(http2_state_internal, session_stats_buffer),
105
      IDX_SESSION_STATS_COUNT,
106
      root_buffer),
107
    options_buffer(
108
      isolate,
109
      offsetof(http2_state_internal, options_buffer),
110
      IDX_OPTIONS_FLAGS + 1,
111
      root_buffer),
112
    settings_buffer(
113
      isolate,
114
      offsetof(http2_state_internal, settings_buffer),
115
      IDX_SETTINGS_COUNT + 1,
116
232
      root_buffer) {
117
232
  }
118
119
  AliasedUint8Array root_buffer;
120
  AliasedFloat64Array session_state_buffer;
121
  AliasedFloat64Array stream_state_buffer;
122
  AliasedFloat64Array stream_stats_buffer;
123
  AliasedFloat64Array session_stats_buffer;
124
  AliasedUint32Array options_buffer;
125
  AliasedUint32Array settings_buffer;
126
127
 private:
128
  struct http2_state_internal {
129
    // doubles first so that they are always sizeof(double)-aligned
130
    double session_state_buffer[IDX_SESSION_STATE_COUNT];
131
    double stream_state_buffer[IDX_STREAM_STATE_COUNT];
132
    double stream_stats_buffer[IDX_STREAM_STATS_COUNT];
133
    double session_stats_buffer[IDX_SESSION_STATS_COUNT];
134
    uint32_t options_buffer[IDX_OPTIONS_FLAGS + 1];
135
    uint32_t settings_buffer[IDX_SETTINGS_COUNT + 1];
136
  };
137
};
138
139
}  // namespace http2
140
}  // namespace node
141
142
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
143
144
#endif  // SRC_NODE_HTTP2_STATE_H_