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