Line data Source code
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 v8_inspector_protocol_Debugger_h
8 : #define v8_inspector_protocol_Debugger_h
9 :
10 : #include "src/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 : #include "src/inspector/protocol/Runtime.h"
14 : #include "include/inspector/Debugger.h"
15 :
16 : namespace v8_inspector {
17 : namespace protocol {
18 : namespace Debugger {
19 :
20 : // ------------- Forward and enum declarations.
21 : // Breakpoint identifier.
22 : using BreakpointId = String;
23 : // Call frame identifier.
24 : using CallFrameId = String;
25 : // Location in the source code.
26 : class Location;
27 : // Location in the source code.
28 : class ScriptPosition;
29 : // JavaScript call frame. Array of call frames form the call stack.
30 : class CallFrame;
31 : // Scope description.
32 : class Scope;
33 : // Search match for resource.
34 : class SearchMatch;
35 : //
36 : class BreakLocation;
37 : // Wrapper for notification params
38 : class ScriptParsedNotification;
39 : // Wrapper for notification params
40 : class ScriptFailedToParseNotification;
41 : // Wrapper for notification params
42 : class BreakpointResolvedNotification;
43 : // Wrapper for notification params
44 : class PausedNotification;
45 : // Wrapper for notification params
46 : using ResumedNotification = Object;
47 :
48 : namespace ContinueToLocation {
49 : namespace TargetCallFramesEnum {
50 : extern const char* Any;
51 : extern const char* Current;
52 : } // TargetCallFramesEnum
53 : } // ContinueToLocation
54 :
55 : namespace SetPauseOnExceptions {
56 : namespace StateEnum {
57 : extern const char* None;
58 : extern const char* Uncaught;
59 : extern const char* All;
60 : } // StateEnum
61 : } // SetPauseOnExceptions
62 :
63 : namespace Paused {
64 : namespace ReasonEnum {
65 : extern const char* XHR;
66 : extern const char* DOM;
67 : extern const char* EventListener;
68 : extern const char* Exception;
69 : extern const char* Assert;
70 : extern const char* DebugCommand;
71 : extern const char* PromiseRejection;
72 : extern const char* OOM;
73 : extern const char* Other;
74 : extern const char* Ambiguous;
75 : } // ReasonEnum
76 : } // Paused
77 :
78 : // ------------- Type and builder declarations.
79 :
80 : // Location in the source code.
81 : class Location : public Serializable{
82 : PROTOCOL_DISALLOW_COPY(Location);
83 : public:
84 : static std::unique_ptr<Location> fromValue(protocol::Value* value, ErrorSupport* errors);
85 :
86 860702 : ~Location() override { }
87 :
88 254048 : String getScriptId() { return m_scriptId; }
89 428446 : void setScriptId(const String& value) { m_scriptId = value; }
90 :
91 : int getLineNumber() { return m_lineNumber; }
92 428446 : void setLineNumber(int value) { m_lineNumber = value; }
93 :
94 : bool hasColumnNumber() { return m_columnNumber.isJust(); }
95 129225 : int getColumnNumber(int defaultValue) { return m_columnNumber.isJust() ? m_columnNumber.fromJust() : defaultValue; }
96 : void setColumnNumber(int value) { m_columnNumber = value; }
97 :
98 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
99 0 : String serialize() override { return toValue()->serialize(); }
100 : std::unique_ptr<Location> clone() const;
101 :
102 : template<int STATE>
103 : class LocationBuilder {
104 : public:
105 : enum {
106 : NoFieldsSet = 0,
107 : ScriptIdSet = 1 << 1,
108 : LineNumberSet = 1 << 2,
109 : AllFieldsSet = (ScriptIdSet | LineNumberSet | 0)};
110 :
111 :
112 : LocationBuilder<STATE | ScriptIdSet>& setScriptId(const String& value)
113 : {
114 : static_assert(!(STATE & ScriptIdSet), "property scriptId should not be set yet");
115 : m_result->setScriptId(value);
116 : return castState<ScriptIdSet>();
117 : }
118 :
119 : LocationBuilder<STATE | LineNumberSet>& setLineNumber(int value)
120 : {
121 : static_assert(!(STATE & LineNumberSet), "property lineNumber should not be set yet");
122 : m_result->setLineNumber(value);
123 : return castState<LineNumberSet>();
124 : }
125 :
126 : LocationBuilder<STATE>& setColumnNumber(int value)
127 : {
128 : m_result->setColumnNumber(value);
129 : return *this;
130 : }
131 :
132 : std::unique_ptr<Location> build()
133 : {
134 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
135 : return std::move(m_result);
136 : }
137 :
138 : private:
139 : friend class Location;
140 856236 : LocationBuilder() : m_result(new Location()) { }
141 :
142 : template<int STEP> LocationBuilder<STATE | STEP>& castState()
143 : {
144 : return *reinterpret_cast<LocationBuilder<STATE | STEP>*>(this);
145 : }
146 :
147 : std::unique_ptr<protocol::Debugger::Location> m_result;
148 : };
149 :
150 : static LocationBuilder<0> create()
151 : {
152 428118 : return LocationBuilder<0>();
153 : }
154 :
155 : private:
156 : Location()
157 430351 : {
158 430351 : m_lineNumber = 0;
159 : }
160 :
161 : String m_scriptId;
162 : int m_lineNumber;
163 : Maybe<int> m_columnNumber;
164 : };
165 :
166 :
167 : // Location in the source code.
168 : class ScriptPosition : public Serializable{
169 : PROTOCOL_DISALLOW_COPY(ScriptPosition);
170 : public:
171 : static std::unique_ptr<ScriptPosition> fromValue(protocol::Value* value, ErrorSupport* errors);
172 :
173 190 : ~ScriptPosition() override { }
174 :
175 : int getLineNumber() { return m_lineNumber; }
176 : void setLineNumber(int value) { m_lineNumber = value; }
177 :
178 : int getColumnNumber() { return m_columnNumber; }
179 : void setColumnNumber(int value) { m_columnNumber = value; }
180 :
181 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
182 0 : String serialize() override { return toValue()->serialize(); }
183 : std::unique_ptr<ScriptPosition> clone() const;
184 :
185 : template<int STATE>
186 : class ScriptPositionBuilder {
187 : public:
188 : enum {
189 : NoFieldsSet = 0,
190 : LineNumberSet = 1 << 1,
191 : ColumnNumberSet = 1 << 2,
192 : AllFieldsSet = (LineNumberSet | ColumnNumberSet | 0)};
193 :
194 :
195 : ScriptPositionBuilder<STATE | LineNumberSet>& setLineNumber(int value)
196 : {
197 : static_assert(!(STATE & LineNumberSet), "property lineNumber should not be set yet");
198 : m_result->setLineNumber(value);
199 : return castState<LineNumberSet>();
200 : }
201 :
202 : ScriptPositionBuilder<STATE | ColumnNumberSet>& setColumnNumber(int value)
203 : {
204 : static_assert(!(STATE & ColumnNumberSet), "property columnNumber should not be set yet");
205 : m_result->setColumnNumber(value);
206 : return castState<ColumnNumberSet>();
207 : }
208 :
209 : std::unique_ptr<ScriptPosition> build()
210 : {
211 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
212 : return std::move(m_result);
213 : }
214 :
215 : private:
216 : friend class ScriptPosition;
217 : ScriptPositionBuilder() : m_result(new ScriptPosition()) { }
218 :
219 : template<int STEP> ScriptPositionBuilder<STATE | STEP>& castState()
220 : {
221 : return *reinterpret_cast<ScriptPositionBuilder<STATE | STEP>*>(this);
222 : }
223 :
224 : std::unique_ptr<protocol::Debugger::ScriptPosition> m_result;
225 : };
226 :
227 : static ScriptPositionBuilder<0> create()
228 : {
229 : return ScriptPositionBuilder<0>();
230 : }
231 :
232 : private:
233 : ScriptPosition()
234 95 : {
235 95 : m_lineNumber = 0;
236 95 : m_columnNumber = 0;
237 : }
238 :
239 : int m_lineNumber;
240 : int m_columnNumber;
241 : };
242 :
243 :
244 : // JavaScript call frame. Array of call frames form the call stack.
245 : class CallFrame : public Serializable{
246 : PROTOCOL_DISALLOW_COPY(CallFrame);
247 : public:
248 : static std::unique_ptr<CallFrame> fromValue(protocol::Value* value, ErrorSupport* errors);
249 :
250 375234 : ~CallFrame() override { }
251 :
252 : String getCallFrameId() { return m_callFrameId; }
253 125078 : void setCallFrameId(const String& value) { m_callFrameId = value; }
254 :
255 : String getFunctionName() { return m_functionName; }
256 125078 : void setFunctionName(const String& value) { m_functionName = value; }
257 :
258 : bool hasFunctionLocation() { return m_functionLocation.isJust(); }
259 : protocol::Debugger::Location* getFunctionLocation(protocol::Debugger::Location* defaultValue) { return m_functionLocation.isJust() ? m_functionLocation.fromJust() : defaultValue; }
260 : void setFunctionLocation(std::unique_ptr<protocol::Debugger::Location> value) { m_functionLocation = std::move(value); }
261 :
262 : protocol::Debugger::Location* getLocation() { return m_location.get(); }
263 : void setLocation(std::unique_ptr<protocol::Debugger::Location> value) { m_location = std::move(value); }
264 :
265 : String getUrl() { return m_url; }
266 125078 : void setUrl(const String& value) { m_url = value; }
267 :
268 : protocol::Array<protocol::Debugger::Scope>* getScopeChain() { return m_scopeChain.get(); }
269 : void setScopeChain(std::unique_ptr<protocol::Array<protocol::Debugger::Scope>> value) { m_scopeChain = std::move(value); }
270 :
271 : protocol::Runtime::RemoteObject* getThis() { return m_this.get(); }
272 : void setThis(std::unique_ptr<protocol::Runtime::RemoteObject> value) { m_this = std::move(value); }
273 :
274 : bool hasReturnValue() { return m_returnValue.isJust(); }
275 : protocol::Runtime::RemoteObject* getReturnValue(protocol::Runtime::RemoteObject* defaultValue) { return m_returnValue.isJust() ? m_returnValue.fromJust() : defaultValue; }
276 : void setReturnValue(std::unique_ptr<protocol::Runtime::RemoteObject> value) { m_returnValue = std::move(value); }
277 :
278 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
279 0 : String serialize() override { return toValue()->serialize(); }
280 : std::unique_ptr<CallFrame> clone() const;
281 :
282 : template<int STATE>
283 : class CallFrameBuilder {
284 : public:
285 : enum {
286 : NoFieldsSet = 0,
287 : CallFrameIdSet = 1 << 1,
288 : FunctionNameSet = 1 << 2,
289 : LocationSet = 1 << 3,
290 : UrlSet = 1 << 4,
291 : ScopeChainSet = 1 << 5,
292 : ThisSet = 1 << 6,
293 : AllFieldsSet = (CallFrameIdSet | FunctionNameSet | LocationSet | UrlSet | ScopeChainSet | ThisSet | 0)};
294 :
295 :
296 : CallFrameBuilder<STATE | CallFrameIdSet>& setCallFrameId(const String& value)
297 : {
298 : static_assert(!(STATE & CallFrameIdSet), "property callFrameId should not be set yet");
299 : m_result->setCallFrameId(value);
300 : return castState<CallFrameIdSet>();
301 : }
302 :
303 : CallFrameBuilder<STATE | FunctionNameSet>& setFunctionName(const String& value)
304 : {
305 : static_assert(!(STATE & FunctionNameSet), "property functionName should not be set yet");
306 : m_result->setFunctionName(value);
307 : return castState<FunctionNameSet>();
308 : }
309 :
310 : CallFrameBuilder<STATE>& setFunctionLocation(std::unique_ptr<protocol::Debugger::Location> value)
311 : {
312 : m_result->setFunctionLocation(std::move(value));
313 : return *this;
314 : }
315 :
316 : CallFrameBuilder<STATE | LocationSet>& setLocation(std::unique_ptr<protocol::Debugger::Location> value)
317 : {
318 : static_assert(!(STATE & LocationSet), "property location should not be set yet");
319 : m_result->setLocation(std::move(value));
320 : return castState<LocationSet>();
321 : }
322 :
323 : CallFrameBuilder<STATE | UrlSet>& setUrl(const String& value)
324 : {
325 : static_assert(!(STATE & UrlSet), "property url should not be set yet");
326 : m_result->setUrl(value);
327 : return castState<UrlSet>();
328 : }
329 :
330 : CallFrameBuilder<STATE | ScopeChainSet>& setScopeChain(std::unique_ptr<protocol::Array<protocol::Debugger::Scope>> value)
331 : {
332 : static_assert(!(STATE & ScopeChainSet), "property scopeChain should not be set yet");
333 : m_result->setScopeChain(std::move(value));
334 : return castState<ScopeChainSet>();
335 : }
336 :
337 : CallFrameBuilder<STATE | ThisSet>& setThis(std::unique_ptr<protocol::Runtime::RemoteObject> value)
338 : {
339 : static_assert(!(STATE & ThisSet), "property this should not be set yet");
340 : m_result->setThis(std::move(value));
341 : return castState<ThisSet>();
342 : }
343 :
344 : CallFrameBuilder<STATE>& setReturnValue(std::unique_ptr<protocol::Runtime::RemoteObject> value)
345 : {
346 : m_result->setReturnValue(std::move(value));
347 : return *this;
348 : }
349 :
350 : std::unique_ptr<CallFrame> build()
351 : {
352 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
353 : return std::move(m_result);
354 : }
355 :
356 : private:
357 : friend class CallFrame;
358 250156 : CallFrameBuilder() : m_result(new CallFrame()) { }
359 :
360 : template<int STEP> CallFrameBuilder<STATE | STEP>& castState()
361 : {
362 : return *reinterpret_cast<CallFrameBuilder<STATE | STEP>*>(this);
363 : }
364 :
365 : std::unique_ptr<protocol::Debugger::CallFrame> m_result;
366 : };
367 :
368 : static CallFrameBuilder<0> create()
369 : {
370 125078 : return CallFrameBuilder<0>();
371 : }
372 :
373 : private:
374 125078 : CallFrame()
375 250156 : {
376 125078 : }
377 :
378 : String m_callFrameId;
379 : String m_functionName;
380 : Maybe<protocol::Debugger::Location> m_functionLocation;
381 : std::unique_ptr<protocol::Debugger::Location> m_location;
382 : String m_url;
383 : std::unique_ptr<protocol::Array<protocol::Debugger::Scope>> m_scopeChain;
384 : std::unique_ptr<protocol::Runtime::RemoteObject> m_this;
385 : Maybe<protocol::Runtime::RemoteObject> m_returnValue;
386 : };
387 :
388 :
389 : // Scope description.
390 : class Scope : public Serializable{
391 : PROTOCOL_DISALLOW_COPY(Scope);
392 : public:
393 : static std::unique_ptr<Scope> fromValue(protocol::Value* value, ErrorSupport* errors);
394 :
395 979308 : ~Scope() override { }
396 :
397 : struct TypeEnum {
398 : static const char* Global;
399 : static const char* Local;
400 : static const char* With;
401 : static const char* Closure;
402 : static const char* Catch;
403 : static const char* Block;
404 : static const char* Script;
405 : static const char* Eval;
406 : static const char* Module;
407 : }; // TypeEnum
408 :
409 : String getType() { return m_type; }
410 326436 : void setType(const String& value) { m_type = value; }
411 :
412 : protocol::Runtime::RemoteObject* getObject() { return m_object.get(); }
413 : void setObject(std::unique_ptr<protocol::Runtime::RemoteObject> value) { m_object = std::move(value); }
414 :
415 : bool hasName() { return m_name.isJust(); }
416 : String getName(const String& defaultValue) { return m_name.isJust() ? m_name.fromJust() : defaultValue; }
417 156300 : void setName(const String& value) { m_name = value; }
418 :
419 : bool hasStartLocation() { return m_startLocation.isJust(); }
420 : protocol::Debugger::Location* getStartLocation(protocol::Debugger::Location* defaultValue) { return m_startLocation.isJust() ? m_startLocation.fromJust() : defaultValue; }
421 : void setStartLocation(std::unique_ptr<protocol::Debugger::Location> value) { m_startLocation = std::move(value); }
422 :
423 : bool hasEndLocation() { return m_endLocation.isJust(); }
424 : protocol::Debugger::Location* getEndLocation(protocol::Debugger::Location* defaultValue) { return m_endLocation.isJust() ? m_endLocation.fromJust() : defaultValue; }
425 : void setEndLocation(std::unique_ptr<protocol::Debugger::Location> value) { m_endLocation = std::move(value); }
426 :
427 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
428 0 : String serialize() override { return toValue()->serialize(); }
429 : std::unique_ptr<Scope> clone() const;
430 :
431 : template<int STATE>
432 : class ScopeBuilder {
433 : public:
434 : enum {
435 : NoFieldsSet = 0,
436 : TypeSet = 1 << 1,
437 : ObjectSet = 1 << 2,
438 : AllFieldsSet = (TypeSet | ObjectSet | 0)};
439 :
440 :
441 : ScopeBuilder<STATE | TypeSet>& setType(const String& value)
442 : {
443 : static_assert(!(STATE & TypeSet), "property type should not be set yet");
444 : m_result->setType(value);
445 : return castState<TypeSet>();
446 : }
447 :
448 : ScopeBuilder<STATE | ObjectSet>& setObject(std::unique_ptr<protocol::Runtime::RemoteObject> value)
449 : {
450 : static_assert(!(STATE & ObjectSet), "property object should not be set yet");
451 : m_result->setObject(std::move(value));
452 : return castState<ObjectSet>();
453 : }
454 :
455 : ScopeBuilder<STATE>& setName(const String& value)
456 : {
457 : m_result->setName(value);
458 : return *this;
459 : }
460 :
461 : ScopeBuilder<STATE>& setStartLocation(std::unique_ptr<protocol::Debugger::Location> value)
462 : {
463 : m_result->setStartLocation(std::move(value));
464 : return *this;
465 : }
466 :
467 : ScopeBuilder<STATE>& setEndLocation(std::unique_ptr<protocol::Debugger::Location> value)
468 : {
469 : m_result->setEndLocation(std::move(value));
470 : return *this;
471 : }
472 :
473 : std::unique_ptr<Scope> build()
474 : {
475 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
476 : return std::move(m_result);
477 : }
478 :
479 : private:
480 : friend class Scope;
481 652872 : ScopeBuilder() : m_result(new Scope()) { }
482 :
483 : template<int STEP> ScopeBuilder<STATE | STEP>& castState()
484 : {
485 : return *reinterpret_cast<ScopeBuilder<STATE | STEP>*>(this);
486 : }
487 :
488 : std::unique_ptr<protocol::Debugger::Scope> m_result;
489 : };
490 :
491 : static ScopeBuilder<0> create()
492 : {
493 326436 : return ScopeBuilder<0>();
494 : }
495 :
496 : private:
497 326436 : Scope()
498 326436 : {
499 326436 : }
500 :
501 : String m_type;
502 : std::unique_ptr<protocol::Runtime::RemoteObject> m_object;
503 : Maybe<String> m_name;
504 : Maybe<protocol::Debugger::Location> m_startLocation;
505 : Maybe<protocol::Debugger::Location> m_endLocation;
506 : };
507 :
508 :
509 : // Search match for resource.
510 : class SearchMatch : public Serializable, public API::SearchMatch{
511 : PROTOCOL_DISALLOW_COPY(SearchMatch);
512 : public:
513 : static std::unique_ptr<SearchMatch> fromValue(protocol::Value* value, ErrorSupport* errors);
514 :
515 0 : ~SearchMatch() override { }
516 :
517 : double getLineNumber() { return m_lineNumber; }
518 0 : void setLineNumber(double value) { m_lineNumber = value; }
519 :
520 : String getLineContent() { return m_lineContent; }
521 0 : void setLineContent(const String& value) { m_lineContent = value; }
522 :
523 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
524 0 : String serialize() override { return toValue()->serialize(); }
525 : std::unique_ptr<SearchMatch> clone() const;
526 : std::unique_ptr<StringBuffer> toJSONString() const override;
527 :
528 : template<int STATE>
529 : class SearchMatchBuilder {
530 : public:
531 : enum {
532 : NoFieldsSet = 0,
533 : LineNumberSet = 1 << 1,
534 : LineContentSet = 1 << 2,
535 : AllFieldsSet = (LineNumberSet | LineContentSet | 0)};
536 :
537 :
538 : SearchMatchBuilder<STATE | LineNumberSet>& setLineNumber(double value)
539 : {
540 : static_assert(!(STATE & LineNumberSet), "property lineNumber should not be set yet");
541 : m_result->setLineNumber(value);
542 : return castState<LineNumberSet>();
543 : }
544 :
545 : SearchMatchBuilder<STATE | LineContentSet>& setLineContent(const String& value)
546 : {
547 : static_assert(!(STATE & LineContentSet), "property lineContent should not be set yet");
548 : m_result->setLineContent(value);
549 : return castState<LineContentSet>();
550 : }
551 :
552 : std::unique_ptr<SearchMatch> build()
553 : {
554 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
555 : return std::move(m_result);
556 : }
557 :
558 : private:
559 : friend class SearchMatch;
560 0 : SearchMatchBuilder() : m_result(new SearchMatch()) { }
561 :
562 : template<int STEP> SearchMatchBuilder<STATE | STEP>& castState()
563 : {
564 : return *reinterpret_cast<SearchMatchBuilder<STATE | STEP>*>(this);
565 : }
566 :
567 : std::unique_ptr<protocol::Debugger::SearchMatch> m_result;
568 : };
569 :
570 : static SearchMatchBuilder<0> create()
571 : {
572 0 : return SearchMatchBuilder<0>();
573 : }
574 :
575 : private:
576 : SearchMatch()
577 0 : {
578 0 : m_lineNumber = 0;
579 : }
580 :
581 : double m_lineNumber;
582 : String m_lineContent;
583 : };
584 :
585 :
586 : //
587 : class BreakLocation : public Serializable{
588 : PROTOCOL_DISALLOW_COPY(BreakLocation);
589 : public:
590 : static std::unique_ptr<BreakLocation> fromValue(protocol::Value* value, ErrorSupport* errors);
591 :
592 9105 : ~BreakLocation() override { }
593 :
594 : String getScriptId() { return m_scriptId; }
595 3035 : void setScriptId(const String& value) { m_scriptId = value; }
596 :
597 : int getLineNumber() { return m_lineNumber; }
598 3035 : void setLineNumber(int value) { m_lineNumber = value; }
599 :
600 : bool hasColumnNumber() { return m_columnNumber.isJust(); }
601 : int getColumnNumber(int defaultValue) { return m_columnNumber.isJust() ? m_columnNumber.fromJust() : defaultValue; }
602 : void setColumnNumber(int value) { m_columnNumber = value; }
603 :
604 : struct TypeEnum {
605 : static const char* DebuggerStatement;
606 : static const char* Call;
607 : static const char* Return;
608 : }; // TypeEnum
609 :
610 : bool hasType() { return m_type.isJust(); }
611 : String getType(const String& defaultValue) { return m_type.isJust() ? m_type.fromJust() : defaultValue; }
612 3530 : void setType(const String& value) { m_type = value; }
613 :
614 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
615 0 : String serialize() override { return toValue()->serialize(); }
616 : std::unique_ptr<BreakLocation> clone() const;
617 :
618 : template<int STATE>
619 : class BreakLocationBuilder {
620 : public:
621 : enum {
622 : NoFieldsSet = 0,
623 : ScriptIdSet = 1 << 1,
624 : LineNumberSet = 1 << 2,
625 : AllFieldsSet = (ScriptIdSet | LineNumberSet | 0)};
626 :
627 :
628 : BreakLocationBuilder<STATE | ScriptIdSet>& setScriptId(const String& value)
629 : {
630 : static_assert(!(STATE & ScriptIdSet), "property scriptId should not be set yet");
631 : m_result->setScriptId(value);
632 : return castState<ScriptIdSet>();
633 : }
634 :
635 : BreakLocationBuilder<STATE | LineNumberSet>& setLineNumber(int value)
636 : {
637 : static_assert(!(STATE & LineNumberSet), "property lineNumber should not be set yet");
638 : m_result->setLineNumber(value);
639 : return castState<LineNumberSet>();
640 : }
641 :
642 : BreakLocationBuilder<STATE>& setColumnNumber(int value)
643 : {
644 : m_result->setColumnNumber(value);
645 : return *this;
646 : }
647 :
648 : BreakLocationBuilder<STATE>& setType(const String& value)
649 : {
650 : m_result->setType(value);
651 : return *this;
652 : }
653 :
654 : std::unique_ptr<BreakLocation> build()
655 : {
656 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
657 : return std::move(m_result);
658 : }
659 :
660 : private:
661 : friend class BreakLocation;
662 6070 : BreakLocationBuilder() : m_result(new BreakLocation()) { }
663 :
664 : template<int STEP> BreakLocationBuilder<STATE | STEP>& castState()
665 : {
666 : return *reinterpret_cast<BreakLocationBuilder<STATE | STEP>*>(this);
667 : }
668 :
669 : std::unique_ptr<protocol::Debugger::BreakLocation> m_result;
670 : };
671 :
672 : static BreakLocationBuilder<0> create()
673 : {
674 3035 : return BreakLocationBuilder<0>();
675 : }
676 :
677 : private:
678 3035 : BreakLocation()
679 3035 : {
680 3035 : m_lineNumber = 0;
681 3035 : }
682 :
683 : String m_scriptId;
684 : int m_lineNumber;
685 : Maybe<int> m_columnNumber;
686 : Maybe<String> m_type;
687 : };
688 :
689 :
690 : // Wrapper for notification params
691 : class ScriptParsedNotification : public Serializable{
692 : PROTOCOL_DISALLOW_COPY(ScriptParsedNotification);
693 : public:
694 : static std::unique_ptr<ScriptParsedNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
695 :
696 77514 : ~ScriptParsedNotification() override { }
697 :
698 : String getScriptId() { return m_scriptId; }
699 25838 : void setScriptId(const String& value) { m_scriptId = value; }
700 :
701 : String getUrl() { return m_url; }
702 25838 : void setUrl(const String& value) { m_url = value; }
703 :
704 : int getStartLine() { return m_startLine; }
705 25838 : void setStartLine(int value) { m_startLine = value; }
706 :
707 : int getStartColumn() { return m_startColumn; }
708 25838 : void setStartColumn(int value) { m_startColumn = value; }
709 :
710 : int getEndLine() { return m_endLine; }
711 25838 : void setEndLine(int value) { m_endLine = value; }
712 :
713 : int getEndColumn() { return m_endColumn; }
714 25838 : void setEndColumn(int value) { m_endColumn = value; }
715 :
716 : int getExecutionContextId() { return m_executionContextId; }
717 25838 : void setExecutionContextId(int value) { m_executionContextId = value; }
718 :
719 : String getHash() { return m_hash; }
720 25838 : void setHash(const String& value) { m_hash = value; }
721 :
722 : bool hasExecutionContextAuxData() { return m_executionContextAuxData.isJust(); }
723 : protocol::DictionaryValue* getExecutionContextAuxData(protocol::DictionaryValue* defaultValue) { return m_executionContextAuxData.isJust() ? m_executionContextAuxData.fromJust() : defaultValue; }
724 : void setExecutionContextAuxData(std::unique_ptr<protocol::DictionaryValue> value) { m_executionContextAuxData = std::move(value); }
725 :
726 : bool hasIsLiveEdit() { return m_isLiveEdit.isJust(); }
727 : bool getIsLiveEdit(bool defaultValue) { return m_isLiveEdit.isJust() ? m_isLiveEdit.fromJust() : defaultValue; }
728 : void setIsLiveEdit(bool value) { m_isLiveEdit = value; }
729 :
730 : bool hasSourceMapURL() { return m_sourceMapURL.isJust(); }
731 : String getSourceMapURL(const String& defaultValue) { return m_sourceMapURL.isJust() ? m_sourceMapURL.fromJust() : defaultValue; }
732 51676 : void setSourceMapURL(const String& value) { m_sourceMapURL = value; }
733 :
734 : bool hasHasSourceURL() { return m_hasSourceURL.isJust(); }
735 : bool getHasSourceURL(bool defaultValue) { return m_hasSourceURL.isJust() ? m_hasSourceURL.fromJust() : defaultValue; }
736 : void setHasSourceURL(bool value) { m_hasSourceURL = value; }
737 :
738 : bool hasIsModule() { return m_isModule.isJust(); }
739 : bool getIsModule(bool defaultValue) { return m_isModule.isJust() ? m_isModule.fromJust() : defaultValue; }
740 : void setIsModule(bool value) { m_isModule = value; }
741 :
742 : bool hasLength() { return m_length.isJust(); }
743 : int getLength(int defaultValue) { return m_length.isJust() ? m_length.fromJust() : defaultValue; }
744 : void setLength(int value) { m_length = value; }
745 :
746 : bool hasStackTrace() { return m_stackTrace.isJust(); }
747 : protocol::Runtime::StackTrace* getStackTrace(protocol::Runtime::StackTrace* defaultValue) { return m_stackTrace.isJust() ? m_stackTrace.fromJust() : defaultValue; }
748 : void setStackTrace(std::unique_ptr<protocol::Runtime::StackTrace> value) { m_stackTrace = std::move(value); }
749 :
750 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
751 77514 : String serialize() override { return toValue()->serialize(); }
752 : std::unique_ptr<ScriptParsedNotification> clone() const;
753 :
754 : template<int STATE>
755 : class ScriptParsedNotificationBuilder {
756 : public:
757 : enum {
758 : NoFieldsSet = 0,
759 : ScriptIdSet = 1 << 1,
760 : UrlSet = 1 << 2,
761 : StartLineSet = 1 << 3,
762 : StartColumnSet = 1 << 4,
763 : EndLineSet = 1 << 5,
764 : EndColumnSet = 1 << 6,
765 : ExecutionContextIdSet = 1 << 7,
766 : HashSet = 1 << 8,
767 : AllFieldsSet = (ScriptIdSet | UrlSet | StartLineSet | StartColumnSet | EndLineSet | EndColumnSet | ExecutionContextIdSet | HashSet | 0)};
768 :
769 :
770 : ScriptParsedNotificationBuilder<STATE | ScriptIdSet>& setScriptId(const String& value)
771 : {
772 : static_assert(!(STATE & ScriptIdSet), "property scriptId should not be set yet");
773 : m_result->setScriptId(value);
774 : return castState<ScriptIdSet>();
775 : }
776 :
777 : ScriptParsedNotificationBuilder<STATE | UrlSet>& setUrl(const String& value)
778 : {
779 : static_assert(!(STATE & UrlSet), "property url should not be set yet");
780 : m_result->setUrl(value);
781 : return castState<UrlSet>();
782 : }
783 :
784 : ScriptParsedNotificationBuilder<STATE | StartLineSet>& setStartLine(int value)
785 : {
786 : static_assert(!(STATE & StartLineSet), "property startLine should not be set yet");
787 : m_result->setStartLine(value);
788 : return castState<StartLineSet>();
789 : }
790 :
791 : ScriptParsedNotificationBuilder<STATE | StartColumnSet>& setStartColumn(int value)
792 : {
793 : static_assert(!(STATE & StartColumnSet), "property startColumn should not be set yet");
794 : m_result->setStartColumn(value);
795 : return castState<StartColumnSet>();
796 : }
797 :
798 : ScriptParsedNotificationBuilder<STATE | EndLineSet>& setEndLine(int value)
799 : {
800 : static_assert(!(STATE & EndLineSet), "property endLine should not be set yet");
801 : m_result->setEndLine(value);
802 : return castState<EndLineSet>();
803 : }
804 :
805 : ScriptParsedNotificationBuilder<STATE | EndColumnSet>& setEndColumn(int value)
806 : {
807 : static_assert(!(STATE & EndColumnSet), "property endColumn should not be set yet");
808 : m_result->setEndColumn(value);
809 : return castState<EndColumnSet>();
810 : }
811 :
812 : ScriptParsedNotificationBuilder<STATE | ExecutionContextIdSet>& setExecutionContextId(int value)
813 : {
814 : static_assert(!(STATE & ExecutionContextIdSet), "property executionContextId should not be set yet");
815 : m_result->setExecutionContextId(value);
816 : return castState<ExecutionContextIdSet>();
817 : }
818 :
819 : ScriptParsedNotificationBuilder<STATE | HashSet>& setHash(const String& value)
820 : {
821 : static_assert(!(STATE & HashSet), "property hash should not be set yet");
822 : m_result->setHash(value);
823 : return castState<HashSet>();
824 : }
825 :
826 : ScriptParsedNotificationBuilder<STATE>& setExecutionContextAuxData(std::unique_ptr<protocol::DictionaryValue> value)
827 : {
828 : m_result->setExecutionContextAuxData(std::move(value));
829 : return *this;
830 : }
831 :
832 : ScriptParsedNotificationBuilder<STATE>& setIsLiveEdit(bool value)
833 : {
834 : m_result->setIsLiveEdit(value);
835 : return *this;
836 : }
837 :
838 : ScriptParsedNotificationBuilder<STATE>& setSourceMapURL(const String& value)
839 : {
840 : m_result->setSourceMapURL(value);
841 : return *this;
842 : }
843 :
844 : ScriptParsedNotificationBuilder<STATE>& setHasSourceURL(bool value)
845 : {
846 : m_result->setHasSourceURL(value);
847 : return *this;
848 : }
849 :
850 : ScriptParsedNotificationBuilder<STATE>& setIsModule(bool value)
851 : {
852 : m_result->setIsModule(value);
853 : return *this;
854 : }
855 :
856 : ScriptParsedNotificationBuilder<STATE>& setLength(int value)
857 : {
858 : m_result->setLength(value);
859 : return *this;
860 : }
861 :
862 : ScriptParsedNotificationBuilder<STATE>& setStackTrace(std::unique_ptr<protocol::Runtime::StackTrace> value)
863 : {
864 : m_result->setStackTrace(std::move(value));
865 : return *this;
866 : }
867 :
868 : std::unique_ptr<ScriptParsedNotification> build()
869 : {
870 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
871 : return std::move(m_result);
872 : }
873 :
874 : private:
875 : friend class ScriptParsedNotification;
876 51676 : ScriptParsedNotificationBuilder() : m_result(new ScriptParsedNotification()) { }
877 :
878 : template<int STEP> ScriptParsedNotificationBuilder<STATE | STEP>& castState()
879 : {
880 : return *reinterpret_cast<ScriptParsedNotificationBuilder<STATE | STEP>*>(this);
881 : }
882 :
883 : std::unique_ptr<protocol::Debugger::ScriptParsedNotification> m_result;
884 : };
885 :
886 : static ScriptParsedNotificationBuilder<0> create()
887 : {
888 25838 : return ScriptParsedNotificationBuilder<0>();
889 : }
890 :
891 : private:
892 25838 : ScriptParsedNotification()
893 25838 : {
894 25838 : m_startLine = 0;
895 25838 : m_startColumn = 0;
896 25838 : m_endLine = 0;
897 25838 : m_endColumn = 0;
898 25838 : m_executionContextId = 0;
899 25838 : }
900 :
901 : String m_scriptId;
902 : String m_url;
903 : int m_startLine;
904 : int m_startColumn;
905 : int m_endLine;
906 : int m_endColumn;
907 : int m_executionContextId;
908 : String m_hash;
909 : Maybe<protocol::DictionaryValue> m_executionContextAuxData;
910 : Maybe<bool> m_isLiveEdit;
911 : Maybe<String> m_sourceMapURL;
912 : Maybe<bool> m_hasSourceURL;
913 : Maybe<bool> m_isModule;
914 : Maybe<int> m_length;
915 : Maybe<protocol::Runtime::StackTrace> m_stackTrace;
916 : };
917 :
918 :
919 : // Wrapper for notification params
920 : class ScriptFailedToParseNotification : public Serializable{
921 : PROTOCOL_DISALLOW_COPY(ScriptFailedToParseNotification);
922 : public:
923 : static std::unique_ptr<ScriptFailedToParseNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
924 :
925 396 : ~ScriptFailedToParseNotification() override { }
926 :
927 : String getScriptId() { return m_scriptId; }
928 132 : void setScriptId(const String& value) { m_scriptId = value; }
929 :
930 : String getUrl() { return m_url; }
931 132 : void setUrl(const String& value) { m_url = value; }
932 :
933 : int getStartLine() { return m_startLine; }
934 132 : void setStartLine(int value) { m_startLine = value; }
935 :
936 : int getStartColumn() { return m_startColumn; }
937 132 : void setStartColumn(int value) { m_startColumn = value; }
938 :
939 : int getEndLine() { return m_endLine; }
940 132 : void setEndLine(int value) { m_endLine = value; }
941 :
942 : int getEndColumn() { return m_endColumn; }
943 132 : void setEndColumn(int value) { m_endColumn = value; }
944 :
945 : int getExecutionContextId() { return m_executionContextId; }
946 132 : void setExecutionContextId(int value) { m_executionContextId = value; }
947 :
948 : String getHash() { return m_hash; }
949 132 : void setHash(const String& value) { m_hash = value; }
950 :
951 : bool hasExecutionContextAuxData() { return m_executionContextAuxData.isJust(); }
952 : protocol::DictionaryValue* getExecutionContextAuxData(protocol::DictionaryValue* defaultValue) { return m_executionContextAuxData.isJust() ? m_executionContextAuxData.fromJust() : defaultValue; }
953 : void setExecutionContextAuxData(std::unique_ptr<protocol::DictionaryValue> value) { m_executionContextAuxData = std::move(value); }
954 :
955 : bool hasSourceMapURL() { return m_sourceMapURL.isJust(); }
956 : String getSourceMapURL(const String& defaultValue) { return m_sourceMapURL.isJust() ? m_sourceMapURL.fromJust() : defaultValue; }
957 264 : void setSourceMapURL(const String& value) { m_sourceMapURL = value; }
958 :
959 : bool hasHasSourceURL() { return m_hasSourceURL.isJust(); }
960 : bool getHasSourceURL(bool defaultValue) { return m_hasSourceURL.isJust() ? m_hasSourceURL.fromJust() : defaultValue; }
961 : void setHasSourceURL(bool value) { m_hasSourceURL = value; }
962 :
963 : bool hasIsModule() { return m_isModule.isJust(); }
964 : bool getIsModule(bool defaultValue) { return m_isModule.isJust() ? m_isModule.fromJust() : defaultValue; }
965 : void setIsModule(bool value) { m_isModule = value; }
966 :
967 : bool hasLength() { return m_length.isJust(); }
968 : int getLength(int defaultValue) { return m_length.isJust() ? m_length.fromJust() : defaultValue; }
969 : void setLength(int value) { m_length = value; }
970 :
971 : bool hasStackTrace() { return m_stackTrace.isJust(); }
972 : protocol::Runtime::StackTrace* getStackTrace(protocol::Runtime::StackTrace* defaultValue) { return m_stackTrace.isJust() ? m_stackTrace.fromJust() : defaultValue; }
973 : void setStackTrace(std::unique_ptr<protocol::Runtime::StackTrace> value) { m_stackTrace = std::move(value); }
974 :
975 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
976 396 : String serialize() override { return toValue()->serialize(); }
977 : std::unique_ptr<ScriptFailedToParseNotification> clone() const;
978 :
979 : template<int STATE>
980 : class ScriptFailedToParseNotificationBuilder {
981 : public:
982 : enum {
983 : NoFieldsSet = 0,
984 : ScriptIdSet = 1 << 1,
985 : UrlSet = 1 << 2,
986 : StartLineSet = 1 << 3,
987 : StartColumnSet = 1 << 4,
988 : EndLineSet = 1 << 5,
989 : EndColumnSet = 1 << 6,
990 : ExecutionContextIdSet = 1 << 7,
991 : HashSet = 1 << 8,
992 : AllFieldsSet = (ScriptIdSet | UrlSet | StartLineSet | StartColumnSet | EndLineSet | EndColumnSet | ExecutionContextIdSet | HashSet | 0)};
993 :
994 :
995 : ScriptFailedToParseNotificationBuilder<STATE | ScriptIdSet>& setScriptId(const String& value)
996 : {
997 : static_assert(!(STATE & ScriptIdSet), "property scriptId should not be set yet");
998 : m_result->setScriptId(value);
999 : return castState<ScriptIdSet>();
1000 : }
1001 :
1002 : ScriptFailedToParseNotificationBuilder<STATE | UrlSet>& setUrl(const String& value)
1003 : {
1004 : static_assert(!(STATE & UrlSet), "property url should not be set yet");
1005 : m_result->setUrl(value);
1006 : return castState<UrlSet>();
1007 : }
1008 :
1009 : ScriptFailedToParseNotificationBuilder<STATE | StartLineSet>& setStartLine(int value)
1010 : {
1011 : static_assert(!(STATE & StartLineSet), "property startLine should not be set yet");
1012 : m_result->setStartLine(value);
1013 : return castState<StartLineSet>();
1014 : }
1015 :
1016 : ScriptFailedToParseNotificationBuilder<STATE | StartColumnSet>& setStartColumn(int value)
1017 : {
1018 : static_assert(!(STATE & StartColumnSet), "property startColumn should not be set yet");
1019 : m_result->setStartColumn(value);
1020 : return castState<StartColumnSet>();
1021 : }
1022 :
1023 : ScriptFailedToParseNotificationBuilder<STATE | EndLineSet>& setEndLine(int value)
1024 : {
1025 : static_assert(!(STATE & EndLineSet), "property endLine should not be set yet");
1026 : m_result->setEndLine(value);
1027 : return castState<EndLineSet>();
1028 : }
1029 :
1030 : ScriptFailedToParseNotificationBuilder<STATE | EndColumnSet>& setEndColumn(int value)
1031 : {
1032 : static_assert(!(STATE & EndColumnSet), "property endColumn should not be set yet");
1033 : m_result->setEndColumn(value);
1034 : return castState<EndColumnSet>();
1035 : }
1036 :
1037 : ScriptFailedToParseNotificationBuilder<STATE | ExecutionContextIdSet>& setExecutionContextId(int value)
1038 : {
1039 : static_assert(!(STATE & ExecutionContextIdSet), "property executionContextId should not be set yet");
1040 : m_result->setExecutionContextId(value);
1041 : return castState<ExecutionContextIdSet>();
1042 : }
1043 :
1044 : ScriptFailedToParseNotificationBuilder<STATE | HashSet>& setHash(const String& value)
1045 : {
1046 : static_assert(!(STATE & HashSet), "property hash should not be set yet");
1047 : m_result->setHash(value);
1048 : return castState<HashSet>();
1049 : }
1050 :
1051 : ScriptFailedToParseNotificationBuilder<STATE>& setExecutionContextAuxData(std::unique_ptr<protocol::DictionaryValue> value)
1052 : {
1053 : m_result->setExecutionContextAuxData(std::move(value));
1054 : return *this;
1055 : }
1056 :
1057 : ScriptFailedToParseNotificationBuilder<STATE>& setSourceMapURL(const String& value)
1058 : {
1059 : m_result->setSourceMapURL(value);
1060 : return *this;
1061 : }
1062 :
1063 : ScriptFailedToParseNotificationBuilder<STATE>& setHasSourceURL(bool value)
1064 : {
1065 : m_result->setHasSourceURL(value);
1066 : return *this;
1067 : }
1068 :
1069 : ScriptFailedToParseNotificationBuilder<STATE>& setIsModule(bool value)
1070 : {
1071 : m_result->setIsModule(value);
1072 : return *this;
1073 : }
1074 :
1075 : ScriptFailedToParseNotificationBuilder<STATE>& setLength(int value)
1076 : {
1077 : m_result->setLength(value);
1078 : return *this;
1079 : }
1080 :
1081 : ScriptFailedToParseNotificationBuilder<STATE>& setStackTrace(std::unique_ptr<protocol::Runtime::StackTrace> value)
1082 : {
1083 : m_result->setStackTrace(std::move(value));
1084 : return *this;
1085 : }
1086 :
1087 : std::unique_ptr<ScriptFailedToParseNotification> build()
1088 : {
1089 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
1090 : return std::move(m_result);
1091 : }
1092 :
1093 : private:
1094 : friend class ScriptFailedToParseNotification;
1095 264 : ScriptFailedToParseNotificationBuilder() : m_result(new ScriptFailedToParseNotification()) { }
1096 :
1097 : template<int STEP> ScriptFailedToParseNotificationBuilder<STATE | STEP>& castState()
1098 : {
1099 : return *reinterpret_cast<ScriptFailedToParseNotificationBuilder<STATE | STEP>*>(this);
1100 : }
1101 :
1102 : std::unique_ptr<protocol::Debugger::ScriptFailedToParseNotification> m_result;
1103 : };
1104 :
1105 : static ScriptFailedToParseNotificationBuilder<0> create()
1106 : {
1107 132 : return ScriptFailedToParseNotificationBuilder<0>();
1108 : }
1109 :
1110 : private:
1111 132 : ScriptFailedToParseNotification()
1112 132 : {
1113 132 : m_startLine = 0;
1114 132 : m_startColumn = 0;
1115 132 : m_endLine = 0;
1116 132 : m_endColumn = 0;
1117 132 : m_executionContextId = 0;
1118 132 : }
1119 :
1120 : String m_scriptId;
1121 : String m_url;
1122 : int m_startLine;
1123 : int m_startColumn;
1124 : int m_endLine;
1125 : int m_endColumn;
1126 : int m_executionContextId;
1127 : String m_hash;
1128 : Maybe<protocol::DictionaryValue> m_executionContextAuxData;
1129 : Maybe<String> m_sourceMapURL;
1130 : Maybe<bool> m_hasSourceURL;
1131 : Maybe<bool> m_isModule;
1132 : Maybe<int> m_length;
1133 : Maybe<protocol::Runtime::StackTrace> m_stackTrace;
1134 : };
1135 :
1136 :
1137 : // Wrapper for notification params
1138 : class BreakpointResolvedNotification : public Serializable{
1139 : PROTOCOL_DISALLOW_COPY(BreakpointResolvedNotification);
1140 : public:
1141 : static std::unique_ptr<BreakpointResolvedNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
1142 :
1143 135 : ~BreakpointResolvedNotification() override { }
1144 :
1145 : String getBreakpointId() { return m_breakpointId; }
1146 45 : void setBreakpointId(const String& value) { m_breakpointId = value; }
1147 :
1148 : protocol::Debugger::Location* getLocation() { return m_location.get(); }
1149 : void setLocation(std::unique_ptr<protocol::Debugger::Location> value) { m_location = std::move(value); }
1150 :
1151 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
1152 135 : String serialize() override { return toValue()->serialize(); }
1153 : std::unique_ptr<BreakpointResolvedNotification> clone() const;
1154 :
1155 : template<int STATE>
1156 : class BreakpointResolvedNotificationBuilder {
1157 : public:
1158 : enum {
1159 : NoFieldsSet = 0,
1160 : BreakpointIdSet = 1 << 1,
1161 : LocationSet = 1 << 2,
1162 : AllFieldsSet = (BreakpointIdSet | LocationSet | 0)};
1163 :
1164 :
1165 : BreakpointResolvedNotificationBuilder<STATE | BreakpointIdSet>& setBreakpointId(const String& value)
1166 : {
1167 : static_assert(!(STATE & BreakpointIdSet), "property breakpointId should not be set yet");
1168 : m_result->setBreakpointId(value);
1169 : return castState<BreakpointIdSet>();
1170 : }
1171 :
1172 : BreakpointResolvedNotificationBuilder<STATE | LocationSet>& setLocation(std::unique_ptr<protocol::Debugger::Location> value)
1173 : {
1174 : static_assert(!(STATE & LocationSet), "property location should not be set yet");
1175 : m_result->setLocation(std::move(value));
1176 : return castState<LocationSet>();
1177 : }
1178 :
1179 : std::unique_ptr<BreakpointResolvedNotification> build()
1180 : {
1181 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
1182 : return std::move(m_result);
1183 : }
1184 :
1185 : private:
1186 : friend class BreakpointResolvedNotification;
1187 90 : BreakpointResolvedNotificationBuilder() : m_result(new BreakpointResolvedNotification()) { }
1188 :
1189 : template<int STEP> BreakpointResolvedNotificationBuilder<STATE | STEP>& castState()
1190 : {
1191 : return *reinterpret_cast<BreakpointResolvedNotificationBuilder<STATE | STEP>*>(this);
1192 : }
1193 :
1194 : std::unique_ptr<protocol::Debugger::BreakpointResolvedNotification> m_result;
1195 : };
1196 :
1197 : static BreakpointResolvedNotificationBuilder<0> create()
1198 : {
1199 45 : return BreakpointResolvedNotificationBuilder<0>();
1200 : }
1201 :
1202 : private:
1203 : BreakpointResolvedNotification()
1204 45 : {
1205 : }
1206 :
1207 : String m_breakpointId;
1208 : std::unique_ptr<protocol::Debugger::Location> m_location;
1209 : };
1210 :
1211 :
1212 : // Wrapper for notification params
1213 : class PausedNotification : public Serializable{
1214 : PROTOCOL_DISALLOW_COPY(PausedNotification);
1215 : public:
1216 : static std::unique_ptr<PausedNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
1217 :
1218 149460 : ~PausedNotification() override { }
1219 :
1220 : protocol::Array<protocol::Debugger::CallFrame>* getCallFrames() { return m_callFrames.get(); }
1221 : void setCallFrames(std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>> value) { m_callFrames = std::move(value); }
1222 :
1223 : struct ReasonEnum {
1224 : static const char* XHR;
1225 : static const char* DOM;
1226 : static const char* EventListener;
1227 : static const char* Exception;
1228 : static const char* Assert;
1229 : static const char* DebugCommand;
1230 : static const char* PromiseRejection;
1231 : static const char* OOM;
1232 : static const char* Other;
1233 : static const char* Ambiguous;
1234 : }; // ReasonEnum
1235 :
1236 : String getReason() { return m_reason; }
1237 49820 : void setReason(const String& value) { m_reason = value; }
1238 :
1239 : bool hasData() { return m_data.isJust(); }
1240 : protocol::DictionaryValue* getData(protocol::DictionaryValue* defaultValue) { return m_data.isJust() ? m_data.fromJust() : defaultValue; }
1241 : void setData(std::unique_ptr<protocol::DictionaryValue> value) { m_data = std::move(value); }
1242 :
1243 : bool hasHitBreakpoints() { return m_hitBreakpoints.isJust(); }
1244 : protocol::Array<String>* getHitBreakpoints(protocol::Array<String>* defaultValue) { return m_hitBreakpoints.isJust() ? m_hitBreakpoints.fromJust() : defaultValue; }
1245 : void setHitBreakpoints(std::unique_ptr<protocol::Array<String>> value) { m_hitBreakpoints = std::move(value); }
1246 :
1247 : bool hasAsyncStackTrace() { return m_asyncStackTrace.isJust(); }
1248 : protocol::Runtime::StackTrace* getAsyncStackTrace(protocol::Runtime::StackTrace* defaultValue) { return m_asyncStackTrace.isJust() ? m_asyncStackTrace.fromJust() : defaultValue; }
1249 : void setAsyncStackTrace(std::unique_ptr<protocol::Runtime::StackTrace> value) { m_asyncStackTrace = std::move(value); }
1250 :
1251 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
1252 149460 : String serialize() override { return toValue()->serialize(); }
1253 : std::unique_ptr<PausedNotification> clone() const;
1254 :
1255 : template<int STATE>
1256 : class PausedNotificationBuilder {
1257 : public:
1258 : enum {
1259 : NoFieldsSet = 0,
1260 : CallFramesSet = 1 << 1,
1261 : ReasonSet = 1 << 2,
1262 : AllFieldsSet = (CallFramesSet | ReasonSet | 0)};
1263 :
1264 :
1265 : PausedNotificationBuilder<STATE | CallFramesSet>& setCallFrames(std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>> value)
1266 : {
1267 : static_assert(!(STATE & CallFramesSet), "property callFrames should not be set yet");
1268 : m_result->setCallFrames(std::move(value));
1269 : return castState<CallFramesSet>();
1270 : }
1271 :
1272 : PausedNotificationBuilder<STATE | ReasonSet>& setReason(const String& value)
1273 : {
1274 : static_assert(!(STATE & ReasonSet), "property reason should not be set yet");
1275 : m_result->setReason(value);
1276 : return castState<ReasonSet>();
1277 : }
1278 :
1279 : PausedNotificationBuilder<STATE>& setData(std::unique_ptr<protocol::DictionaryValue> value)
1280 : {
1281 : m_result->setData(std::move(value));
1282 : return *this;
1283 : }
1284 :
1285 : PausedNotificationBuilder<STATE>& setHitBreakpoints(std::unique_ptr<protocol::Array<String>> value)
1286 : {
1287 : m_result->setHitBreakpoints(std::move(value));
1288 : return *this;
1289 : }
1290 :
1291 : PausedNotificationBuilder<STATE>& setAsyncStackTrace(std::unique_ptr<protocol::Runtime::StackTrace> value)
1292 : {
1293 : m_result->setAsyncStackTrace(std::move(value));
1294 : return *this;
1295 : }
1296 :
1297 : std::unique_ptr<PausedNotification> build()
1298 : {
1299 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
1300 : return std::move(m_result);
1301 : }
1302 :
1303 : private:
1304 : friend class PausedNotification;
1305 99640 : PausedNotificationBuilder() : m_result(new PausedNotification()) { }
1306 :
1307 : template<int STEP> PausedNotificationBuilder<STATE | STEP>& castState()
1308 : {
1309 : return *reinterpret_cast<PausedNotificationBuilder<STATE | STEP>*>(this);
1310 : }
1311 :
1312 : std::unique_ptr<protocol::Debugger::PausedNotification> m_result;
1313 : };
1314 :
1315 : static PausedNotificationBuilder<0> create()
1316 : {
1317 49820 : return PausedNotificationBuilder<0>();
1318 : }
1319 :
1320 : private:
1321 : PausedNotification()
1322 49820 : {
1323 : }
1324 :
1325 : std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>> m_callFrames;
1326 : String m_reason;
1327 : Maybe<protocol::DictionaryValue> m_data;
1328 : Maybe<protocol::Array<String>> m_hitBreakpoints;
1329 : Maybe<protocol::Runtime::StackTrace> m_asyncStackTrace;
1330 : };
1331 :
1332 :
1333 : // ------------- Backend interface.
1334 :
1335 3406 : class Backend {
1336 : public:
1337 3406 : virtual ~Backend() { }
1338 :
1339 : virtual DispatchResponse enable() = 0;
1340 : virtual DispatchResponse disable() = 0;
1341 : virtual DispatchResponse setBreakpointsActive(bool in_active) = 0;
1342 : virtual DispatchResponse setSkipAllPauses(bool in_skip) = 0;
1343 : virtual DispatchResponse setBreakpointByUrl(int in_lineNumber, Maybe<String> in_url, Maybe<String> in_urlRegex, Maybe<String> in_scriptHash, Maybe<int> in_columnNumber, Maybe<String> in_condition, String* out_breakpointId, std::unique_ptr<protocol::Array<protocol::Debugger::Location>>* out_locations) = 0;
1344 : virtual DispatchResponse setBreakpoint(std::unique_ptr<protocol::Debugger::Location> in_location, Maybe<String> in_condition, String* out_breakpointId, std::unique_ptr<protocol::Debugger::Location>* out_actualLocation) = 0;
1345 : virtual DispatchResponse removeBreakpoint(const String& in_breakpointId) = 0;
1346 : virtual DispatchResponse getPossibleBreakpoints(std::unique_ptr<protocol::Debugger::Location> in_start, Maybe<protocol::Debugger::Location> in_end, Maybe<bool> in_restrictToFunction, std::unique_ptr<protocol::Array<protocol::Debugger::BreakLocation>>* out_locations) = 0;
1347 : virtual DispatchResponse continueToLocation(std::unique_ptr<protocol::Debugger::Location> in_location, Maybe<String> in_targetCallFrames) = 0;
1348 : virtual DispatchResponse stepOver() = 0;
1349 : virtual DispatchResponse stepInto() = 0;
1350 : virtual DispatchResponse stepOut() = 0;
1351 : virtual DispatchResponse pause() = 0;
1352 75 : class ScheduleStepIntoAsyncCallback {
1353 : public:
1354 : virtual void sendSuccess() = 0;
1355 : virtual void sendFailure(const DispatchResponse&) = 0;
1356 : virtual void fallThrough() = 0;
1357 75 : virtual ~ScheduleStepIntoAsyncCallback() { }
1358 : };
1359 : virtual void scheduleStepIntoAsync(std::unique_ptr<ScheduleStepIntoAsyncCallback> callback) = 0;
1360 : virtual DispatchResponse resume() = 0;
1361 : virtual DispatchResponse searchInContent(const String& in_scriptId, const String& in_query, Maybe<bool> in_caseSensitive, Maybe<bool> in_isRegex, std::unique_ptr<protocol::Array<protocol::Debugger::SearchMatch>>* out_result) = 0;
1362 : virtual DispatchResponse setScriptSource(const String& in_scriptId, const String& in_scriptSource, Maybe<bool> in_dryRun, Maybe<protocol::Array<protocol::Debugger::CallFrame>>* out_callFrames, Maybe<bool>* out_stackChanged, Maybe<protocol::Runtime::StackTrace>* out_asyncStackTrace, Maybe<protocol::Runtime::ExceptionDetails>* out_exceptionDetails) = 0;
1363 : virtual DispatchResponse restartFrame(const String& in_callFrameId, std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>>* out_callFrames, Maybe<protocol::Runtime::StackTrace>* out_asyncStackTrace) = 0;
1364 : virtual DispatchResponse getScriptSource(const String& in_scriptId, String* out_scriptSource) = 0;
1365 : virtual DispatchResponse setPauseOnExceptions(const String& in_state) = 0;
1366 : virtual DispatchResponse evaluateOnCallFrame(const String& in_callFrameId, const String& in_expression, Maybe<String> in_objectGroup, Maybe<bool> in_includeCommandLineAPI, Maybe<bool> in_silent, Maybe<bool> in_returnByValue, Maybe<bool> in_generatePreview, Maybe<bool> in_throwOnSideEffect, std::unique_ptr<protocol::Runtime::RemoteObject>* out_result, Maybe<protocol::Runtime::ExceptionDetails>* out_exceptionDetails) = 0;
1367 : virtual DispatchResponse setVariableValue(int in_scopeNumber, const String& in_variableName, std::unique_ptr<protocol::Runtime::CallArgument> in_newValue, const String& in_callFrameId) = 0;
1368 : virtual DispatchResponse setAsyncCallStackDepth(int in_maxDepth) = 0;
1369 : virtual DispatchResponse setBlackboxPatterns(std::unique_ptr<protocol::Array<String>> in_patterns) = 0;
1370 : virtual DispatchResponse setBlackboxedRanges(const String& in_scriptId, std::unique_ptr<protocol::Array<protocol::Debugger::ScriptPosition>> in_positions) = 0;
1371 :
1372 : };
1373 :
1374 : // ------------- Frontend interface.
1375 :
1376 : class Frontend {
1377 : public:
1378 3406 : explicit Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { }
1379 : void scriptParsed(const String& scriptId, const String& url, int startLine, int startColumn, int endLine, int endColumn, int executionContextId, const String& hash, Maybe<protocol::DictionaryValue> executionContextAuxData = Maybe<protocol::DictionaryValue>(), Maybe<bool> isLiveEdit = Maybe<bool>(), Maybe<String> sourceMapURL = Maybe<String>(), Maybe<bool> hasSourceURL = Maybe<bool>(), Maybe<bool> isModule = Maybe<bool>(), Maybe<int> length = Maybe<int>(), Maybe<protocol::Runtime::StackTrace> stackTrace = Maybe<protocol::Runtime::StackTrace>());
1380 : void scriptFailedToParse(const String& scriptId, const String& url, int startLine, int startColumn, int endLine, int endColumn, int executionContextId, const String& hash, Maybe<protocol::DictionaryValue> executionContextAuxData = Maybe<protocol::DictionaryValue>(), Maybe<String> sourceMapURL = Maybe<String>(), Maybe<bool> hasSourceURL = Maybe<bool>(), Maybe<bool> isModule = Maybe<bool>(), Maybe<int> length = Maybe<int>(), Maybe<protocol::Runtime::StackTrace> stackTrace = Maybe<protocol::Runtime::StackTrace>());
1381 : void breakpointResolved(const String& breakpointId, std::unique_ptr<protocol::Debugger::Location> location);
1382 : void paused(std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>> callFrames, const String& reason, Maybe<protocol::DictionaryValue> data = Maybe<protocol::DictionaryValue>(), Maybe<protocol::Array<String>> hitBreakpoints = Maybe<protocol::Array<String>>(), Maybe<protocol::Runtime::StackTrace> asyncStackTrace = Maybe<protocol::Runtime::StackTrace>());
1383 : void resumed();
1384 :
1385 : void flush();
1386 : void sendRawNotification(const String&);
1387 : private:
1388 : FrontendChannel* m_frontendChannel;
1389 : };
1390 :
1391 : // ------------- Dispatcher.
1392 :
1393 : class Dispatcher {
1394 : public:
1395 : static void wire(UberDispatcher*, Backend*);
1396 :
1397 : private:
1398 : Dispatcher() { }
1399 : };
1400 :
1401 : // ------------- Metainfo.
1402 :
1403 : class Metainfo {
1404 : public:
1405 : using BackendClass = Backend;
1406 : using FrontendClass = Frontend;
1407 : using DispatcherClass = Dispatcher;
1408 : static const char domainName[];
1409 : static const char commandPrefix[];
1410 : static const char version[];
1411 : };
1412 :
1413 : } // namespace Debugger
1414 : } // namespace v8_inspector
1415 : } // namespace protocol
1416 :
1417 : #endif // !defined(v8_inspector_protocol_Debugger_h)
|