GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage/nodes/benchmark/out/../src/node_http2_state.h Lines: 4 4 100.0 %
Date: 2017-11-19 Branches: 0 0 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_COUNT
19
  };
20
21
  enum Http2SessionStateIndex {
22
    IDX_SESSION_STATE_EFFECTIVE_LOCAL_WINDOW_SIZE,
23
    IDX_SESSION_STATE_EFFECTIVE_RECV_DATA_LENGTH,
24
    IDX_SESSION_STATE_NEXT_STREAM_ID,
25
    IDX_SESSION_STATE_LOCAL_WINDOW_SIZE,
26
    IDX_SESSION_STATE_LAST_PROC_STREAM_ID,
27
    IDX_SESSION_STATE_REMOTE_WINDOW_SIZE,
28
    IDX_SESSION_STATE_OUTBOUND_QUEUE_SIZE,
29
    IDX_SESSION_STATE_HD_DEFLATE_DYNAMIC_TABLE_SIZE,
30
    IDX_SESSION_STATE_HD_INFLATE_DYNAMIC_TABLE_SIZE,
31
    IDX_SESSION_STATE_COUNT
32
  };
33
34
  enum Http2StreamStateIndex {
35
    IDX_STREAM_STATE,
36
    IDX_STREAM_STATE_WEIGHT,
37
    IDX_STREAM_STATE_SUM_DEPENDENCY_WEIGHT,
38
    IDX_STREAM_STATE_LOCAL_CLOSE,
39
    IDX_STREAM_STATE_REMOTE_CLOSE,
40
    IDX_STREAM_STATE_LOCAL_WINDOW_SIZE,
41
    IDX_STREAM_STATE_COUNT
42
  };
43
44
  enum Http2OptionsIndex {
45
    IDX_OPTIONS_MAX_DEFLATE_DYNAMIC_TABLE_SIZE,
46
    IDX_OPTIONS_MAX_RESERVED_REMOTE_STREAMS,
47
    IDX_OPTIONS_MAX_SEND_HEADER_BLOCK_LENGTH,
48
    IDX_OPTIONS_PEER_MAX_CONCURRENT_STREAMS,
49
    IDX_OPTIONS_PADDING_STRATEGY,
50
    IDX_OPTIONS_MAX_HEADER_LIST_PAIRS,
51
    IDX_OPTIONS_FLAGS
52
  };
53
54
  enum Http2PaddingBufferFields {
55
    PADDING_BUF_FRAME_LENGTH,
56
    PADDING_BUF_MAX_PAYLOAD_LENGTH,
57
    PADDING_BUF_RETURN_VALUE,
58
    PADDING_BUF_FIELD_COUNT
59
  };
60
61
150
class http2_state {
62
 public:
63
150
  explicit http2_state(v8::Isolate* isolate) :
64
    root_buffer(
65
      isolate,
66
      sizeof(http2_state_internal)),
67
    session_state_buffer(
68
      isolate,
69
      offsetof(http2_state_internal, session_state_buffer),
70
      IDX_SESSION_STATE_COUNT,
71
      root_buffer),
72
    stream_state_buffer(
73
      isolate,
74
      offsetof(http2_state_internal, stream_state_buffer),
75
      IDX_STREAM_STATE_COUNT,
76
      root_buffer),
77
    padding_buffer(
78
      isolate,
79
      offsetof(http2_state_internal, padding_buffer),
80
      PADDING_BUF_FIELD_COUNT,
81
      root_buffer),
82
    options_buffer(
83
      isolate,
84
      offsetof(http2_state_internal, options_buffer),
85
      IDX_OPTIONS_FLAGS + 1,
86
      root_buffer),
87
    settings_buffer(
88
      isolate,
89
      offsetof(http2_state_internal, settings_buffer),
90
      IDX_SETTINGS_COUNT + 1,
91
150
      root_buffer) {
92
150
  }
93
94
  AliasedBuffer<uint8_t, v8::Uint8Array> root_buffer;
95
  AliasedBuffer<double, v8::Float64Array> session_state_buffer;
96
  AliasedBuffer<double, v8::Float64Array> stream_state_buffer;
97
  AliasedBuffer<uint32_t, v8::Uint32Array> padding_buffer;
98
  AliasedBuffer<uint32_t, v8::Uint32Array> options_buffer;
99
  AliasedBuffer<uint32_t, v8::Uint32Array> settings_buffer;
100
101
 private:
102
  struct http2_state_internal {
103
    // doubles first so that they are always sizeof(double)-aligned
104
    double session_state_buffer[IDX_SESSION_STATE_COUNT];
105
    double stream_state_buffer[IDX_STREAM_STATE_COUNT];
106
    uint32_t padding_buffer[PADDING_BUF_FIELD_COUNT];
107
    uint32_t options_buffer[IDX_OPTIONS_FLAGS + 1];
108
    uint32_t settings_buffer[IDX_SETTINGS_COUNT + 1];
109
  };
110
};
111
112
}  // namespace http2
113
}  // namespace node
114
115
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
116
117
#endif  // SRC_NODE_HTTP2_STATE_H_