GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage/nodes/benchmark/out/Release/obj/gen/src/node/inspector/protocol/NodeWorker.h Lines: 95 96 99.0 %
Date: 2019-01-07 12:15:22 Branches: 5 10 50.0 %

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_NodeWorker_h
8
#define node_inspector_protocol_NodeWorker_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 NodeWorker {
18
19
// ------------- Forward and enum declarations.
20
using WorkerID = String;
21
using SessionID = String;
22
class WorkerInfo;
23
class AttachedToWorkerNotification;
24
class DetachedFromWorkerNotification;
25
class ReceivedMessageFromWorkerNotification;
26
27
// ------------- Type and builder declarations.
28
29
class  WorkerInfo : public Serializable{
30
    PROTOCOL_DISALLOW_COPY(WorkerInfo);
31
public:
32
    static std::unique_ptr<WorkerInfo> fromValue(protocol::Value* value, ErrorSupport* errors);
33
34
8
    ~WorkerInfo() override { }
35
36
    String getWorkerId() { return m_workerId; }
37
4
    void setWorkerId(const String& value) { m_workerId = value; }
38
39
    String getType() { return m_type; }
40
4
    void setType(const String& value) { m_type = value; }
41
42
    String getTitle() { return m_title; }
43
4
    void setTitle(const String& value) { m_title = value; }
44
45
    String getUrl() { return m_url; }
46
4
    void setUrl(const String& value) { m_url = value; }
47
48
    std::unique_ptr<protocol::DictionaryValue> toValue() const;
49
    String serialize() override { return toValue()->serialize(); }
50
    std::unique_ptr<WorkerInfo> clone() const;
51
52
    template<int STATE>
53
4
    class WorkerInfoBuilder {
54
    public:
55
        enum {
56
            NoFieldsSet = 0,
57
            WorkerIdSet = 1 << 1,
58
            TypeSet = 1 << 2,
59
            TitleSet = 1 << 3,
60
            UrlSet = 1 << 4,
61
            AllFieldsSet = (WorkerIdSet | TypeSet | TitleSet | UrlSet | 0)};
62
63
64
4
        WorkerInfoBuilder<STATE | WorkerIdSet>& setWorkerId(const String& value)
65
        {
66
            static_assert(!(STATE & WorkerIdSet), "property workerId should not be set yet");
67
4
            m_result->setWorkerId(value);
68
4
            return castState<WorkerIdSet>();
69
        }
70
71
4
        WorkerInfoBuilder<STATE | TypeSet>& setType(const String& value)
72
        {
73
            static_assert(!(STATE & TypeSet), "property type should not be set yet");
74
4
            m_result->setType(value);
75
4
            return castState<TypeSet>();
76
        }
77
78
4
        WorkerInfoBuilder<STATE | TitleSet>& setTitle(const String& value)
79
        {
80
            static_assert(!(STATE & TitleSet), "property title should not be set yet");
81
4
            m_result->setTitle(value);
82
4
            return castState<TitleSet>();
83
        }
84
85
4
        WorkerInfoBuilder<STATE | UrlSet>& setUrl(const String& value)
86
        {
87
            static_assert(!(STATE & UrlSet), "property url should not be set yet");
88
4
            m_result->setUrl(value);
89
4
            return castState<UrlSet>();
90
        }
91
92
4
        std::unique_ptr<WorkerInfo> build()
93
        {
94
            static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
95
4
            return std::move(m_result);
96
        }
97
98
    private:
99
        friend class WorkerInfo;
100
4
        WorkerInfoBuilder() : m_result(new WorkerInfo()) { }
101
102
16
        template<int STEP> WorkerInfoBuilder<STATE | STEP>& castState()
103
        {
104
16
            return *reinterpret_cast<WorkerInfoBuilder<STATE | STEP>*>(this);
105
        }
106
107
        std::unique_ptr<protocol::NodeWorker::WorkerInfo> m_result;
108
    };
109
110
4
    static WorkerInfoBuilder<0> create()
111
    {
112
4
        return WorkerInfoBuilder<0>();
113
    }
114
115
private:
116
4
    WorkerInfo()
117
4
    {
118
4
    }
119
120
    String m_workerId;
121
    String m_type;
122
    String m_title;
123
    String m_url;
124
};
125
126
127
class  AttachedToWorkerNotification : public Serializable{
128
    PROTOCOL_DISALLOW_COPY(AttachedToWorkerNotification);
129
public:
130
    static std::unique_ptr<AttachedToWorkerNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
131
132
8
    ~AttachedToWorkerNotification() override { }
133
134
    String getSessionId() { return m_sessionId; }
135
4
    void setSessionId(const String& value) { m_sessionId = value; }
136
137
    protocol::NodeWorker::WorkerInfo* getWorkerInfo() { return m_workerInfo.get(); }
138
4
    void setWorkerInfo(std::unique_ptr<protocol::NodeWorker::WorkerInfo> value) { m_workerInfo = std::move(value); }
139
140
    bool getWaitingForDebugger() { return m_waitingForDebugger; }
141
4
    void setWaitingForDebugger(bool value) { m_waitingForDebugger = value; }
142
143
    std::unique_ptr<protocol::DictionaryValue> toValue() const;
144
4
    String serialize() override { return toValue()->serialize(); }
145
    std::unique_ptr<AttachedToWorkerNotification> clone() const;
146
147
    template<int STATE>
148
4
    class AttachedToWorkerNotificationBuilder {
149
    public:
150
        enum {
151
            NoFieldsSet = 0,
152
            SessionIdSet = 1 << 1,
153
            WorkerInfoSet = 1 << 2,
154
            WaitingForDebuggerSet = 1 << 3,
155
            AllFieldsSet = (SessionIdSet | WorkerInfoSet | WaitingForDebuggerSet | 0)};
156
157
158
4
        AttachedToWorkerNotificationBuilder<STATE | SessionIdSet>& setSessionId(const String& value)
159
        {
160
            static_assert(!(STATE & SessionIdSet), "property sessionId should not be set yet");
161
4
            m_result->setSessionId(value);
162
4
            return castState<SessionIdSet>();
163
        }
164
165
4
        AttachedToWorkerNotificationBuilder<STATE | WorkerInfoSet>& setWorkerInfo(std::unique_ptr<protocol::NodeWorker::WorkerInfo> value)
166
        {
167
            static_assert(!(STATE & WorkerInfoSet), "property workerInfo should not be set yet");
168
4
            m_result->setWorkerInfo(std::move(value));
169
4
            return castState<WorkerInfoSet>();
170
        }
171
172
4
        AttachedToWorkerNotificationBuilder<STATE | WaitingForDebuggerSet>& setWaitingForDebugger(bool value)
173
        {
174
            static_assert(!(STATE & WaitingForDebuggerSet), "property waitingForDebugger should not be set yet");
175
4
            m_result->setWaitingForDebugger(value);
176
4
            return castState<WaitingForDebuggerSet>();
177
        }
178
179
4
        std::unique_ptr<AttachedToWorkerNotification> build()
180
        {
181
            static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
182
4
            return std::move(m_result);
183
        }
184
185
    private:
186
        friend class AttachedToWorkerNotification;
187
4
        AttachedToWorkerNotificationBuilder() : m_result(new AttachedToWorkerNotification()) { }
188
189
12
        template<int STEP> AttachedToWorkerNotificationBuilder<STATE | STEP>& castState()
190
        {
191
12
            return *reinterpret_cast<AttachedToWorkerNotificationBuilder<STATE | STEP>*>(this);
192
        }
193
194
        std::unique_ptr<protocol::NodeWorker::AttachedToWorkerNotification> m_result;
195
    };
196
197
4
    static AttachedToWorkerNotificationBuilder<0> create()
198
    {
199
4
        return AttachedToWorkerNotificationBuilder<0>();
200
    }
201
202
private:
203
4
    AttachedToWorkerNotification()
204
4
    {
205
4
          m_waitingForDebugger = false;
206
4
    }
207
208
    String m_sessionId;
209
    std::unique_ptr<protocol::NodeWorker::WorkerInfo> m_workerInfo;
210
    bool m_waitingForDebugger;
211
};
212
213
214
class  DetachedFromWorkerNotification : public Serializable{
215
    PROTOCOL_DISALLOW_COPY(DetachedFromWorkerNotification);
216
public:
217
    static std::unique_ptr<DetachedFromWorkerNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
218
219
8
    ~DetachedFromWorkerNotification() override { }
220
221
    String getSessionId() { return m_sessionId; }
222
4
    void setSessionId(const String& value) { m_sessionId = value; }
223
224
    std::unique_ptr<protocol::DictionaryValue> toValue() const;
225
4
    String serialize() override { return toValue()->serialize(); }
226
    std::unique_ptr<DetachedFromWorkerNotification> clone() const;
227
228
    template<int STATE>
229
4
    class DetachedFromWorkerNotificationBuilder {
230
    public:
231
        enum {
232
            NoFieldsSet = 0,
233
            SessionIdSet = 1 << 1,
234
            AllFieldsSet = (SessionIdSet | 0)};
235
236
237
4
        DetachedFromWorkerNotificationBuilder<STATE | SessionIdSet>& setSessionId(const String& value)
238
        {
239
            static_assert(!(STATE & SessionIdSet), "property sessionId should not be set yet");
240
4
            m_result->setSessionId(value);
241
4
            return castState<SessionIdSet>();
242
        }
243
244
4
        std::unique_ptr<DetachedFromWorkerNotification> build()
245
        {
246
            static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
247
4
            return std::move(m_result);
248
        }
249
250
    private:
251
        friend class DetachedFromWorkerNotification;
252
4
        DetachedFromWorkerNotificationBuilder() : m_result(new DetachedFromWorkerNotification()) { }
253
254
4
        template<int STEP> DetachedFromWorkerNotificationBuilder<STATE | STEP>& castState()
255
        {
256
4
            return *reinterpret_cast<DetachedFromWorkerNotificationBuilder<STATE | STEP>*>(this);
257
        }
258
259
        std::unique_ptr<protocol::NodeWorker::DetachedFromWorkerNotification> m_result;
260
    };
261
262
4
    static DetachedFromWorkerNotificationBuilder<0> create()
263
    {
264
4
        return DetachedFromWorkerNotificationBuilder<0>();
265
    }
266
267
private:
268
4
    DetachedFromWorkerNotification()
269
4
    {
270
4
    }
271
272
    String m_sessionId;
273
};
274
275
276
class  ReceivedMessageFromWorkerNotification : public Serializable{
277
    PROTOCOL_DISALLOW_COPY(ReceivedMessageFromWorkerNotification);
278
public:
279
    static std::unique_ptr<ReceivedMessageFromWorkerNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
280
281
320
    ~ReceivedMessageFromWorkerNotification() override { }
282
283
    String getSessionId() { return m_sessionId; }
284
160
    void setSessionId(const String& value) { m_sessionId = value; }
285
286
    String getMessage() { return m_message; }
287
160
    void setMessage(const String& value) { m_message = value; }
288
289
    std::unique_ptr<protocol::DictionaryValue> toValue() const;
290
160
    String serialize() override { return toValue()->serialize(); }
291
    std::unique_ptr<ReceivedMessageFromWorkerNotification> clone() const;
292
293
    template<int STATE>
294
160
    class ReceivedMessageFromWorkerNotificationBuilder {
295
    public:
296
        enum {
297
            NoFieldsSet = 0,
298
            SessionIdSet = 1 << 1,
299
            MessageSet = 1 << 2,
300
            AllFieldsSet = (SessionIdSet | MessageSet | 0)};
301
302
303
160
        ReceivedMessageFromWorkerNotificationBuilder<STATE | SessionIdSet>& setSessionId(const String& value)
304
        {
305
            static_assert(!(STATE & SessionIdSet), "property sessionId should not be set yet");
306
160
            m_result->setSessionId(value);
307
160
            return castState<SessionIdSet>();
308
        }
309
310
160
        ReceivedMessageFromWorkerNotificationBuilder<STATE | MessageSet>& setMessage(const String& value)
311
        {
312
            static_assert(!(STATE & MessageSet), "property message should not be set yet");
313
160
            m_result->setMessage(value);
314
160
            return castState<MessageSet>();
315
        }
316
317
160
        std::unique_ptr<ReceivedMessageFromWorkerNotification> build()
318
        {
319
            static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
320
160
            return std::move(m_result);
321
        }
322
323
    private:
324
        friend class ReceivedMessageFromWorkerNotification;
325
160
        ReceivedMessageFromWorkerNotificationBuilder() : m_result(new ReceivedMessageFromWorkerNotification()) { }
326
327
320
        template<int STEP> ReceivedMessageFromWorkerNotificationBuilder<STATE | STEP>& castState()
328
        {
329
320
            return *reinterpret_cast<ReceivedMessageFromWorkerNotificationBuilder<STATE | STEP>*>(this);
330
        }
331
332
        std::unique_ptr<protocol::NodeWorker::ReceivedMessageFromWorkerNotification> m_result;
333
    };
334
335
160
    static ReceivedMessageFromWorkerNotificationBuilder<0> create()
336
    {
337
160
        return ReceivedMessageFromWorkerNotificationBuilder<0>();
338
    }
339
340
private:
341
160
    ReceivedMessageFromWorkerNotification()
342
160
    {
343
160
    }
344
345
    String m_sessionId;
346
    String m_message;
347
};
348
349
350
// ------------- Backend interface.
351
352
206
class  Backend {
353
public:
354
206
    virtual ~Backend() { }
355
356
    virtual DispatchResponse sendMessageToWorker(const String& in_message, const String& in_sessionId) = 0;
357
    virtual DispatchResponse enable(bool in_waitForDebuggerOnStart) = 0;
358
    virtual DispatchResponse disable() = 0;
359
360
};
361
362
// ------------- Frontend interface.
363
364
class  Frontend {
365
public:
366
206
    explicit Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { }
367
    void attachedToWorker(const String& sessionId, std::unique_ptr<protocol::NodeWorker::WorkerInfo> workerInfo, bool waitingForDebugger);
368
    void detachedFromWorker(const String& sessionId);
369
    void receivedMessageFromWorker(const String& sessionId, const String& message);
370
371
    void flush();
372
    void sendRawNotification(const String&);
373
private:
374
    FrontendChannel* m_frontendChannel;
375
};
376
377
// ------------- Dispatcher.
378
379
class  Dispatcher {
380
public:
381
    static void wire(UberDispatcher*, Backend*);
382
383
private:
384
    Dispatcher() { }
385
};
386
387
// ------------- Metainfo.
388
389
class  Metainfo {
390
public:
391
    using BackendClass = Backend;
392
    using FrontendClass = Frontend;
393
    using DispatcherClass = Dispatcher;
394
    static const char domainName[];
395
    static const char commandPrefix[];
396
    static const char version[];
397
};
398
399
} // namespace NodeWorker
400
} // namespace node
401
} // namespace inspector
402
} // namespace protocol
403
404
#endif // !defined(node_inspector_protocol_NodeWorker_h)