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_Runtime_h
8 : #define v8_inspector_protocol_Runtime_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 "include/inspector/Runtime.h"
14 :
15 : namespace v8_inspector {
16 : namespace protocol {
17 : namespace Runtime {
18 :
19 : // ------------- Forward and enum declarations.
20 : // Unique script identifier.
21 : using ScriptId = String;
22 : // Unique object identifier.
23 : using RemoteObjectId = String;
24 : // Primitive value which cannot be JSON-stringified.
25 : using UnserializableValue = String;
26 : // Mirror object referencing original JavaScript object.
27 : class RemoteObject;
28 : //
29 : class CustomPreview;
30 : // Object containing abbreviated remote object value.
31 : class ObjectPreview;
32 : //
33 : class PropertyPreview;
34 : //
35 : class EntryPreview;
36 : // Object property descriptor.
37 : class PropertyDescriptor;
38 : // Object internal property descriptor. This property isn't normally visible in JavaScript code.
39 : class InternalPropertyDescriptor;
40 : // Represents function call argument. Either remote object id <code>objectId</code>, primitive <code>value</code>, unserializable primitive value or neither of (for undefined) them should be specified.
41 : class CallArgument;
42 : // Id of an execution context.
43 : using ExecutionContextId = int;
44 : // Description of an isolated world.
45 : class ExecutionContextDescription;
46 : // Detailed information about exception (or error) that was thrown during script compilation or execution.
47 : class ExceptionDetails;
48 : // Number of milliseconds since epoch.
49 : using Timestamp = double;
50 : // Stack entry for runtime errors and assertions.
51 : class CallFrame;
52 : // Call frames for assertions or error messages.
53 : class StackTrace;
54 : // Wrapper for notification params
55 : class ExecutionContextCreatedNotification;
56 : // Wrapper for notification params
57 : class ExecutionContextDestroyedNotification;
58 : // Wrapper for notification params
59 : using ExecutionContextsClearedNotification = Object;
60 : // Wrapper for notification params
61 : class ExceptionThrownNotification;
62 : // Wrapper for notification params
63 : class ExceptionRevokedNotification;
64 : // Wrapper for notification params
65 : class ConsoleAPICalledNotification;
66 : // Wrapper for notification params
67 : class InspectRequestedNotification;
68 :
69 : namespace UnserializableValueEnum {
70 : extern const char* Infinity;
71 : extern const char* NaN;
72 : extern const char* NegativeInfinity;
73 : extern const char* Negative0;
74 : } // namespace UnserializableValueEnum
75 :
76 : namespace ConsoleAPICalled {
77 : namespace TypeEnum {
78 : extern const char* Log;
79 : extern const char* Debug;
80 : extern const char* Info;
81 : extern const char* Error;
82 : extern const char* Warning;
83 : extern const char* Dir;
84 : extern const char* Dirxml;
85 : extern const char* Table;
86 : extern const char* Trace;
87 : extern const char* Clear;
88 : extern const char* StartGroup;
89 : extern const char* StartGroupCollapsed;
90 : extern const char* EndGroup;
91 : extern const char* Assert;
92 : extern const char* Profile;
93 : extern const char* ProfileEnd;
94 : extern const char* Count;
95 : extern const char* TimeEnd;
96 : } // TypeEnum
97 : } // ConsoleAPICalled
98 :
99 : // ------------- Type and builder declarations.
100 :
101 : // Mirror object referencing original JavaScript object.
102 : class RemoteObject : public Serializable, public API::RemoteObject{
103 : PROTOCOL_DISALLOW_COPY(RemoteObject);
104 : public:
105 : static std::unique_ptr<RemoteObject> fromValue(protocol::Value* value, ErrorSupport* errors);
106 :
107 12676782 : ~RemoteObject() override { }
108 :
109 : struct TypeEnum {
110 : static const char* Object;
111 : static const char* Function;
112 : static const char* Undefined;
113 : static const char* String;
114 : static const char* Number;
115 : static const char* Boolean;
116 : static const char* Symbol;
117 : }; // TypeEnum
118 :
119 : String getType() { return m_type; }
120 : void setType(const String& value) { m_type = value; }
121 :
122 : struct SubtypeEnum {
123 : static const char* Array;
124 : static const char* Null;
125 : static const char* Node;
126 : static const char* Regexp;
127 : static const char* Date;
128 : static const char* Map;
129 : static const char* Set;
130 : static const char* Weakmap;
131 : static const char* Weakset;
132 : static const char* Iterator;
133 : static const char* Generator;
134 : static const char* Error;
135 : static const char* Proxy;
136 : static const char* Promise;
137 : static const char* Typedarray;
138 : }; // SubtypeEnum
139 :
140 : bool hasSubtype() { return m_subtype.isJust(); }
141 : String getSubtype(const String& defaultValue) { return m_subtype.isJust() ? m_subtype.fromJust() : defaultValue; }
142 : void setSubtype(const String& value) { m_subtype = value; }
143 :
144 : bool hasClassName() { return m_className.isJust(); }
145 : String getClassName(const String& defaultValue) { return m_className.isJust() ? m_className.fromJust() : defaultValue; }
146 : void setClassName(const String& value) { m_className = value; }
147 :
148 : bool hasValue() { return m_value.isJust(); }
149 : protocol::Value* getValue(protocol::Value* defaultValue) { return m_value.isJust() ? m_value.fromJust() : defaultValue; }
150 : void setValue(std::unique_ptr<protocol::Value> value) { m_value = std::move(value); }
151 :
152 : bool hasUnserializableValue() { return m_unserializableValue.isJust(); }
153 : String getUnserializableValue(const String& defaultValue) { return m_unserializableValue.isJust() ? m_unserializableValue.fromJust() : defaultValue; }
154 : void setUnserializableValue(const String& value) { m_unserializableValue = value; }
155 :
156 : bool hasDescription() { return m_description.isJust(); }
157 : String getDescription(const String& defaultValue) { return m_description.isJust() ? m_description.fromJust() : defaultValue; }
158 : void setDescription(const String& value) { m_description = value; }
159 :
160 : bool hasObjectId() { return m_objectId.isJust(); }
161 : String getObjectId(const String& defaultValue) { return m_objectId.isJust() ? m_objectId.fromJust() : defaultValue; }
162 : void setObjectId(const String& value) { m_objectId = value; }
163 :
164 : bool hasPreview() { return m_preview.isJust(); }
165 : protocol::Runtime::ObjectPreview* getPreview(protocol::Runtime::ObjectPreview* defaultValue) { return m_preview.isJust() ? m_preview.fromJust() : defaultValue; }
166 : void setPreview(std::unique_ptr<protocol::Runtime::ObjectPreview> value) { m_preview = std::move(value); }
167 :
168 : bool hasCustomPreview() { return m_customPreview.isJust(); }
169 : protocol::Runtime::CustomPreview* getCustomPreview(protocol::Runtime::CustomPreview* defaultValue) { return m_customPreview.isJust() ? m_customPreview.fromJust() : defaultValue; }
170 : void setCustomPreview(std::unique_ptr<protocol::Runtime::CustomPreview> value) { m_customPreview = std::move(value); }
171 :
172 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
173 0 : String serialize() override { return toValue()->serialize(); }
174 : std::unique_ptr<RemoteObject> clone() const;
175 : std::unique_ptr<StringBuffer> toJSONString() const override;
176 :
177 : template<int STATE>
178 : class RemoteObjectBuilder {
179 : public:
180 : enum {
181 : NoFieldsSet = 0,
182 : TypeSet = 1 << 1,
183 : AllFieldsSet = (TypeSet | 0)};
184 :
185 :
186 : RemoteObjectBuilder<STATE | TypeSet>& setType(const String& value)
187 : {
188 : static_assert(!(STATE & TypeSet), "property type should not be set yet");
189 : m_result->setType(value);
190 : return castState<TypeSet>();
191 : }
192 :
193 : RemoteObjectBuilder<STATE>& setSubtype(const String& value)
194 : {
195 : m_result->setSubtype(value);
196 : return *this;
197 : }
198 :
199 : RemoteObjectBuilder<STATE>& setClassName(const String& value)
200 : {
201 : m_result->setClassName(value);
202 : return *this;
203 : }
204 :
205 : RemoteObjectBuilder<STATE>& setValue(std::unique_ptr<protocol::Value> value)
206 : {
207 : m_result->setValue(std::move(value));
208 : return *this;
209 : }
210 :
211 : RemoteObjectBuilder<STATE>& setUnserializableValue(const String& value)
212 : {
213 : m_result->setUnserializableValue(value);
214 : return *this;
215 : }
216 :
217 : RemoteObjectBuilder<STATE>& setDescription(const String& value)
218 : {
219 : m_result->setDescription(value);
220 : return *this;
221 : }
222 :
223 : RemoteObjectBuilder<STATE>& setObjectId(const String& value)
224 : {
225 : m_result->setObjectId(value);
226 : return *this;
227 : }
228 :
229 : RemoteObjectBuilder<STATE>& setPreview(std::unique_ptr<protocol::Runtime::ObjectPreview> value)
230 : {
231 : m_result->setPreview(std::move(value));
232 : return *this;
233 : }
234 :
235 : RemoteObjectBuilder<STATE>& setCustomPreview(std::unique_ptr<protocol::Runtime::CustomPreview> value)
236 : {
237 : m_result->setCustomPreview(std::move(value));
238 : return *this;
239 : }
240 :
241 : std::unique_ptr<RemoteObject> build()
242 : {
243 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
244 : return std::move(m_result);
245 : }
246 :
247 : private:
248 : friend class RemoteObject;
249 0 : RemoteObjectBuilder() : m_result(new RemoteObject()) { }
250 :
251 : template<int STEP> RemoteObjectBuilder<STATE | STEP>& castState()
252 : {
253 : return *reinterpret_cast<RemoteObjectBuilder<STATE | STEP>*>(this);
254 : }
255 :
256 : std::unique_ptr<protocol::Runtime::RemoteObject> m_result;
257 : };
258 :
259 : static RemoteObjectBuilder<0> create()
260 : {
261 0 : return RemoteObjectBuilder<0>();
262 : }
263 :
264 : private:
265 : RemoteObject()
266 4225594 : {
267 : }
268 :
269 : String m_type;
270 : Maybe<String> m_subtype;
271 : Maybe<String> m_className;
272 : Maybe<protocol::Value> m_value;
273 : Maybe<String> m_unserializableValue;
274 : Maybe<String> m_description;
275 : Maybe<String> m_objectId;
276 : Maybe<protocol::Runtime::ObjectPreview> m_preview;
277 : Maybe<protocol::Runtime::CustomPreview> m_customPreview;
278 : };
279 :
280 :
281 : //
282 : class CustomPreview : public Serializable{
283 : PROTOCOL_DISALLOW_COPY(CustomPreview);
284 : public:
285 : static std::unique_ptr<CustomPreview> fromValue(protocol::Value* value, ErrorSupport* errors);
286 :
287 18 : ~CustomPreview() override { }
288 :
289 : String getHeader() { return m_header; }
290 : void setHeader(const String& value) { m_header = value; }
291 :
292 : bool getHasBody() { return m_hasBody; }
293 : void setHasBody(bool value) { m_hasBody = value; }
294 :
295 : String getFormatterObjectId() { return m_formatterObjectId; }
296 : void setFormatterObjectId(const String& value) { m_formatterObjectId = value; }
297 :
298 : String getBindRemoteObjectFunctionId() { return m_bindRemoteObjectFunctionId; }
299 : void setBindRemoteObjectFunctionId(const String& value) { m_bindRemoteObjectFunctionId = value; }
300 :
301 : bool hasConfigObjectId() { return m_configObjectId.isJust(); }
302 : String getConfigObjectId(const String& defaultValue) { return m_configObjectId.isJust() ? m_configObjectId.fromJust() : defaultValue; }
303 : void setConfigObjectId(const String& value) { m_configObjectId = value; }
304 :
305 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
306 0 : String serialize() override { return toValue()->serialize(); }
307 : std::unique_ptr<CustomPreview> clone() const;
308 :
309 : template<int STATE>
310 : class CustomPreviewBuilder {
311 : public:
312 : enum {
313 : NoFieldsSet = 0,
314 : HeaderSet = 1 << 1,
315 : HasBodySet = 1 << 2,
316 : FormatterObjectIdSet = 1 << 3,
317 : BindRemoteObjectFunctionIdSet = 1 << 4,
318 : AllFieldsSet = (HeaderSet | HasBodySet | FormatterObjectIdSet | BindRemoteObjectFunctionIdSet | 0)};
319 :
320 :
321 : CustomPreviewBuilder<STATE | HeaderSet>& setHeader(const String& value)
322 : {
323 : static_assert(!(STATE & HeaderSet), "property header should not be set yet");
324 : m_result->setHeader(value);
325 : return castState<HeaderSet>();
326 : }
327 :
328 : CustomPreviewBuilder<STATE | HasBodySet>& setHasBody(bool value)
329 : {
330 : static_assert(!(STATE & HasBodySet), "property hasBody should not be set yet");
331 : m_result->setHasBody(value);
332 : return castState<HasBodySet>();
333 : }
334 :
335 : CustomPreviewBuilder<STATE | FormatterObjectIdSet>& setFormatterObjectId(const String& value)
336 : {
337 : static_assert(!(STATE & FormatterObjectIdSet), "property formatterObjectId should not be set yet");
338 : m_result->setFormatterObjectId(value);
339 : return castState<FormatterObjectIdSet>();
340 : }
341 :
342 : CustomPreviewBuilder<STATE | BindRemoteObjectFunctionIdSet>& setBindRemoteObjectFunctionId(const String& value)
343 : {
344 : static_assert(!(STATE & BindRemoteObjectFunctionIdSet), "property bindRemoteObjectFunctionId should not be set yet");
345 : m_result->setBindRemoteObjectFunctionId(value);
346 : return castState<BindRemoteObjectFunctionIdSet>();
347 : }
348 :
349 : CustomPreviewBuilder<STATE>& setConfigObjectId(const String& value)
350 : {
351 : m_result->setConfigObjectId(value);
352 : return *this;
353 : }
354 :
355 : std::unique_ptr<CustomPreview> build()
356 : {
357 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
358 : return std::move(m_result);
359 : }
360 :
361 : private:
362 : friend class CustomPreview;
363 : CustomPreviewBuilder() : m_result(new CustomPreview()) { }
364 :
365 : template<int STEP> CustomPreviewBuilder<STATE | STEP>& castState()
366 : {
367 : return *reinterpret_cast<CustomPreviewBuilder<STATE | STEP>*>(this);
368 : }
369 :
370 : std::unique_ptr<protocol::Runtime::CustomPreview> m_result;
371 : };
372 :
373 : static CustomPreviewBuilder<0> create()
374 : {
375 : return CustomPreviewBuilder<0>();
376 : }
377 :
378 : private:
379 : CustomPreview()
380 6 : {
381 6 : m_hasBody = false;
382 : }
383 :
384 : String m_header;
385 : bool m_hasBody;
386 : String m_formatterObjectId;
387 : String m_bindRemoteObjectFunctionId;
388 : Maybe<String> m_configObjectId;
389 : };
390 :
391 :
392 : // Object containing abbreviated remote object value.
393 : class ObjectPreview : public Serializable{
394 : PROTOCOL_DISALLOW_COPY(ObjectPreview);
395 : public:
396 : static std::unique_ptr<ObjectPreview> fromValue(protocol::Value* value, ErrorSupport* errors);
397 :
398 1440 : ~ObjectPreview() override { }
399 :
400 : struct TypeEnum {
401 : static const char* Object;
402 : static const char* Function;
403 : static const char* Undefined;
404 : static const char* String;
405 : static const char* Number;
406 : static const char* Boolean;
407 : static const char* Symbol;
408 : }; // TypeEnum
409 :
410 : String getType() { return m_type; }
411 : void setType(const String& value) { m_type = value; }
412 :
413 : struct SubtypeEnum {
414 : static const char* Array;
415 : static const char* Null;
416 : static const char* Node;
417 : static const char* Regexp;
418 : static const char* Date;
419 : static const char* Map;
420 : static const char* Set;
421 : static const char* Weakmap;
422 : static const char* Weakset;
423 : static const char* Iterator;
424 : static const char* Generator;
425 : static const char* Error;
426 : }; // SubtypeEnum
427 :
428 : bool hasSubtype() { return m_subtype.isJust(); }
429 : String getSubtype(const String& defaultValue) { return m_subtype.isJust() ? m_subtype.fromJust() : defaultValue; }
430 : void setSubtype(const String& value) { m_subtype = value; }
431 :
432 : bool hasDescription() { return m_description.isJust(); }
433 : String getDescription(const String& defaultValue) { return m_description.isJust() ? m_description.fromJust() : defaultValue; }
434 : void setDescription(const String& value) { m_description = value; }
435 :
436 : bool getOverflow() { return m_overflow; }
437 : void setOverflow(bool value) { m_overflow = value; }
438 :
439 : protocol::Array<protocol::Runtime::PropertyPreview>* getProperties() { return m_properties.get(); }
440 : void setProperties(std::unique_ptr<protocol::Array<protocol::Runtime::PropertyPreview>> value) { m_properties = std::move(value); }
441 :
442 : bool hasEntries() { return m_entries.isJust(); }
443 : protocol::Array<protocol::Runtime::EntryPreview>* getEntries(protocol::Array<protocol::Runtime::EntryPreview>* defaultValue) { return m_entries.isJust() ? m_entries.fromJust() : defaultValue; }
444 : void setEntries(std::unique_ptr<protocol::Array<protocol::Runtime::EntryPreview>> value) { m_entries = std::move(value); }
445 :
446 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
447 0 : String serialize() override { return toValue()->serialize(); }
448 : std::unique_ptr<ObjectPreview> clone() const;
449 :
450 : template<int STATE>
451 : class ObjectPreviewBuilder {
452 : public:
453 : enum {
454 : NoFieldsSet = 0,
455 : TypeSet = 1 << 1,
456 : OverflowSet = 1 << 2,
457 : PropertiesSet = 1 << 3,
458 : AllFieldsSet = (TypeSet | OverflowSet | PropertiesSet | 0)};
459 :
460 :
461 : ObjectPreviewBuilder<STATE | TypeSet>& setType(const String& value)
462 : {
463 : static_assert(!(STATE & TypeSet), "property type should not be set yet");
464 : m_result->setType(value);
465 : return castState<TypeSet>();
466 : }
467 :
468 : ObjectPreviewBuilder<STATE>& setSubtype(const String& value)
469 : {
470 : m_result->setSubtype(value);
471 : return *this;
472 : }
473 :
474 : ObjectPreviewBuilder<STATE>& setDescription(const String& value)
475 : {
476 : m_result->setDescription(value);
477 : return *this;
478 : }
479 :
480 : ObjectPreviewBuilder<STATE | OverflowSet>& setOverflow(bool value)
481 : {
482 : static_assert(!(STATE & OverflowSet), "property overflow should not be set yet");
483 : m_result->setOverflow(value);
484 : return castState<OverflowSet>();
485 : }
486 :
487 : ObjectPreviewBuilder<STATE | PropertiesSet>& setProperties(std::unique_ptr<protocol::Array<protocol::Runtime::PropertyPreview>> value)
488 : {
489 : static_assert(!(STATE & PropertiesSet), "property properties should not be set yet");
490 : m_result->setProperties(std::move(value));
491 : return castState<PropertiesSet>();
492 : }
493 :
494 : ObjectPreviewBuilder<STATE>& setEntries(std::unique_ptr<protocol::Array<protocol::Runtime::EntryPreview>> value)
495 : {
496 : m_result->setEntries(std::move(value));
497 : return *this;
498 : }
499 :
500 : std::unique_ptr<ObjectPreview> build()
501 : {
502 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
503 : return std::move(m_result);
504 : }
505 :
506 : private:
507 : friend class ObjectPreview;
508 : ObjectPreviewBuilder() : m_result(new ObjectPreview()) { }
509 :
510 : template<int STEP> ObjectPreviewBuilder<STATE | STEP>& castState()
511 : {
512 : return *reinterpret_cast<ObjectPreviewBuilder<STATE | STEP>*>(this);
513 : }
514 :
515 : std::unique_ptr<protocol::Runtime::ObjectPreview> m_result;
516 : };
517 :
518 : static ObjectPreviewBuilder<0> create()
519 : {
520 : return ObjectPreviewBuilder<0>();
521 : }
522 :
523 : private:
524 : ObjectPreview()
525 960 : {
526 480 : m_overflow = false;
527 : }
528 :
529 : String m_type;
530 : Maybe<String> m_subtype;
531 : Maybe<String> m_description;
532 : bool m_overflow;
533 : std::unique_ptr<protocol::Array<protocol::Runtime::PropertyPreview>> m_properties;
534 : Maybe<protocol::Array<protocol::Runtime::EntryPreview>> m_entries;
535 : };
536 :
537 :
538 : //
539 : class PropertyPreview : public Serializable{
540 : PROTOCOL_DISALLOW_COPY(PropertyPreview);
541 : public:
542 : static std::unique_ptr<PropertyPreview> fromValue(protocol::Value* value, ErrorSupport* errors);
543 :
544 3276 : ~PropertyPreview() override { }
545 :
546 : String getName() { return m_name; }
547 : void setName(const String& value) { m_name = value; }
548 :
549 : struct TypeEnum {
550 : static const char* Object;
551 : static const char* Function;
552 : static const char* Undefined;
553 : static const char* String;
554 : static const char* Number;
555 : static const char* Boolean;
556 : static const char* Symbol;
557 : static const char* Accessor;
558 : }; // TypeEnum
559 :
560 : String getType() { return m_type; }
561 : void setType(const String& value) { m_type = value; }
562 :
563 : bool hasValue() { return m_value.isJust(); }
564 : String getValue(const String& defaultValue) { return m_value.isJust() ? m_value.fromJust() : defaultValue; }
565 : void setValue(const String& value) { m_value = value; }
566 :
567 : bool hasValuePreview() { return m_valuePreview.isJust(); }
568 : protocol::Runtime::ObjectPreview* getValuePreview(protocol::Runtime::ObjectPreview* defaultValue) { return m_valuePreview.isJust() ? m_valuePreview.fromJust() : defaultValue; }
569 : void setValuePreview(std::unique_ptr<protocol::Runtime::ObjectPreview> value) { m_valuePreview = std::move(value); }
570 :
571 : struct SubtypeEnum {
572 : static const char* Array;
573 : static const char* Null;
574 : static const char* Node;
575 : static const char* Regexp;
576 : static const char* Date;
577 : static const char* Map;
578 : static const char* Set;
579 : static const char* Weakmap;
580 : static const char* Weakset;
581 : static const char* Iterator;
582 : static const char* Generator;
583 : static const char* Error;
584 : }; // SubtypeEnum
585 :
586 : bool hasSubtype() { return m_subtype.isJust(); }
587 : String getSubtype(const String& defaultValue) { return m_subtype.isJust() ? m_subtype.fromJust() : defaultValue; }
588 : void setSubtype(const String& value) { m_subtype = value; }
589 :
590 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
591 0 : String serialize() override { return toValue()->serialize(); }
592 : std::unique_ptr<PropertyPreview> clone() const;
593 :
594 : template<int STATE>
595 : class PropertyPreviewBuilder {
596 : public:
597 : enum {
598 : NoFieldsSet = 0,
599 : NameSet = 1 << 1,
600 : TypeSet = 1 << 2,
601 : AllFieldsSet = (NameSet | TypeSet | 0)};
602 :
603 :
604 : PropertyPreviewBuilder<STATE | NameSet>& setName(const String& value)
605 : {
606 : static_assert(!(STATE & NameSet), "property name should not be set yet");
607 : m_result->setName(value);
608 : return castState<NameSet>();
609 : }
610 :
611 : PropertyPreviewBuilder<STATE | TypeSet>& setType(const String& value)
612 : {
613 : static_assert(!(STATE & TypeSet), "property type should not be set yet");
614 : m_result->setType(value);
615 : return castState<TypeSet>();
616 : }
617 :
618 : PropertyPreviewBuilder<STATE>& setValue(const String& value)
619 : {
620 : m_result->setValue(value);
621 : return *this;
622 : }
623 :
624 : PropertyPreviewBuilder<STATE>& setValuePreview(std::unique_ptr<protocol::Runtime::ObjectPreview> value)
625 : {
626 : m_result->setValuePreview(std::move(value));
627 : return *this;
628 : }
629 :
630 : PropertyPreviewBuilder<STATE>& setSubtype(const String& value)
631 : {
632 : m_result->setSubtype(value);
633 : return *this;
634 : }
635 :
636 : std::unique_ptr<PropertyPreview> build()
637 : {
638 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
639 : return std::move(m_result);
640 : }
641 :
642 : private:
643 : friend class PropertyPreview;
644 : PropertyPreviewBuilder() : m_result(new PropertyPreview()) { }
645 :
646 : template<int STEP> PropertyPreviewBuilder<STATE | STEP>& castState()
647 : {
648 : return *reinterpret_cast<PropertyPreviewBuilder<STATE | STEP>*>(this);
649 : }
650 :
651 : std::unique_ptr<protocol::Runtime::PropertyPreview> m_result;
652 : };
653 :
654 : static PropertyPreviewBuilder<0> create()
655 : {
656 : return PropertyPreviewBuilder<0>();
657 : }
658 :
659 : private:
660 : PropertyPreview()
661 1092 : {
662 : }
663 :
664 : String m_name;
665 : String m_type;
666 : Maybe<String> m_value;
667 : Maybe<protocol::Runtime::ObjectPreview> m_valuePreview;
668 : Maybe<String> m_subtype;
669 : };
670 :
671 :
672 : //
673 : class EntryPreview : public Serializable{
674 : PROTOCOL_DISALLOW_COPY(EntryPreview);
675 : public:
676 : static std::unique_ptr<EntryPreview> fromValue(protocol::Value* value, ErrorSupport* errors);
677 :
678 342 : ~EntryPreview() override { }
679 :
680 : bool hasKey() { return m_key.isJust(); }
681 : protocol::Runtime::ObjectPreview* getKey(protocol::Runtime::ObjectPreview* defaultValue) { return m_key.isJust() ? m_key.fromJust() : defaultValue; }
682 : void setKey(std::unique_ptr<protocol::Runtime::ObjectPreview> value) { m_key = std::move(value); }
683 :
684 : protocol::Runtime::ObjectPreview* getValue() { return m_value.get(); }
685 : void setValue(std::unique_ptr<protocol::Runtime::ObjectPreview> value) { m_value = std::move(value); }
686 :
687 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
688 0 : String serialize() override { return toValue()->serialize(); }
689 : std::unique_ptr<EntryPreview> clone() const;
690 :
691 : template<int STATE>
692 : class EntryPreviewBuilder {
693 : public:
694 : enum {
695 : NoFieldsSet = 0,
696 : ValueSet = 1 << 1,
697 : AllFieldsSet = (ValueSet | 0)};
698 :
699 :
700 : EntryPreviewBuilder<STATE>& setKey(std::unique_ptr<protocol::Runtime::ObjectPreview> value)
701 : {
702 : m_result->setKey(std::move(value));
703 : return *this;
704 : }
705 :
706 : EntryPreviewBuilder<STATE | ValueSet>& setValue(std::unique_ptr<protocol::Runtime::ObjectPreview> value)
707 : {
708 : static_assert(!(STATE & ValueSet), "property value should not be set yet");
709 : m_result->setValue(std::move(value));
710 : return castState<ValueSet>();
711 : }
712 :
713 : std::unique_ptr<EntryPreview> build()
714 : {
715 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
716 : return std::move(m_result);
717 : }
718 :
719 : private:
720 : friend class EntryPreview;
721 : EntryPreviewBuilder() : m_result(new EntryPreview()) { }
722 :
723 : template<int STEP> EntryPreviewBuilder<STATE | STEP>& castState()
724 : {
725 : return *reinterpret_cast<EntryPreviewBuilder<STATE | STEP>*>(this);
726 : }
727 :
728 : std::unique_ptr<protocol::Runtime::EntryPreview> m_result;
729 : };
730 :
731 : static EntryPreviewBuilder<0> create()
732 : {
733 : return EntryPreviewBuilder<0>();
734 : }
735 :
736 : private:
737 : EntryPreview()
738 228 : {
739 : }
740 :
741 : Maybe<protocol::Runtime::ObjectPreview> m_key;
742 : std::unique_ptr<protocol::Runtime::ObjectPreview> m_value;
743 : };
744 :
745 :
746 : // Object property descriptor.
747 : class PropertyDescriptor : public Serializable{
748 : PROTOCOL_DISALLOW_COPY(PropertyDescriptor);
749 : public:
750 : static std::unique_ptr<PropertyDescriptor> fromValue(protocol::Value* value, ErrorSupport* errors);
751 :
752 10403118 : ~PropertyDescriptor() override { }
753 :
754 : String getName() { return m_name; }
755 : void setName(const String& value) { m_name = value; }
756 :
757 : bool hasValue() { return m_value.isJust(); }
758 : protocol::Runtime::RemoteObject* getValue(protocol::Runtime::RemoteObject* defaultValue) { return m_value.isJust() ? m_value.fromJust() : defaultValue; }
759 : void setValue(std::unique_ptr<protocol::Runtime::RemoteObject> value) { m_value = std::move(value); }
760 :
761 : bool hasWritable() { return m_writable.isJust(); }
762 : bool getWritable(bool defaultValue) { return m_writable.isJust() ? m_writable.fromJust() : defaultValue; }
763 : void setWritable(bool value) { m_writable = value; }
764 :
765 : bool hasGet() { return m_get.isJust(); }
766 : protocol::Runtime::RemoteObject* getGet(protocol::Runtime::RemoteObject* defaultValue) { return m_get.isJust() ? m_get.fromJust() : defaultValue; }
767 : void setGet(std::unique_ptr<protocol::Runtime::RemoteObject> value) { m_get = std::move(value); }
768 :
769 : bool hasSet() { return m_set.isJust(); }
770 : protocol::Runtime::RemoteObject* getSet(protocol::Runtime::RemoteObject* defaultValue) { return m_set.isJust() ? m_set.fromJust() : defaultValue; }
771 : void setSet(std::unique_ptr<protocol::Runtime::RemoteObject> value) { m_set = std::move(value); }
772 :
773 : bool getConfigurable() { return m_configurable; }
774 : void setConfigurable(bool value) { m_configurable = value; }
775 :
776 : bool getEnumerable() { return m_enumerable; }
777 : void setEnumerable(bool value) { m_enumerable = value; }
778 :
779 : bool hasWasThrown() { return m_wasThrown.isJust(); }
780 : bool getWasThrown(bool defaultValue) { return m_wasThrown.isJust() ? m_wasThrown.fromJust() : defaultValue; }
781 : void setWasThrown(bool value) { m_wasThrown = value; }
782 :
783 : bool hasIsOwn() { return m_isOwn.isJust(); }
784 : bool getIsOwn(bool defaultValue) { return m_isOwn.isJust() ? m_isOwn.fromJust() : defaultValue; }
785 : void setIsOwn(bool value) { m_isOwn = value; }
786 :
787 : bool hasSymbol() { return m_symbol.isJust(); }
788 : protocol::Runtime::RemoteObject* getSymbol(protocol::Runtime::RemoteObject* defaultValue) { return m_symbol.isJust() ? m_symbol.fromJust() : defaultValue; }
789 : void setSymbol(std::unique_ptr<protocol::Runtime::RemoteObject> value) { m_symbol = std::move(value); }
790 :
791 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
792 0 : String serialize() override { return toValue()->serialize(); }
793 : std::unique_ptr<PropertyDescriptor> clone() const;
794 :
795 : template<int STATE>
796 : class PropertyDescriptorBuilder {
797 : public:
798 : enum {
799 : NoFieldsSet = 0,
800 : NameSet = 1 << 1,
801 : ConfigurableSet = 1 << 2,
802 : EnumerableSet = 1 << 3,
803 : AllFieldsSet = (NameSet | ConfigurableSet | EnumerableSet | 0)};
804 :
805 :
806 : PropertyDescriptorBuilder<STATE | NameSet>& setName(const String& value)
807 : {
808 : static_assert(!(STATE & NameSet), "property name should not be set yet");
809 : m_result->setName(value);
810 : return castState<NameSet>();
811 : }
812 :
813 : PropertyDescriptorBuilder<STATE>& setValue(std::unique_ptr<protocol::Runtime::RemoteObject> value)
814 : {
815 : m_result->setValue(std::move(value));
816 : return *this;
817 : }
818 :
819 : PropertyDescriptorBuilder<STATE>& setWritable(bool value)
820 : {
821 : m_result->setWritable(value);
822 : return *this;
823 : }
824 :
825 : PropertyDescriptorBuilder<STATE>& setGet(std::unique_ptr<protocol::Runtime::RemoteObject> value)
826 : {
827 : m_result->setGet(std::move(value));
828 : return *this;
829 : }
830 :
831 : PropertyDescriptorBuilder<STATE>& setSet(std::unique_ptr<protocol::Runtime::RemoteObject> value)
832 : {
833 : m_result->setSet(std::move(value));
834 : return *this;
835 : }
836 :
837 : PropertyDescriptorBuilder<STATE | ConfigurableSet>& setConfigurable(bool value)
838 : {
839 : static_assert(!(STATE & ConfigurableSet), "property configurable should not be set yet");
840 : m_result->setConfigurable(value);
841 : return castState<ConfigurableSet>();
842 : }
843 :
844 : PropertyDescriptorBuilder<STATE | EnumerableSet>& setEnumerable(bool value)
845 : {
846 : static_assert(!(STATE & EnumerableSet), "property enumerable should not be set yet");
847 : m_result->setEnumerable(value);
848 : return castState<EnumerableSet>();
849 : }
850 :
851 : PropertyDescriptorBuilder<STATE>& setWasThrown(bool value)
852 : {
853 : m_result->setWasThrown(value);
854 : return *this;
855 : }
856 :
857 : PropertyDescriptorBuilder<STATE>& setIsOwn(bool value)
858 : {
859 : m_result->setIsOwn(value);
860 : return *this;
861 : }
862 :
863 : PropertyDescriptorBuilder<STATE>& setSymbol(std::unique_ptr<protocol::Runtime::RemoteObject> value)
864 : {
865 : m_result->setSymbol(std::move(value));
866 : return *this;
867 : }
868 :
869 : std::unique_ptr<PropertyDescriptor> build()
870 : {
871 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
872 : return std::move(m_result);
873 : }
874 :
875 : private:
876 : friend class PropertyDescriptor;
877 : PropertyDescriptorBuilder() : m_result(new PropertyDescriptor()) { }
878 :
879 : template<int STEP> PropertyDescriptorBuilder<STATE | STEP>& castState()
880 : {
881 : return *reinterpret_cast<PropertyDescriptorBuilder<STATE | STEP>*>(this);
882 : }
883 :
884 : std::unique_ptr<protocol::Runtime::PropertyDescriptor> m_result;
885 : };
886 :
887 : static PropertyDescriptorBuilder<0> create()
888 : {
889 : return PropertyDescriptorBuilder<0>();
890 : }
891 :
892 : private:
893 : PropertyDescriptor()
894 3467706 : {
895 3467706 : m_configurable = false;
896 3467706 : m_enumerable = false;
897 : }
898 :
899 : String m_name;
900 : Maybe<protocol::Runtime::RemoteObject> m_value;
901 : Maybe<bool> m_writable;
902 : Maybe<protocol::Runtime::RemoteObject> m_get;
903 : Maybe<protocol::Runtime::RemoteObject> m_set;
904 : bool m_configurable;
905 : bool m_enumerable;
906 : Maybe<bool> m_wasThrown;
907 : Maybe<bool> m_isOwn;
908 : Maybe<protocol::Runtime::RemoteObject> m_symbol;
909 : };
910 :
911 :
912 : // Object internal property descriptor. This property isn't normally visible in JavaScript code.
913 : class InternalPropertyDescriptor : public Serializable{
914 : PROTOCOL_DISALLOW_COPY(InternalPropertyDescriptor);
915 : public:
916 : static std::unique_ptr<InternalPropertyDescriptor> fromValue(protocol::Value* value, ErrorSupport* errors);
917 :
918 2964 : ~InternalPropertyDescriptor() override { }
919 :
920 : String getName() { return m_name; }
921 : void setName(const String& value) { m_name = value; }
922 :
923 : bool hasValue() { return m_value.isJust(); }
924 : protocol::Runtime::RemoteObject* getValue(protocol::Runtime::RemoteObject* defaultValue) { return m_value.isJust() ? m_value.fromJust() : defaultValue; }
925 : void setValue(std::unique_ptr<protocol::Runtime::RemoteObject> value) { m_value = std::move(value); }
926 :
927 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
928 0 : String serialize() override { return toValue()->serialize(); }
929 : std::unique_ptr<InternalPropertyDescriptor> clone() const;
930 :
931 : template<int STATE>
932 : class InternalPropertyDescriptorBuilder {
933 : public:
934 : enum {
935 : NoFieldsSet = 0,
936 : NameSet = 1 << 1,
937 : AllFieldsSet = (NameSet | 0)};
938 :
939 :
940 : InternalPropertyDescriptorBuilder<STATE | NameSet>& setName(const String& value)
941 : {
942 : static_assert(!(STATE & NameSet), "property name should not be set yet");
943 : m_result->setName(value);
944 : return castState<NameSet>();
945 : }
946 :
947 : InternalPropertyDescriptorBuilder<STATE>& setValue(std::unique_ptr<protocol::Runtime::RemoteObject> value)
948 : {
949 : m_result->setValue(std::move(value));
950 : return *this;
951 : }
952 :
953 : std::unique_ptr<InternalPropertyDescriptor> build()
954 : {
955 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
956 : return std::move(m_result);
957 : }
958 :
959 : private:
960 : friend class InternalPropertyDescriptor;
961 1976 : InternalPropertyDescriptorBuilder() : m_result(new InternalPropertyDescriptor()) { }
962 :
963 : template<int STEP> InternalPropertyDescriptorBuilder<STATE | STEP>& castState()
964 : {
965 : return *reinterpret_cast<InternalPropertyDescriptorBuilder<STATE | STEP>*>(this);
966 : }
967 :
968 : std::unique_ptr<protocol::Runtime::InternalPropertyDescriptor> m_result;
969 : };
970 :
971 : static InternalPropertyDescriptorBuilder<0> create()
972 : {
973 988 : return InternalPropertyDescriptorBuilder<0>();
974 : }
975 :
976 : private:
977 : InternalPropertyDescriptor()
978 988 : {
979 : }
980 :
981 : String m_name;
982 : Maybe<protocol::Runtime::RemoteObject> m_value;
983 : };
984 :
985 :
986 : // Represents function call argument. Either remote object id <code>objectId</code>, primitive <code>value</code>, unserializable primitive value or neither of (for undefined) them should be specified.
987 : class CallArgument : public Serializable{
988 : PROTOCOL_DISALLOW_COPY(CallArgument);
989 : public:
990 : static std::unique_ptr<CallArgument> fromValue(protocol::Value* value, ErrorSupport* errors);
991 :
992 654 : ~CallArgument() override { }
993 :
994 : bool hasValue() { return m_value.isJust(); }
995 170 : protocol::Value* getValue(protocol::Value* defaultValue) { return m_value.isJust() ? m_value.fromJust() : defaultValue; }
996 : void setValue(std::unique_ptr<protocol::Value> value) { m_value = std::move(value); }
997 :
998 12 : bool hasUnserializableValue() { return m_unserializableValue.isJust(); }
999 12 : String getUnserializableValue(const String& defaultValue) { return m_unserializableValue.isJust() ? m_unserializableValue.fromJust() : defaultValue; }
1000 : void setUnserializableValue(const String& value) { m_unserializableValue = value; }
1001 :
1002 212 : bool hasObjectId() { return m_objectId.isJust(); }
1003 60 : String getObjectId(const String& defaultValue) { return m_objectId.isJust() ? m_objectId.fromJust() : defaultValue; }
1004 : void setObjectId(const String& value) { m_objectId = value; }
1005 :
1006 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
1007 0 : String serialize() override { return toValue()->serialize(); }
1008 : std::unique_ptr<CallArgument> clone() const;
1009 :
1010 : template<int STATE>
1011 : class CallArgumentBuilder {
1012 : public:
1013 : enum {
1014 : NoFieldsSet = 0,
1015 : AllFieldsSet = (0)};
1016 :
1017 :
1018 : CallArgumentBuilder<STATE>& setValue(std::unique_ptr<protocol::Value> value)
1019 : {
1020 : m_result->setValue(std::move(value));
1021 : return *this;
1022 : }
1023 :
1024 : CallArgumentBuilder<STATE>& setUnserializableValue(const String& value)
1025 : {
1026 : m_result->setUnserializableValue(value);
1027 : return *this;
1028 : }
1029 :
1030 : CallArgumentBuilder<STATE>& setObjectId(const String& value)
1031 : {
1032 : m_result->setObjectId(value);
1033 : return *this;
1034 : }
1035 :
1036 : std::unique_ptr<CallArgument> build()
1037 : {
1038 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
1039 : return std::move(m_result);
1040 : }
1041 :
1042 : private:
1043 : friend class CallArgument;
1044 : CallArgumentBuilder() : m_result(new CallArgument()) { }
1045 :
1046 : template<int STEP> CallArgumentBuilder<STATE | STEP>& castState()
1047 : {
1048 : return *reinterpret_cast<CallArgumentBuilder<STATE | STEP>*>(this);
1049 : }
1050 :
1051 : std::unique_ptr<protocol::Runtime::CallArgument> m_result;
1052 : };
1053 :
1054 : static CallArgumentBuilder<0> create()
1055 : {
1056 : return CallArgumentBuilder<0>();
1057 : }
1058 :
1059 : private:
1060 : CallArgument()
1061 218 : {
1062 : }
1063 :
1064 : Maybe<protocol::Value> m_value;
1065 : Maybe<String> m_unserializableValue;
1066 : Maybe<String> m_objectId;
1067 : };
1068 :
1069 :
1070 : // Description of an isolated world.
1071 : class ExecutionContextDescription : public Serializable{
1072 : PROTOCOL_DISALLOW_COPY(ExecutionContextDescription);
1073 : public:
1074 : static std::unique_ptr<ExecutionContextDescription> fromValue(protocol::Value* value, ErrorSupport* errors);
1075 :
1076 1206 : ~ExecutionContextDescription() override { }
1077 :
1078 : int getId() { return m_id; }
1079 402 : void setId(int value) { m_id = value; }
1080 :
1081 : String getOrigin() { return m_origin; }
1082 : void setOrigin(const String& value) { m_origin = value; }
1083 :
1084 : String getName() { return m_name; }
1085 : void setName(const String& value) { m_name = value; }
1086 :
1087 : bool hasAuxData() { return m_auxData.isJust(); }
1088 : protocol::DictionaryValue* getAuxData(protocol::DictionaryValue* defaultValue) { return m_auxData.isJust() ? m_auxData.fromJust() : defaultValue; }
1089 : void setAuxData(std::unique_ptr<protocol::DictionaryValue> value) { m_auxData = std::move(value); }
1090 :
1091 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
1092 0 : String serialize() override { return toValue()->serialize(); }
1093 : std::unique_ptr<ExecutionContextDescription> clone() const;
1094 :
1095 : template<int STATE>
1096 : class ExecutionContextDescriptionBuilder {
1097 : public:
1098 : enum {
1099 : NoFieldsSet = 0,
1100 : IdSet = 1 << 1,
1101 : OriginSet = 1 << 2,
1102 : NameSet = 1 << 3,
1103 : AllFieldsSet = (IdSet | OriginSet | NameSet | 0)};
1104 :
1105 :
1106 : ExecutionContextDescriptionBuilder<STATE | IdSet>& setId(int value)
1107 : {
1108 : static_assert(!(STATE & IdSet), "property id should not be set yet");
1109 : m_result->setId(value);
1110 : return castState<IdSet>();
1111 : }
1112 :
1113 : ExecutionContextDescriptionBuilder<STATE | OriginSet>& setOrigin(const String& value)
1114 : {
1115 : static_assert(!(STATE & OriginSet), "property origin should not be set yet");
1116 : m_result->setOrigin(value);
1117 : return castState<OriginSet>();
1118 : }
1119 :
1120 : ExecutionContextDescriptionBuilder<STATE | NameSet>& setName(const String& value)
1121 : {
1122 : static_assert(!(STATE & NameSet), "property name should not be set yet");
1123 : m_result->setName(value);
1124 : return castState<NameSet>();
1125 : }
1126 :
1127 : ExecutionContextDescriptionBuilder<STATE>& setAuxData(std::unique_ptr<protocol::DictionaryValue> value)
1128 : {
1129 : m_result->setAuxData(std::move(value));
1130 : return *this;
1131 : }
1132 :
1133 : std::unique_ptr<ExecutionContextDescription> build()
1134 : {
1135 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
1136 : return std::move(m_result);
1137 : }
1138 :
1139 : private:
1140 : friend class ExecutionContextDescription;
1141 804 : ExecutionContextDescriptionBuilder() : m_result(new ExecutionContextDescription()) { }
1142 :
1143 : template<int STEP> ExecutionContextDescriptionBuilder<STATE | STEP>& castState()
1144 : {
1145 : return *reinterpret_cast<ExecutionContextDescriptionBuilder<STATE | STEP>*>(this);
1146 : }
1147 :
1148 : std::unique_ptr<protocol::Runtime::ExecutionContextDescription> m_result;
1149 : };
1150 :
1151 : static ExecutionContextDescriptionBuilder<0> create()
1152 : {
1153 402 : return ExecutionContextDescriptionBuilder<0>();
1154 : }
1155 :
1156 : private:
1157 : ExecutionContextDescription()
1158 402 : {
1159 402 : m_id = 0;
1160 : }
1161 :
1162 : int m_id;
1163 : String m_origin;
1164 : String m_name;
1165 : Maybe<protocol::DictionaryValue> m_auxData;
1166 : };
1167 :
1168 :
1169 : // Detailed information about exception (or error) that was thrown during script compilation or execution.
1170 : class ExceptionDetails : public Serializable{
1171 : PROTOCOL_DISALLOW_COPY(ExceptionDetails);
1172 : public:
1173 : static std::unique_ptr<ExceptionDetails> fromValue(protocol::Value* value, ErrorSupport* errors);
1174 :
1175 5022 : ~ExceptionDetails() override { }
1176 :
1177 : int getExceptionId() { return m_exceptionId; }
1178 1674 : void setExceptionId(int value) { m_exceptionId = value; }
1179 :
1180 : String getText() { return m_text; }
1181 : void setText(const String& value) { m_text = value; }
1182 :
1183 : int getLineNumber() { return m_lineNumber; }
1184 1674 : void setLineNumber(int value) { m_lineNumber = value; }
1185 :
1186 : int getColumnNumber() { return m_columnNumber; }
1187 1674 : void setColumnNumber(int value) { m_columnNumber = value; }
1188 :
1189 : bool hasScriptId() { return m_scriptId.isJust(); }
1190 : String getScriptId(const String& defaultValue) { return m_scriptId.isJust() ? m_scriptId.fromJust() : defaultValue; }
1191 3204 : void setScriptId(const String& value) { m_scriptId = value; }
1192 :
1193 : bool hasUrl() { return m_url.isJust(); }
1194 : String getUrl(const String& defaultValue) { return m_url.isJust() ? m_url.fromJust() : defaultValue; }
1195 12 : void setUrl(const String& value) { m_url = value; }
1196 :
1197 : bool hasStackTrace() { return m_stackTrace.isJust(); }
1198 : protocol::Runtime::StackTrace* getStackTrace(protocol::Runtime::StackTrace* defaultValue) { return m_stackTrace.isJust() ? m_stackTrace.fromJust() : defaultValue; }
1199 : void setStackTrace(std::unique_ptr<protocol::Runtime::StackTrace> value) { m_stackTrace = std::move(value); }
1200 :
1201 : bool hasException() { return m_exception.isJust(); }
1202 : protocol::Runtime::RemoteObject* getException(protocol::Runtime::RemoteObject* defaultValue) { return m_exception.isJust() ? m_exception.fromJust() : defaultValue; }
1203 : void setException(std::unique_ptr<protocol::Runtime::RemoteObject> value) { m_exception = std::move(value); }
1204 :
1205 : bool hasExecutionContextId() { return m_executionContextId.isJust(); }
1206 : int getExecutionContextId(int defaultValue) { return m_executionContextId.isJust() ? m_executionContextId.fromJust() : defaultValue; }
1207 : void setExecutionContextId(int value) { m_executionContextId = value; }
1208 :
1209 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
1210 0 : String serialize() override { return toValue()->serialize(); }
1211 : std::unique_ptr<ExceptionDetails> clone() const;
1212 :
1213 : template<int STATE>
1214 : class ExceptionDetailsBuilder {
1215 : public:
1216 : enum {
1217 : NoFieldsSet = 0,
1218 : ExceptionIdSet = 1 << 1,
1219 : TextSet = 1 << 2,
1220 : LineNumberSet = 1 << 3,
1221 : ColumnNumberSet = 1 << 4,
1222 : AllFieldsSet = (ExceptionIdSet | TextSet | LineNumberSet | ColumnNumberSet | 0)};
1223 :
1224 :
1225 : ExceptionDetailsBuilder<STATE | ExceptionIdSet>& setExceptionId(int value)
1226 : {
1227 : static_assert(!(STATE & ExceptionIdSet), "property exceptionId should not be set yet");
1228 : m_result->setExceptionId(value);
1229 : return castState<ExceptionIdSet>();
1230 : }
1231 :
1232 : ExceptionDetailsBuilder<STATE | TextSet>& setText(const String& value)
1233 : {
1234 : static_assert(!(STATE & TextSet), "property text should not be set yet");
1235 : m_result->setText(value);
1236 : return castState<TextSet>();
1237 : }
1238 :
1239 : ExceptionDetailsBuilder<STATE | LineNumberSet>& setLineNumber(int value)
1240 : {
1241 : static_assert(!(STATE & LineNumberSet), "property lineNumber should not be set yet");
1242 : m_result->setLineNumber(value);
1243 : return castState<LineNumberSet>();
1244 : }
1245 :
1246 : ExceptionDetailsBuilder<STATE | ColumnNumberSet>& setColumnNumber(int value)
1247 : {
1248 : static_assert(!(STATE & ColumnNumberSet), "property columnNumber should not be set yet");
1249 : m_result->setColumnNumber(value);
1250 : return castState<ColumnNumberSet>();
1251 : }
1252 :
1253 : ExceptionDetailsBuilder<STATE>& setScriptId(const String& value)
1254 : {
1255 : m_result->setScriptId(value);
1256 : return *this;
1257 : }
1258 :
1259 : ExceptionDetailsBuilder<STATE>& setUrl(const String& value)
1260 : {
1261 : m_result->setUrl(value);
1262 : return *this;
1263 : }
1264 :
1265 : ExceptionDetailsBuilder<STATE>& setStackTrace(std::unique_ptr<protocol::Runtime::StackTrace> value)
1266 : {
1267 : m_result->setStackTrace(std::move(value));
1268 : return *this;
1269 : }
1270 :
1271 : ExceptionDetailsBuilder<STATE>& setException(std::unique_ptr<protocol::Runtime::RemoteObject> value)
1272 : {
1273 : m_result->setException(std::move(value));
1274 : return *this;
1275 : }
1276 :
1277 : ExceptionDetailsBuilder<STATE>& setExecutionContextId(int value)
1278 : {
1279 : m_result->setExecutionContextId(value);
1280 : return *this;
1281 : }
1282 :
1283 : std::unique_ptr<ExceptionDetails> build()
1284 : {
1285 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
1286 : return std::move(m_result);
1287 : }
1288 :
1289 : private:
1290 : friend class ExceptionDetails;
1291 3348 : ExceptionDetailsBuilder() : m_result(new ExceptionDetails()) { }
1292 :
1293 : template<int STEP> ExceptionDetailsBuilder<STATE | STEP>& castState()
1294 : {
1295 : return *reinterpret_cast<ExceptionDetailsBuilder<STATE | STEP>*>(this);
1296 : }
1297 :
1298 : std::unique_ptr<protocol::Runtime::ExceptionDetails> m_result;
1299 : };
1300 :
1301 : static ExceptionDetailsBuilder<0> create()
1302 : {
1303 1674 : return ExceptionDetailsBuilder<0>();
1304 : }
1305 :
1306 : private:
1307 : ExceptionDetails()
1308 1674 : {
1309 1674 : m_exceptionId = 0;
1310 1674 : m_lineNumber = 0;
1311 1674 : m_columnNumber = 0;
1312 : }
1313 :
1314 : int m_exceptionId;
1315 : String m_text;
1316 : int m_lineNumber;
1317 : int m_columnNumber;
1318 : Maybe<String> m_scriptId;
1319 : Maybe<String> m_url;
1320 : Maybe<protocol::Runtime::StackTrace> m_stackTrace;
1321 : Maybe<protocol::Runtime::RemoteObject> m_exception;
1322 : Maybe<int> m_executionContextId;
1323 : };
1324 :
1325 :
1326 : // Stack entry for runtime errors and assertions.
1327 : class CallFrame : public Serializable{
1328 : PROTOCOL_DISALLOW_COPY(CallFrame);
1329 : public:
1330 : static std::unique_ptr<CallFrame> fromValue(protocol::Value* value, ErrorSupport* errors);
1331 :
1332 132102 : ~CallFrame() override { }
1333 :
1334 : String getFunctionName() { return m_functionName; }
1335 : void setFunctionName(const String& value) { m_functionName = value; }
1336 :
1337 : String getScriptId() { return m_scriptId; }
1338 : void setScriptId(const String& value) { m_scriptId = value; }
1339 :
1340 : String getUrl() { return m_url; }
1341 : void setUrl(const String& value) { m_url = value; }
1342 :
1343 : int getLineNumber() { return m_lineNumber; }
1344 44034 : void setLineNumber(int value) { m_lineNumber = value; }
1345 :
1346 : int getColumnNumber() { return m_columnNumber; }
1347 44034 : void setColumnNumber(int value) { m_columnNumber = value; }
1348 :
1349 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
1350 0 : String serialize() override { return toValue()->serialize(); }
1351 : std::unique_ptr<CallFrame> clone() const;
1352 :
1353 : template<int STATE>
1354 : class CallFrameBuilder {
1355 : public:
1356 : enum {
1357 : NoFieldsSet = 0,
1358 : FunctionNameSet = 1 << 1,
1359 : ScriptIdSet = 1 << 2,
1360 : UrlSet = 1 << 3,
1361 : LineNumberSet = 1 << 4,
1362 : ColumnNumberSet = 1 << 5,
1363 : AllFieldsSet = (FunctionNameSet | ScriptIdSet | UrlSet | LineNumberSet | ColumnNumberSet | 0)};
1364 :
1365 :
1366 : CallFrameBuilder<STATE | FunctionNameSet>& setFunctionName(const String& value)
1367 : {
1368 : static_assert(!(STATE & FunctionNameSet), "property functionName should not be set yet");
1369 : m_result->setFunctionName(value);
1370 : return castState<FunctionNameSet>();
1371 : }
1372 :
1373 : CallFrameBuilder<STATE | ScriptIdSet>& setScriptId(const String& value)
1374 : {
1375 : static_assert(!(STATE & ScriptIdSet), "property scriptId should not be set yet");
1376 : m_result->setScriptId(value);
1377 : return castState<ScriptIdSet>();
1378 : }
1379 :
1380 : CallFrameBuilder<STATE | UrlSet>& setUrl(const String& value)
1381 : {
1382 : static_assert(!(STATE & UrlSet), "property url should not be set yet");
1383 : m_result->setUrl(value);
1384 : return castState<UrlSet>();
1385 : }
1386 :
1387 : CallFrameBuilder<STATE | LineNumberSet>& setLineNumber(int value)
1388 : {
1389 : static_assert(!(STATE & LineNumberSet), "property lineNumber should not be set yet");
1390 : m_result->setLineNumber(value);
1391 : return castState<LineNumberSet>();
1392 : }
1393 :
1394 : CallFrameBuilder<STATE | ColumnNumberSet>& setColumnNumber(int value)
1395 : {
1396 : static_assert(!(STATE & ColumnNumberSet), "property columnNumber should not be set yet");
1397 : m_result->setColumnNumber(value);
1398 : return castState<ColumnNumberSet>();
1399 : }
1400 :
1401 : std::unique_ptr<CallFrame> build()
1402 : {
1403 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
1404 : return std::move(m_result);
1405 : }
1406 :
1407 : private:
1408 : friend class CallFrame;
1409 88068 : CallFrameBuilder() : m_result(new CallFrame()) { }
1410 :
1411 : template<int STEP> CallFrameBuilder<STATE | STEP>& castState()
1412 : {
1413 : return *reinterpret_cast<CallFrameBuilder<STATE | STEP>*>(this);
1414 : }
1415 :
1416 : std::unique_ptr<protocol::Runtime::CallFrame> m_result;
1417 : };
1418 :
1419 : static CallFrameBuilder<0> create()
1420 : {
1421 44034 : return CallFrameBuilder<0>();
1422 : }
1423 :
1424 : private:
1425 : CallFrame()
1426 44034 : {
1427 44034 : m_lineNumber = 0;
1428 44034 : m_columnNumber = 0;
1429 : }
1430 :
1431 : String m_functionName;
1432 : String m_scriptId;
1433 : String m_url;
1434 : int m_lineNumber;
1435 : int m_columnNumber;
1436 : };
1437 :
1438 :
1439 : // Call frames for assertions or error messages.
1440 : class StackTrace : public Serializable, public API::StackTrace{
1441 : PROTOCOL_DISALLOW_COPY(StackTrace);
1442 : public:
1443 : static std::unique_ptr<StackTrace> fromValue(protocol::Value* value, ErrorSupport* errors);
1444 :
1445 127611 : ~StackTrace() override { }
1446 :
1447 : bool hasDescription() { return m_description.isJust(); }
1448 : String getDescription(const String& defaultValue) { return m_description.isJust() ? m_description.fromJust() : defaultValue; }
1449 4668 : void setDescription(const String& value) { m_description = value; }
1450 :
1451 : protocol::Array<protocol::Runtime::CallFrame>* getCallFrames() { return m_callFrames.get(); }
1452 : void setCallFrames(std::unique_ptr<protocol::Array<protocol::Runtime::CallFrame>> value) { m_callFrames = std::move(value); }
1453 :
1454 : bool hasParent() { return m_parent.isJust(); }
1455 : protocol::Runtime::StackTrace* getParent(protocol::Runtime::StackTrace* defaultValue) { return m_parent.isJust() ? m_parent.fromJust() : defaultValue; }
1456 : void setParent(std::unique_ptr<protocol::Runtime::StackTrace> value) { m_parent = std::move(value); }
1457 :
1458 : bool hasPromiseCreationFrame() { return m_promiseCreationFrame.isJust(); }
1459 : protocol::Runtime::CallFrame* getPromiseCreationFrame(protocol::Runtime::CallFrame* defaultValue) { return m_promiseCreationFrame.isJust() ? m_promiseCreationFrame.fromJust() : defaultValue; }
1460 : void setPromiseCreationFrame(std::unique_ptr<protocol::Runtime::CallFrame> value) { m_promiseCreationFrame = std::move(value); }
1461 :
1462 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
1463 0 : String serialize() override { return toValue()->serialize(); }
1464 : std::unique_ptr<StackTrace> clone() const;
1465 : std::unique_ptr<StringBuffer> toJSONString() const override;
1466 :
1467 : template<int STATE>
1468 : class StackTraceBuilder {
1469 : public:
1470 : enum {
1471 : NoFieldsSet = 0,
1472 : CallFramesSet = 1 << 1,
1473 : AllFieldsSet = (CallFramesSet | 0)};
1474 :
1475 :
1476 : StackTraceBuilder<STATE>& setDescription(const String& value)
1477 : {
1478 : m_result->setDescription(value);
1479 : return *this;
1480 : }
1481 :
1482 : StackTraceBuilder<STATE | CallFramesSet>& setCallFrames(std::unique_ptr<protocol::Array<protocol::Runtime::CallFrame>> value)
1483 : {
1484 : static_assert(!(STATE & CallFramesSet), "property callFrames should not be set yet");
1485 : m_result->setCallFrames(std::move(value));
1486 : return castState<CallFramesSet>();
1487 : }
1488 :
1489 : StackTraceBuilder<STATE>& setParent(std::unique_ptr<protocol::Runtime::StackTrace> value)
1490 : {
1491 : m_result->setParent(std::move(value));
1492 : return *this;
1493 : }
1494 :
1495 : StackTraceBuilder<STATE>& setPromiseCreationFrame(std::unique_ptr<protocol::Runtime::CallFrame> value)
1496 : {
1497 : m_result->setPromiseCreationFrame(std::move(value));
1498 : return *this;
1499 : }
1500 :
1501 : std::unique_ptr<StackTrace> build()
1502 : {
1503 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
1504 : return std::move(m_result);
1505 : }
1506 :
1507 : private:
1508 : friend class StackTrace;
1509 85074 : StackTraceBuilder() : m_result(new StackTrace()) { }
1510 :
1511 : template<int STEP> StackTraceBuilder<STATE | STEP>& castState()
1512 : {
1513 : return *reinterpret_cast<StackTraceBuilder<STATE | STEP>*>(this);
1514 : }
1515 :
1516 : std::unique_ptr<protocol::Runtime::StackTrace> m_result;
1517 : };
1518 :
1519 : static StackTraceBuilder<0> create()
1520 : {
1521 42537 : return StackTraceBuilder<0>();
1522 : }
1523 :
1524 : private:
1525 : StackTrace()
1526 85074 : {
1527 : }
1528 :
1529 : Maybe<String> m_description;
1530 : std::unique_ptr<protocol::Array<protocol::Runtime::CallFrame>> m_callFrames;
1531 : Maybe<protocol::Runtime::StackTrace> m_parent;
1532 : Maybe<protocol::Runtime::CallFrame> m_promiseCreationFrame;
1533 : };
1534 :
1535 :
1536 : // Wrapper for notification params
1537 : class ExecutionContextCreatedNotification : public Serializable{
1538 : PROTOCOL_DISALLOW_COPY(ExecutionContextCreatedNotification);
1539 : public:
1540 : static std::unique_ptr<ExecutionContextCreatedNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
1541 :
1542 804 : ~ExecutionContextCreatedNotification() override { }
1543 :
1544 : protocol::Runtime::ExecutionContextDescription* getContext() { return m_context.get(); }
1545 : void setContext(std::unique_ptr<protocol::Runtime::ExecutionContextDescription> value) { m_context = std::move(value); }
1546 :
1547 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
1548 1206 : String serialize() override { return toValue()->serialize(); }
1549 : std::unique_ptr<ExecutionContextCreatedNotification> clone() const;
1550 :
1551 : template<int STATE>
1552 : class ExecutionContextCreatedNotificationBuilder {
1553 : public:
1554 : enum {
1555 : NoFieldsSet = 0,
1556 : ContextSet = 1 << 1,
1557 : AllFieldsSet = (ContextSet | 0)};
1558 :
1559 :
1560 : ExecutionContextCreatedNotificationBuilder<STATE | ContextSet>& setContext(std::unique_ptr<protocol::Runtime::ExecutionContextDescription> value)
1561 : {
1562 : static_assert(!(STATE & ContextSet), "property context should not be set yet");
1563 : m_result->setContext(std::move(value));
1564 : return castState<ContextSet>();
1565 : }
1566 :
1567 : std::unique_ptr<ExecutionContextCreatedNotification> build()
1568 : {
1569 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
1570 : return std::move(m_result);
1571 : }
1572 :
1573 : private:
1574 : friend class ExecutionContextCreatedNotification;
1575 402 : ExecutionContextCreatedNotificationBuilder() : m_result(new ExecutionContextCreatedNotification()) { }
1576 :
1577 : template<int STEP> ExecutionContextCreatedNotificationBuilder<STATE | STEP>& castState()
1578 : {
1579 : return *reinterpret_cast<ExecutionContextCreatedNotificationBuilder<STATE | STEP>*>(this);
1580 : }
1581 :
1582 : std::unique_ptr<protocol::Runtime::ExecutionContextCreatedNotification> m_result;
1583 : };
1584 :
1585 : static ExecutionContextCreatedNotificationBuilder<0> create()
1586 : {
1587 : return ExecutionContextCreatedNotificationBuilder<0>();
1588 : }
1589 :
1590 : private:
1591 : ExecutionContextCreatedNotification()
1592 402 : {
1593 : }
1594 :
1595 : std::unique_ptr<protocol::Runtime::ExecutionContextDescription> m_context;
1596 : };
1597 :
1598 :
1599 : // Wrapper for notification params
1600 : class ExecutionContextDestroyedNotification : public Serializable{
1601 : PROTOCOL_DISALLOW_COPY(ExecutionContextDestroyedNotification);
1602 : public:
1603 : static std::unique_ptr<ExecutionContextDestroyedNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
1604 :
1605 12 : ~ExecutionContextDestroyedNotification() override { }
1606 :
1607 : int getExecutionContextId() { return m_executionContextId; }
1608 6 : void setExecutionContextId(int value) { m_executionContextId = value; }
1609 :
1610 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
1611 18 : String serialize() override { return toValue()->serialize(); }
1612 : std::unique_ptr<ExecutionContextDestroyedNotification> clone() const;
1613 :
1614 : template<int STATE>
1615 : class ExecutionContextDestroyedNotificationBuilder {
1616 : public:
1617 : enum {
1618 : NoFieldsSet = 0,
1619 : ExecutionContextIdSet = 1 << 1,
1620 : AllFieldsSet = (ExecutionContextIdSet | 0)};
1621 :
1622 :
1623 : ExecutionContextDestroyedNotificationBuilder<STATE | ExecutionContextIdSet>& setExecutionContextId(int value)
1624 : {
1625 : static_assert(!(STATE & ExecutionContextIdSet), "property executionContextId should not be set yet");
1626 : m_result->setExecutionContextId(value);
1627 : return castState<ExecutionContextIdSet>();
1628 : }
1629 :
1630 : std::unique_ptr<ExecutionContextDestroyedNotification> build()
1631 : {
1632 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
1633 : return std::move(m_result);
1634 : }
1635 :
1636 : private:
1637 : friend class ExecutionContextDestroyedNotification;
1638 6 : ExecutionContextDestroyedNotificationBuilder() : m_result(new ExecutionContextDestroyedNotification()) { }
1639 :
1640 : template<int STEP> ExecutionContextDestroyedNotificationBuilder<STATE | STEP>& castState()
1641 : {
1642 : return *reinterpret_cast<ExecutionContextDestroyedNotificationBuilder<STATE | STEP>*>(this);
1643 : }
1644 :
1645 : std::unique_ptr<protocol::Runtime::ExecutionContextDestroyedNotification> m_result;
1646 : };
1647 :
1648 : static ExecutionContextDestroyedNotificationBuilder<0> create()
1649 : {
1650 : return ExecutionContextDestroyedNotificationBuilder<0>();
1651 : }
1652 :
1653 : private:
1654 : ExecutionContextDestroyedNotification()
1655 6 : {
1656 6 : m_executionContextId = 0;
1657 : }
1658 :
1659 : int m_executionContextId;
1660 : };
1661 :
1662 :
1663 : // Wrapper for notification params
1664 : class ExceptionThrownNotification : public Serializable{
1665 : PROTOCOL_DISALLOW_COPY(ExceptionThrownNotification);
1666 : public:
1667 : static std::unique_ptr<ExceptionThrownNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
1668 :
1669 84 : ~ExceptionThrownNotification() override { }
1670 :
1671 : double getTimestamp() { return m_timestamp; }
1672 42 : void setTimestamp(double value) { m_timestamp = value; }
1673 :
1674 : protocol::Runtime::ExceptionDetails* getExceptionDetails() { return m_exceptionDetails.get(); }
1675 : void setExceptionDetails(std::unique_ptr<protocol::Runtime::ExceptionDetails> value) { m_exceptionDetails = std::move(value); }
1676 :
1677 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
1678 126 : String serialize() override { return toValue()->serialize(); }
1679 : std::unique_ptr<ExceptionThrownNotification> clone() const;
1680 :
1681 : template<int STATE>
1682 : class ExceptionThrownNotificationBuilder {
1683 : public:
1684 : enum {
1685 : NoFieldsSet = 0,
1686 : TimestampSet = 1 << 1,
1687 : ExceptionDetailsSet = 1 << 2,
1688 : AllFieldsSet = (TimestampSet | ExceptionDetailsSet | 0)};
1689 :
1690 :
1691 : ExceptionThrownNotificationBuilder<STATE | TimestampSet>& setTimestamp(double value)
1692 : {
1693 : static_assert(!(STATE & TimestampSet), "property timestamp should not be set yet");
1694 : m_result->setTimestamp(value);
1695 : return castState<TimestampSet>();
1696 : }
1697 :
1698 : ExceptionThrownNotificationBuilder<STATE | ExceptionDetailsSet>& setExceptionDetails(std::unique_ptr<protocol::Runtime::ExceptionDetails> value)
1699 : {
1700 : static_assert(!(STATE & ExceptionDetailsSet), "property exceptionDetails should not be set yet");
1701 : m_result->setExceptionDetails(std::move(value));
1702 : return castState<ExceptionDetailsSet>();
1703 : }
1704 :
1705 : std::unique_ptr<ExceptionThrownNotification> build()
1706 : {
1707 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
1708 : return std::move(m_result);
1709 : }
1710 :
1711 : private:
1712 : friend class ExceptionThrownNotification;
1713 84 : ExceptionThrownNotificationBuilder() : m_result(new ExceptionThrownNotification()) { }
1714 :
1715 : template<int STEP> ExceptionThrownNotificationBuilder<STATE | STEP>& castState()
1716 : {
1717 : return *reinterpret_cast<ExceptionThrownNotificationBuilder<STATE | STEP>*>(this);
1718 : }
1719 :
1720 : std::unique_ptr<protocol::Runtime::ExceptionThrownNotification> m_result;
1721 : };
1722 :
1723 : static ExceptionThrownNotificationBuilder<0> create()
1724 : {
1725 42 : return ExceptionThrownNotificationBuilder<0>();
1726 : }
1727 :
1728 : private:
1729 : ExceptionThrownNotification()
1730 42 : {
1731 42 : m_timestamp = 0;
1732 : }
1733 :
1734 : double m_timestamp;
1735 : std::unique_ptr<protocol::Runtime::ExceptionDetails> m_exceptionDetails;
1736 : };
1737 :
1738 :
1739 : // Wrapper for notification params
1740 : class ExceptionRevokedNotification : public Serializable{
1741 : PROTOCOL_DISALLOW_COPY(ExceptionRevokedNotification);
1742 : public:
1743 : static std::unique_ptr<ExceptionRevokedNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
1744 :
1745 0 : ~ExceptionRevokedNotification() override { }
1746 :
1747 : String getReason() { return m_reason; }
1748 : void setReason(const String& value) { m_reason = value; }
1749 :
1750 : int getExceptionId() { return m_exceptionId; }
1751 0 : void setExceptionId(int value) { m_exceptionId = value; }
1752 :
1753 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
1754 0 : String serialize() override { return toValue()->serialize(); }
1755 : std::unique_ptr<ExceptionRevokedNotification> clone() const;
1756 :
1757 : template<int STATE>
1758 : class ExceptionRevokedNotificationBuilder {
1759 : public:
1760 : enum {
1761 : NoFieldsSet = 0,
1762 : ReasonSet = 1 << 1,
1763 : ExceptionIdSet = 1 << 2,
1764 : AllFieldsSet = (ReasonSet | ExceptionIdSet | 0)};
1765 :
1766 :
1767 : ExceptionRevokedNotificationBuilder<STATE | ReasonSet>& setReason(const String& value)
1768 : {
1769 : static_assert(!(STATE & ReasonSet), "property reason should not be set yet");
1770 : m_result->setReason(value);
1771 : return castState<ReasonSet>();
1772 : }
1773 :
1774 : ExceptionRevokedNotificationBuilder<STATE | ExceptionIdSet>& setExceptionId(int value)
1775 : {
1776 : static_assert(!(STATE & ExceptionIdSet), "property exceptionId should not be set yet");
1777 : m_result->setExceptionId(value);
1778 : return castState<ExceptionIdSet>();
1779 : }
1780 :
1781 : std::unique_ptr<ExceptionRevokedNotification> build()
1782 : {
1783 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
1784 : return std::move(m_result);
1785 : }
1786 :
1787 : private:
1788 : friend class ExceptionRevokedNotification;
1789 0 : ExceptionRevokedNotificationBuilder() : m_result(new ExceptionRevokedNotification()) { }
1790 :
1791 : template<int STEP> ExceptionRevokedNotificationBuilder<STATE | STEP>& castState()
1792 : {
1793 : return *reinterpret_cast<ExceptionRevokedNotificationBuilder<STATE | STEP>*>(this);
1794 : }
1795 :
1796 : std::unique_ptr<protocol::Runtime::ExceptionRevokedNotification> m_result;
1797 : };
1798 :
1799 : static ExceptionRevokedNotificationBuilder<0> create()
1800 : {
1801 0 : return ExceptionRevokedNotificationBuilder<0>();
1802 : }
1803 :
1804 : private:
1805 : ExceptionRevokedNotification()
1806 0 : {
1807 0 : m_exceptionId = 0;
1808 : }
1809 :
1810 : String m_reason;
1811 : int m_exceptionId;
1812 : };
1813 :
1814 :
1815 : // Wrapper for notification params
1816 : class ConsoleAPICalledNotification : public Serializable{
1817 : PROTOCOL_DISALLOW_COPY(ConsoleAPICalledNotification);
1818 : public:
1819 : static std::unique_ptr<ConsoleAPICalledNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
1820 :
1821 22050 : ~ConsoleAPICalledNotification() override { }
1822 :
1823 : struct TypeEnum {
1824 : static const char* Log;
1825 : static const char* Debug;
1826 : static const char* Info;
1827 : static const char* Error;
1828 : static const char* Warning;
1829 : static const char* Dir;
1830 : static const char* Dirxml;
1831 : static const char* Table;
1832 : static const char* Trace;
1833 : static const char* Clear;
1834 : static const char* StartGroup;
1835 : static const char* StartGroupCollapsed;
1836 : static const char* EndGroup;
1837 : static const char* Assert;
1838 : static const char* Profile;
1839 : static const char* ProfileEnd;
1840 : static const char* Count;
1841 : static const char* TimeEnd;
1842 : }; // TypeEnum
1843 :
1844 : String getType() { return m_type; }
1845 : void setType(const String& value) { m_type = value; }
1846 :
1847 : protocol::Array<protocol::Runtime::RemoteObject>* getArgs() { return m_args.get(); }
1848 : void setArgs(std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>> value) { m_args = std::move(value); }
1849 :
1850 : int getExecutionContextId() { return m_executionContextId; }
1851 7350 : void setExecutionContextId(int value) { m_executionContextId = value; }
1852 :
1853 : double getTimestamp() { return m_timestamp; }
1854 7350 : void setTimestamp(double value) { m_timestamp = value; }
1855 :
1856 : bool hasStackTrace() { return m_stackTrace.isJust(); }
1857 : protocol::Runtime::StackTrace* getStackTrace(protocol::Runtime::StackTrace* defaultValue) { return m_stackTrace.isJust() ? m_stackTrace.fromJust() : defaultValue; }
1858 : void setStackTrace(std::unique_ptr<protocol::Runtime::StackTrace> value) { m_stackTrace = std::move(value); }
1859 :
1860 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
1861 22050 : String serialize() override { return toValue()->serialize(); }
1862 : std::unique_ptr<ConsoleAPICalledNotification> clone() const;
1863 :
1864 : template<int STATE>
1865 : class ConsoleAPICalledNotificationBuilder {
1866 : public:
1867 : enum {
1868 : NoFieldsSet = 0,
1869 : TypeSet = 1 << 1,
1870 : ArgsSet = 1 << 2,
1871 : ExecutionContextIdSet = 1 << 3,
1872 : TimestampSet = 1 << 4,
1873 : AllFieldsSet = (TypeSet | ArgsSet | ExecutionContextIdSet | TimestampSet | 0)};
1874 :
1875 :
1876 : ConsoleAPICalledNotificationBuilder<STATE | TypeSet>& setType(const String& value)
1877 : {
1878 : static_assert(!(STATE & TypeSet), "property type should not be set yet");
1879 : m_result->setType(value);
1880 : return castState<TypeSet>();
1881 : }
1882 :
1883 : ConsoleAPICalledNotificationBuilder<STATE | ArgsSet>& setArgs(std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>> value)
1884 : {
1885 : static_assert(!(STATE & ArgsSet), "property args should not be set yet");
1886 : m_result->setArgs(std::move(value));
1887 : return castState<ArgsSet>();
1888 : }
1889 :
1890 : ConsoleAPICalledNotificationBuilder<STATE | ExecutionContextIdSet>& setExecutionContextId(int value)
1891 : {
1892 : static_assert(!(STATE & ExecutionContextIdSet), "property executionContextId should not be set yet");
1893 : m_result->setExecutionContextId(value);
1894 : return castState<ExecutionContextIdSet>();
1895 : }
1896 :
1897 : ConsoleAPICalledNotificationBuilder<STATE | TimestampSet>& setTimestamp(double value)
1898 : {
1899 : static_assert(!(STATE & TimestampSet), "property timestamp should not be set yet");
1900 : m_result->setTimestamp(value);
1901 : return castState<TimestampSet>();
1902 : }
1903 :
1904 : ConsoleAPICalledNotificationBuilder<STATE>& setStackTrace(std::unique_ptr<protocol::Runtime::StackTrace> value)
1905 : {
1906 : m_result->setStackTrace(std::move(value));
1907 : return *this;
1908 : }
1909 :
1910 : std::unique_ptr<ConsoleAPICalledNotification> build()
1911 : {
1912 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
1913 : return std::move(m_result);
1914 : }
1915 :
1916 : private:
1917 : friend class ConsoleAPICalledNotification;
1918 14700 : ConsoleAPICalledNotificationBuilder() : m_result(new ConsoleAPICalledNotification()) { }
1919 :
1920 : template<int STEP> ConsoleAPICalledNotificationBuilder<STATE | STEP>& castState()
1921 : {
1922 : return *reinterpret_cast<ConsoleAPICalledNotificationBuilder<STATE | STEP>*>(this);
1923 : }
1924 :
1925 : std::unique_ptr<protocol::Runtime::ConsoleAPICalledNotification> m_result;
1926 : };
1927 :
1928 : static ConsoleAPICalledNotificationBuilder<0> create()
1929 : {
1930 7350 : return ConsoleAPICalledNotificationBuilder<0>();
1931 : }
1932 :
1933 : private:
1934 : ConsoleAPICalledNotification()
1935 14700 : {
1936 7350 : m_executionContextId = 0;
1937 7350 : m_timestamp = 0;
1938 : }
1939 :
1940 : String m_type;
1941 : std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>> m_args;
1942 : int m_executionContextId;
1943 : double m_timestamp;
1944 : Maybe<protocol::Runtime::StackTrace> m_stackTrace;
1945 : };
1946 :
1947 :
1948 : // Wrapper for notification params
1949 : class InspectRequestedNotification : public Serializable{
1950 : PROTOCOL_DISALLOW_COPY(InspectRequestedNotification);
1951 : public:
1952 : static std::unique_ptr<InspectRequestedNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
1953 :
1954 90 : ~InspectRequestedNotification() override { }
1955 :
1956 : protocol::Runtime::RemoteObject* getObject() { return m_object.get(); }
1957 : void setObject(std::unique_ptr<protocol::Runtime::RemoteObject> value) { m_object = std::move(value); }
1958 :
1959 : protocol::DictionaryValue* getHints() { return m_hints.get(); }
1960 : void setHints(std::unique_ptr<protocol::DictionaryValue> value) { m_hints = std::move(value); }
1961 :
1962 : std::unique_ptr<protocol::DictionaryValue> toValue() const;
1963 90 : String serialize() override { return toValue()->serialize(); }
1964 : std::unique_ptr<InspectRequestedNotification> clone() const;
1965 :
1966 : template<int STATE>
1967 : class InspectRequestedNotificationBuilder {
1968 : public:
1969 : enum {
1970 : NoFieldsSet = 0,
1971 : ObjectSet = 1 << 1,
1972 : HintsSet = 1 << 2,
1973 : AllFieldsSet = (ObjectSet | HintsSet | 0)};
1974 :
1975 :
1976 : InspectRequestedNotificationBuilder<STATE | ObjectSet>& setObject(std::unique_ptr<protocol::Runtime::RemoteObject> value)
1977 : {
1978 : static_assert(!(STATE & ObjectSet), "property object should not be set yet");
1979 : m_result->setObject(std::move(value));
1980 : return castState<ObjectSet>();
1981 : }
1982 :
1983 : InspectRequestedNotificationBuilder<STATE | HintsSet>& setHints(std::unique_ptr<protocol::DictionaryValue> value)
1984 : {
1985 : static_assert(!(STATE & HintsSet), "property hints should not be set yet");
1986 : m_result->setHints(std::move(value));
1987 : return castState<HintsSet>();
1988 : }
1989 :
1990 : std::unique_ptr<InspectRequestedNotification> build()
1991 : {
1992 : static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
1993 : return std::move(m_result);
1994 : }
1995 :
1996 : private:
1997 : friend class InspectRequestedNotification;
1998 60 : InspectRequestedNotificationBuilder() : m_result(new InspectRequestedNotification()) { }
1999 :
2000 : template<int STEP> InspectRequestedNotificationBuilder<STATE | STEP>& castState()
2001 : {
2002 : return *reinterpret_cast<InspectRequestedNotificationBuilder<STATE | STEP>*>(this);
2003 : }
2004 :
2005 : std::unique_ptr<protocol::Runtime::InspectRequestedNotification> m_result;
2006 : };
2007 :
2008 : static InspectRequestedNotificationBuilder<0> create()
2009 : {
2010 30 : return InspectRequestedNotificationBuilder<0>();
2011 : }
2012 :
2013 : private:
2014 : InspectRequestedNotification()
2015 30 : {
2016 : }
2017 :
2018 : std::unique_ptr<protocol::Runtime::RemoteObject> m_object;
2019 : std::unique_ptr<protocol::DictionaryValue> m_hints;
2020 : };
2021 :
2022 :
2023 : // ------------- Backend interface.
2024 :
2025 4573 : class Backend {
2026 : public:
2027 4573 : virtual ~Backend() { }
2028 :
2029 4745 : class EvaluateCallback {
2030 : public:
2031 : virtual void sendSuccess(std::unique_ptr<protocol::Runtime::RemoteObject> result, Maybe<protocol::Runtime::ExceptionDetails> exceptionDetails) = 0;
2032 : virtual void sendFailure(const DispatchResponse&) = 0;
2033 : virtual void fallThrough() = 0;
2034 4391 : virtual ~EvaluateCallback() { }
2035 : };
2036 : virtual void evaluate(const String& in_expression, Maybe<String> in_objectGroup, Maybe<bool> in_includeCommandLineAPI, Maybe<bool> in_silent, Maybe<int> in_contextId, Maybe<bool> in_returnByValue, Maybe<bool> in_generatePreview, Maybe<bool> in_userGesture, Maybe<bool> in_awaitPromise, std::unique_ptr<EvaluateCallback> callback) = 0;
2037 36 : class AwaitPromiseCallback {
2038 : public:
2039 : virtual void sendSuccess(std::unique_ptr<protocol::Runtime::RemoteObject> result, Maybe<protocol::Runtime::ExceptionDetails> exceptionDetails) = 0;
2040 : virtual void sendFailure(const DispatchResponse&) = 0;
2041 : virtual void fallThrough() = 0;
2042 36 : virtual ~AwaitPromiseCallback() { }
2043 : };
2044 : virtual void awaitPromise(const String& in_promiseObjectId, Maybe<bool> in_returnByValue, Maybe<bool> in_generatePreview, std::unique_ptr<AwaitPromiseCallback> callback) = 0;
2045 342 : class CallFunctionOnCallback {
2046 : public:
2047 : virtual void sendSuccess(std::unique_ptr<protocol::Runtime::RemoteObject> result, Maybe<protocol::Runtime::ExceptionDetails> exceptionDetails) = 0;
2048 : virtual void sendFailure(const DispatchResponse&) = 0;
2049 : virtual void fallThrough() = 0;
2050 324 : virtual ~CallFunctionOnCallback() { }
2051 : };
2052 : virtual void callFunctionOn(const String& in_objectId, const String& in_functionDeclaration, Maybe<protocol::Array<protocol::Runtime::CallArgument>> in_arguments, Maybe<bool> in_silent, Maybe<bool> in_returnByValue, Maybe<bool> in_generatePreview, Maybe<bool> in_userGesture, Maybe<bool> in_awaitPromise, std::unique_ptr<CallFunctionOnCallback> callback) = 0;
2053 : virtual DispatchResponse getProperties(const String& in_objectId, Maybe<bool> in_ownProperties, Maybe<bool> in_accessorPropertiesOnly, Maybe<bool> in_generatePreview, std::unique_ptr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* out_result, Maybe<protocol::Array<protocol::Runtime::InternalPropertyDescriptor>>* out_internalProperties, Maybe<protocol::Runtime::ExceptionDetails>* out_exceptionDetails) = 0;
2054 : virtual DispatchResponse releaseObject(const String& in_objectId) = 0;
2055 : virtual DispatchResponse releaseObjectGroup(const String& in_objectGroup) = 0;
2056 : virtual DispatchResponse runIfWaitingForDebugger() = 0;
2057 : virtual DispatchResponse enable() = 0;
2058 : virtual DispatchResponse disable() = 0;
2059 : virtual DispatchResponse discardConsoleEntries() = 0;
2060 : virtual DispatchResponse setCustomObjectFormatterEnabled(bool in_enabled) = 0;
2061 : virtual DispatchResponse compileScript(const String& in_expression, const String& in_sourceURL, bool in_persistScript, Maybe<int> in_executionContextId, Maybe<String>* out_scriptId, Maybe<protocol::Runtime::ExceptionDetails>* out_exceptionDetails) = 0;
2062 120 : class RunScriptCallback {
2063 : public:
2064 : virtual void sendSuccess(std::unique_ptr<protocol::Runtime::RemoteObject> result, Maybe<protocol::Runtime::ExceptionDetails> exceptionDetails) = 0;
2065 : virtual void sendFailure(const DispatchResponse&) = 0;
2066 : virtual void fallThrough() = 0;
2067 108 : virtual ~RunScriptCallback() { }
2068 : };
2069 : virtual void runScript(const String& in_scriptId, Maybe<int> in_executionContextId, Maybe<String> in_objectGroup, Maybe<bool> in_silent, Maybe<bool> in_includeCommandLineAPI, Maybe<bool> in_returnByValue, Maybe<bool> in_generatePreview, Maybe<bool> in_awaitPromise, std::unique_ptr<RunScriptCallback> callback) = 0;
2070 :
2071 : };
2072 :
2073 : // ------------- Frontend interface.
2074 :
2075 : class Frontend {
2076 : public:
2077 4573 : explicit Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { }
2078 : void executionContextCreated(std::unique_ptr<protocol::Runtime::ExecutionContextDescription> context);
2079 : void executionContextDestroyed(int executionContextId);
2080 : void executionContextsCleared();
2081 : void exceptionThrown(double timestamp, std::unique_ptr<protocol::Runtime::ExceptionDetails> exceptionDetails);
2082 : void exceptionRevoked(const String& reason, int exceptionId);
2083 : void consoleAPICalled(const String& type, std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>> args, int executionContextId, double timestamp, Maybe<protocol::Runtime::StackTrace> stackTrace = Maybe<protocol::Runtime::StackTrace>());
2084 : void inspectRequested(std::unique_ptr<protocol::Runtime::RemoteObject> object, std::unique_ptr<protocol::DictionaryValue> hints);
2085 :
2086 : void flush();
2087 : void sendRawNotification(const String&);
2088 : private:
2089 : FrontendChannel* m_frontendChannel;
2090 : };
2091 :
2092 : // ------------- Dispatcher.
2093 :
2094 : class Dispatcher {
2095 : public:
2096 : static void wire(UberDispatcher*, Backend*);
2097 :
2098 : private:
2099 : Dispatcher() { }
2100 : };
2101 :
2102 : // ------------- Metainfo.
2103 :
2104 : class Metainfo {
2105 : public:
2106 : using BackendClass = Backend;
2107 : using FrontendClass = Frontend;
2108 : using DispatcherClass = Dispatcher;
2109 : static const char domainName[];
2110 : static const char commandPrefix[];
2111 : static const char version[];
2112 : };
2113 :
2114 : } // namespace Runtime
2115 : } // namespace v8_inspector
2116 : } // namespace protocol
2117 :
2118 : #endif // !defined(v8_inspector_protocol_Runtime_h)
|