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 26 38.5 %
Date: 2019-02-26 22:23:30 Branches: 2 6 33.3 %

Line Branch Exec Source
1
// This file is generated
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 serialize() override { return toValue()->serialize(); }
48
    std::unique_ptr<TraceConfig> clone() const;
49
50
    template<int STATE>
51
    class TraceConfigBuilder {
52
    public:
53
        enum {
54
            NoFieldsSet = 0,
55
            IncludedCategoriesSet = 1 << 1,
56
            AllFieldsSet = (IncludedCategoriesSet | 0)};
57
58
59
        TraceConfigBuilder<STATE>& setRecordMode(const String& value)
60
        {
61
            m_result->setRecordMode(value);
62
            return *this;
63
        }
64
65
        TraceConfigBuilder<STATE | IncludedCategoriesSet>& setIncludedCategories(std::unique_ptr<protocol::Array<String>> value)
66
        {
67
            static_assert(!(STATE & IncludedCategoriesSet), "property includedCategories should not be set yet");
68
            m_result->setIncludedCategories(std::move(value));
69
            return castState<IncludedCategoriesSet>();
70
        }
71
72
        std::unique_ptr<TraceConfig> build()
73
        {
74
            static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
75
            return std::move(m_result);
76
        }
77
78
    private:
79
        friend class TraceConfig;
80
        TraceConfigBuilder() : m_result(new TraceConfig()) { }
81
82
        template<int STEP> TraceConfigBuilder<STATE | STEP>& castState()
83
        {
84
            return *reinterpret_cast<TraceConfigBuilder<STATE | STEP>*>(this);
85
        }
86
87
        std::unique_ptr<protocol::NodeTracing::TraceConfig> m_result;
88
    };
89
90
    static TraceConfigBuilder<0> create()
91
    {
92
        return TraceConfigBuilder<0>();
93
    }
94
95
private:
96
3
    TraceConfig()
97
3
    {
98
3
    }
99
100
    Maybe<String> m_recordMode;
101
    std::unique_ptr<protocol::Array<String>> m_includedCategories;
102
};
103
104
105
class  DataCollectedNotification : public Serializable{
106
    PROTOCOL_DISALLOW_COPY(DataCollectedNotification);
107
public:
108
    static std::unique_ptr<DataCollectedNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
109
110
    ~DataCollectedNotification() override { }
111
112
    protocol::Array<protocol::DictionaryValue>* getValue() { return m_value.get(); }
113
    void setValue(std::unique_ptr<protocol::Array<protocol::DictionaryValue>> value) { m_value = std::move(value); }
114
115
    std::unique_ptr<protocol::DictionaryValue> toValue() const;
116
    String serialize() override { return toValue()->serialize(); }
117
    std::unique_ptr<DataCollectedNotification> clone() const;
118
119
    template<int STATE>
120
    class DataCollectedNotificationBuilder {
121
    public:
122
        enum {
123
            NoFieldsSet = 0,
124
            ValueSet = 1 << 1,
125
            AllFieldsSet = (ValueSet | 0)};
126
127
128
        DataCollectedNotificationBuilder<STATE | ValueSet>& setValue(std::unique_ptr<protocol::Array<protocol::DictionaryValue>> value)
129
        {
130
            static_assert(!(STATE & ValueSet), "property value should not be set yet");
131
            m_result->setValue(std::move(value));
132
            return castState<ValueSet>();
133
        }
134
135
        std::unique_ptr<DataCollectedNotification> build()
136
        {
137
            static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
138
            return std::move(m_result);
139
        }
140
141
    private:
142
        friend class DataCollectedNotification;
143
        DataCollectedNotificationBuilder() : m_result(new DataCollectedNotification()) { }
144
145
        template<int STEP> DataCollectedNotificationBuilder<STATE | STEP>& castState()
146
        {
147
            return *reinterpret_cast<DataCollectedNotificationBuilder<STATE | STEP>*>(this);
148
        }
149
150
        std::unique_ptr<protocol::NodeTracing::DataCollectedNotification> m_result;
151
    };
152
153
    static DataCollectedNotificationBuilder<0> create()
154
    {
155
        return DataCollectedNotificationBuilder<0>();
156
    }
157
158
private:
159
    DataCollectedNotification()
160
    {
161
    }
162
163
    std::unique_ptr<protocol::Array<protocol::DictionaryValue>> m_value;
164
};
165
166
167
// ------------- Backend interface.
168
169
4605
class  Backend {
170
public:
171
4237
    virtual ~Backend() { }
172
173
    virtual DispatchResponse getCategories(std::unique_ptr<protocol::Array<String>>* out_categories) = 0;
174
    virtual DispatchResponse start(std::unique_ptr<protocol::NodeTracing::TraceConfig> in_traceConfig) = 0;
175
    virtual DispatchResponse stop() = 0;
176
177
4237
    virtual DispatchResponse disable()
178
    {
179
4237
        return DispatchResponse::OK();
180
    }
181
};
182
183
// ------------- Frontend interface.
184
185
class  Frontend {
186
public:
187
4605
    explicit Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { }
188
    void dataCollected(std::unique_ptr<protocol::Array<protocol::DictionaryValue>> value);
189
    void tracingComplete();
190
191
    void flush();
192
    void sendRawNotification(const String&);
193
private:
194
    FrontendChannel* m_frontendChannel;
195
};
196
197
// ------------- Dispatcher.
198
199
class  Dispatcher {
200
public:
201
    static void wire(UberDispatcher*, Backend*);
202
203
private:
204
    Dispatcher() { }
205
};
206
207
// ------------- Metainfo.
208
209
class  Metainfo {
210
public:
211
    using BackendClass = Backend;
212
    using FrontendClass = Frontend;
213
    using DispatcherClass = Dispatcher;
214
    static const char domainName[];
215
    static const char commandPrefix[];
216
    static const char version[];
217
};
218
219
} // namespace NodeTracing
220
} // namespace node
221
} // namespace inspector
222
} // namespace protocol
223
224
#endif // !defined(node_inspector_protocol_NodeTracing_h)