GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage-daily/nodes/benchmark/out/Release/obj/gen/src/node/inspector/protocol/NodeTracing.h Lines: 10 28 35.7 %
Date: 2019-08-17 22:35:23 Branches: 2 6 33.3 %

Line Branch Exec Source
1
// This file is generated by TypeBuilder_h.template.
2
3
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
4
// Use of this source code is governed by a BSD-style license that can be
5
// found in the LICENSE file.
6
7
#ifndef node_inspector_protocol_NodeTracing_h
8
#define node_inspector_protocol_NodeTracing_h
9
10
#include "src/node/inspector/protocol/Protocol.h"
11
// For each imported domain we generate a ValueConversions struct instead of a full domain definition
12
// and include Domain::API version from there.
13
14
namespace node {
15
namespace inspector {
16
namespace protocol {
17
namespace NodeTracing {
18
19
// ------------- Forward and enum declarations.
20
class TraceConfig;
21
class DataCollectedNotification;
22
using TracingCompleteNotification = Object;
23
24
// ------------- Type and builder declarations.
25
26
class  TraceConfig : public Serializable{
27
    PROTOCOL_DISALLOW_COPY(TraceConfig);
28
public:
29
    static std::unique_ptr<TraceConfig> fromValue(protocol::Value* value, ErrorSupport* errors);
30
31
6
    ~TraceConfig() override { }
32
33
    struct  RecordModeEnum {
34
        static const char* RecordUntilFull;
35
        static const char* RecordContinuously;
36
        static const char* RecordAsMuchAsPossible;
37
    }; // RecordModeEnum
38
39
    bool hasRecordMode() { return m_recordMode.isJust(); }
40
    String getRecordMode(const String& defaultValue) { return m_recordMode.isJust() ? m_recordMode.fromJust() : defaultValue; }
41
    void setRecordMode(const String& value) { m_recordMode = value; }
42
43
2
    protocol::Array<String>* getIncludedCategories() { return m_includedCategories.get(); }
44
    void setIncludedCategories(std::unique_ptr<protocol::Array<String>> value) { m_includedCategories = std::move(value); }
45
46
    std::unique_ptr<protocol::DictionaryValue> toValue() const;
47
    String serializeToJSON() override { return toValue()->serializeToJSON(); }
48
    std::vector<uint8_t> serializeToBinary() override { return toValue()->serializeToBinary(); }
49
    String toJSON() const { return toValue()->toJSONString(); }
50
    std::unique_ptr<TraceConfig> clone() const;
51
52
    template<int STATE>
53
    class TraceConfigBuilder {
54
    public:
55
        enum {
56
            NoFieldsSet = 0,
57
            IncludedCategoriesSet = 1 << 1,
58
            AllFieldsSet = (IncludedCategoriesSet | 0)};
59
60
61
        TraceConfigBuilder<STATE>& setRecordMode(const String& value)
62
        {
63
            m_result->setRecordMode(value);
64
            return *this;
65
        }
66
67
        TraceConfigBuilder<STATE | IncludedCategoriesSet>& setIncludedCategories(std::unique_ptr<protocol::Array<String>> value)
68
        {
69
            static_assert(!(STATE & IncludedCategoriesSet), "property includedCategories should not be set yet");
70
            m_result->setIncludedCategories(std::move(value));
71
            return castState<IncludedCategoriesSet>();
72
        }
73
74
        std::unique_ptr<TraceConfig> build()
75
        {
76
            static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
77
            return std::move(m_result);
78
        }
79
80
    private:
81
        friend class TraceConfig;
82
        TraceConfigBuilder() : m_result(new TraceConfig()) { }
83
84
        template<int STEP> TraceConfigBuilder<STATE | STEP>& castState()
85
        {
86
            return *reinterpret_cast<TraceConfigBuilder<STATE | STEP>*>(this);
87
        }
88
89
        std::unique_ptr<protocol::NodeTracing::TraceConfig> m_result;
90
    };
91
92
    static TraceConfigBuilder<0> create()
93
    {
94
        return TraceConfigBuilder<0>();
95
    }
96
97
private:
98
3
    TraceConfig()
99
3
    {
100
3
    }
101
102
    Maybe<String> m_recordMode;
103
    std::unique_ptr<protocol::Array<String>> m_includedCategories;
104
};
105
106
107
class  DataCollectedNotification : public Serializable{
108
    PROTOCOL_DISALLOW_COPY(DataCollectedNotification);
109
public:
110
    static std::unique_ptr<DataCollectedNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
111
112
    ~DataCollectedNotification() override { }
113
114
    protocol::Array<protocol::DictionaryValue>* getValue() { return m_value.get(); }
115
    void setValue(std::unique_ptr<protocol::Array<protocol::DictionaryValue>> value) { m_value = std::move(value); }
116
117
    std::unique_ptr<protocol::DictionaryValue> toValue() const;
118
    String serializeToJSON() override { return toValue()->serializeToJSON(); }
119
    std::vector<uint8_t> serializeToBinary() override { return toValue()->serializeToBinary(); }
120
    String toJSON() const { return toValue()->toJSONString(); }
121
    std::unique_ptr<DataCollectedNotification> clone() const;
122
123
    template<int STATE>
124
    class DataCollectedNotificationBuilder {
125
    public:
126
        enum {
127
            NoFieldsSet = 0,
128
            ValueSet = 1 << 1,
129
            AllFieldsSet = (ValueSet | 0)};
130
131
132
        DataCollectedNotificationBuilder<STATE | ValueSet>& setValue(std::unique_ptr<protocol::Array<protocol::DictionaryValue>> value)
133
        {
134
            static_assert(!(STATE & ValueSet), "property value should not be set yet");
135
            m_result->setValue(std::move(value));
136
            return castState<ValueSet>();
137
        }
138
139
        std::unique_ptr<DataCollectedNotification> build()
140
        {
141
            static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
142
            return std::move(m_result);
143
        }
144
145
    private:
146
        friend class DataCollectedNotification;
147
        DataCollectedNotificationBuilder() : m_result(new DataCollectedNotification()) { }
148
149
        template<int STEP> DataCollectedNotificationBuilder<STATE | STEP>& castState()
150
        {
151
            return *reinterpret_cast<DataCollectedNotificationBuilder<STATE | STEP>*>(this);
152
        }
153
154
        std::unique_ptr<protocol::NodeTracing::DataCollectedNotification> m_result;
155
    };
156
157
    static DataCollectedNotificationBuilder<0> create()
158
    {
159
        return DataCollectedNotificationBuilder<0>();
160
    }
161
162
private:
163
    DataCollectedNotification()
164
    {
165
    }
166
167
    std::unique_ptr<protocol::Array<protocol::DictionaryValue>> m_value;
168
};
169
170
171
// ------------- Backend interface.
172
173
5404
class  Backend {
174
public:
175
5000
    virtual ~Backend() { }
176
177
    virtual DispatchResponse getCategories(std::unique_ptr<protocol::Array<String>>* out_categories) = 0;
178
    virtual DispatchResponse start(std::unique_ptr<protocol::NodeTracing::TraceConfig> in_traceConfig) = 0;
179
    virtual DispatchResponse stop() = 0;
180
181
5000
    virtual DispatchResponse disable()
182
    {
183
5000
        return DispatchResponse::OK();
184
    }
185
};
186
187
// ------------- Frontend interface.
188
189
class  Frontend {
190
public:
191
5404
    explicit Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { }
192
    void dataCollected(std::unique_ptr<protocol::Array<protocol::DictionaryValue>> value);
193
    void tracingComplete();
194
195
    void flush();
196
    void sendRawJSONNotification(String);
197
    void sendRawCBORNotification(std::vector<uint8_t>);
198
private:
199
    FrontendChannel* m_frontendChannel;
200
};
201
202
// ------------- Dispatcher.
203
204
class  Dispatcher {
205
public:
206
    static void wire(UberDispatcher*, Backend*);
207
208
private:
209
    Dispatcher() { }
210
};
211
212
// ------------- Metainfo.
213
214
class  Metainfo {
215
public:
216
    using BackendClass = Backend;
217
    using FrontendClass = Frontend;
218
    using DispatcherClass = Dispatcher;
219
    static const char domainName[];
220
    static const char commandPrefix[];
221
    static const char version[];
222
};
223
224
} // namespace NodeTracing
225
} // namespace node
226
} // namespace inspector
227
} // namespace protocol
228
229
#endif // !defined(node_inspector_protocol_NodeTracing_h)