1/*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
4 * Copyright (C) 2014 University of Washington. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
19 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
25 * THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28// DO NOT EDIT THIS FILE. It is automatically generated from CombinedDomains.json
29// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
30
31#pragma once
32
33#include "InspectorProtocolTypes.h"
34#include <wtf/Assertions.h>
35
36namespace Inspector {
37
38
39
40namespace Protocol {
41
42// Versions.
43namespace Audit {
44static const unsigned VERSION = 3;
45} // Audit
46
47namespace Recording {
48static const unsigned VERSION = 1;
49} // Recording
50// End of versions.
51
52
53// Forward declarations.
54namespace ApplicationCache {
55class ApplicationCacheResource;
56class ApplicationCache;
57class FrameWithManifest;
58} // ApplicationCache
59
60#if ENABLE(RESOURCE_USAGE)
61namespace CPUProfiler {
62class ThreadInfo;
63class Event;
64} // CPUProfiler
65#endif // ENABLE(RESOURCE_USAGE)
66
67namespace CSS {
68class CSSStyleId;
69class CSSRuleId;
70class PseudoIdMatches;
71class InheritedStyleEntry;
72class RuleMatch;
73class CSSSelector;
74class SelectorList;
75class CSSStyleAttribute;
76class CSSStyleSheetHeader;
77class CSSStyleSheetBody;
78class CSSRule;
79class SourceRange;
80class ShorthandEntry;
81class CSSPropertyInfo;
82class CSSComputedStyleProperty;
83class CSSStyle;
84class CSSProperty;
85class CSSMedia;
86enum class StyleSheetOrigin;
87enum class PseudoId;
88enum class CSSPropertyStatus;
89} // CSS
90
91namespace Canvas {
92class ContextAttributes;
93class Canvas;
94enum class ContextType;
95enum class ShaderType;
96} // Canvas
97
98namespace Console {
99class Channel;
100class ConsoleMessage;
101class CallFrame;
102class StackTrace;
103enum class ChannelSource;
104enum class ChannelLevel;
105} // Console
106
107namespace DOM {
108class Node;
109class DataBinding;
110class EventListener;
111class AccessibilityProperties;
112class RGBAColor;
113class HighlightConfig;
114enum class PseudoType;
115enum class ShadowRootType;
116enum class CustomElementState;
117enum class LiveRegionRelevant;
118} // DOM
119
120namespace DOMDebugger {
121enum class DOMBreakpointType;
122enum class EventBreakpointType;
123} // DOMDebugger
124
125namespace DOMStorage {
126class StorageId;
127} // DOMStorage
128
129namespace Database {
130class Database;
131class Error;
132} // Database
133
134namespace Debugger {
135class Location;
136class BreakpointAction;
137class BreakpointOptions;
138class FunctionDetails;
139class CallFrame;
140class Scope;
141class ProbeSample;
142class AssertPauseReason;
143class BreakpointPauseReason;
144class CSPViolationPauseReason;
145} // Debugger
146
147namespace GenericTypes {
148class SearchMatch;
149} // GenericTypes
150
151namespace Heap {
152class GarbageCollection;
153} // Heap
154
155#if ENABLE(INDEXED_DATABASE)
156namespace IndexedDB {
157class DatabaseWithObjectStores;
158class ObjectStore;
159class ObjectStoreIndex;
160class Key;
161class KeyRange;
162class DataEntry;
163class KeyPath;
164} // IndexedDB
165#endif // ENABLE(INDEXED_DATABASE)
166
167namespace LayerTree {
168class IntRect;
169class Layer;
170class CompositingReasons;
171} // LayerTree
172
173#if ENABLE(RESOURCE_USAGE)
174namespace Memory {
175class Event;
176class CategoryData;
177} // Memory
178#endif // ENABLE(RESOURCE_USAGE)
179
180namespace Network {
181class Headers;
182class ResourceTiming;
183class Request;
184class Response;
185class Metrics;
186class WebSocketRequest;
187class WebSocketResponse;
188class WebSocketFrame;
189class CachedResource;
190class Initiator;
191} // Network
192
193namespace Page {
194class Frame;
195class FrameResource;
196class FrameResourceTree;
197class SearchResult;
198class Cookie;
199enum class Setting;
200enum class ResourceType;
201enum class CoordinateSystem;
202enum class CookieSameSitePolicy;
203enum class Appearance;
204} // Page
205
206namespace Recording {
207class InitialState;
208class Frame;
209class Recording;
210enum class Type;
211enum class Initiator;
212} // Recording
213
214namespace Runtime {
215class RemoteObject;
216class ObjectPreview;
217class PropertyPreview;
218class EntryPreview;
219class CollectionEntry;
220class PropertyDescriptor;
221class InternalPropertyDescriptor;
222class CallArgument;
223class ExecutionContextDescription;
224class ErrorRange;
225class StructureDescription;
226class TypeSet;
227class TypeDescription;
228class TypeLocation;
229class BasicBlock;
230enum class SyntaxErrorType;
231} // Runtime
232
233namespace ScriptProfiler {
234class Event;
235class ExpressionLocation;
236class StackFrame;
237class StackTrace;
238class Samples;
239enum class EventType;
240} // ScriptProfiler
241
242namespace Security {
243class Connection;
244class Certificate;
245class Security;
246} // Security
247
248namespace Target {
249class TargetInfo;
250} // Target
251
252namespace Timeline {
253class TimelineEvent;
254enum class EventType;
255enum class Instrument;
256} // Timeline
257// End of forward declarations.
258
259
260// Typedefs.
261namespace CSS {
262typedef String StyleSheetId;
263} // CSS
264
265namespace Canvas {
266/* Unique canvas identifier. */
267typedef String CanvasId;
268/* Unique shader program identifier. */
269typedef String ProgramId;
270} // Canvas
271
272namespace DOM {
273/* Unique DOM node identifier. */
274typedef int NodeId;
275/* Unique event listener identifier. */
276typedef int EventListenerId;
277/* An array of quad vertices, x immediately followed by y for each point, points clock-wise. */
278typedef JSON::ArrayOf<double> Quad;
279} // DOM
280
281namespace DOMStorage {
282/* DOM Storage item. */
283typedef JSON::ArrayOf<String> Item;
284} // DOMStorage
285
286namespace Database {
287/* Unique identifier of Database object. */
288typedef String DatabaseId;
289} // Database
290
291namespace Debugger {
292/* Breakpoint identifier. */
293typedef String BreakpointId;
294/* Breakpoint action identifier. */
295typedef int BreakpointActionIdentifier;
296/* Unique script identifier. */
297typedef String ScriptId;
298/* Call frame identifier. */
299typedef String CallFrameId;
300} // Debugger
301
302namespace Heap {
303/* JavaScriptCore HeapSnapshot JSON data. */
304typedef String HeapSnapshotData;
305} // Heap
306
307namespace LayerTree {
308/* Unique RenderLayer identifier. */
309typedef String LayerId;
310/* Unique PseudoElement identifier. */
311typedef String PseudoElementId;
312} // LayerTree
313
314namespace Network {
315/* Unique loader identifier. */
316typedef String LoaderId;
317/* Unique frame identifier. */
318typedef String FrameId;
319/* Unique request identifier. */
320typedef String RequestId;
321/* Elapsed seconds since frontend connected. */
322typedef double Timestamp;
323/* Number of seconds since epoch. */
324typedef double Walltime;
325} // Network
326
327namespace Runtime {
328/* Unique object identifier. */
329typedef String RemoteObjectId;
330/* Id of an execution context. */
331typedef int ExecutionContextId;
332} // Runtime
333// End of typedefs.
334
335namespace InspectorHelpers {
336
337JS_EXPORT_PRIVATE String getEnumConstantValue(int code);
338
339template<typename T> String getEnumConstantValue(T enumValue)
340{
341 return getEnumConstantValue(static_cast<int>(enumValue));
342}
343
344} // namespace InspectorHelpers
345
346namespace ApplicationCache {
347/* Detailed application cache resource information. */
348class ApplicationCacheResource : public JSON::ObjectBase {
349public:
350 enum {
351 NoFieldsSet = 0,
352 UrlSet = 1 << 0,
353 SizeSet = 1 << 1,
354 TypeSet = 1 << 2,
355 AllFieldsSet = (UrlSet | SizeSet | TypeSet)
356 };
357
358 template<int STATE>
359 class Builder {
360 private:
361 RefPtr<JSON::Object> m_result;
362
363 template<int STEP> Builder<STATE | STEP>& castState()
364 {
365 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
366 }
367
368 Builder(Ref</*ApplicationCacheResource*/JSON::Object>&& object)
369 : m_result(WTFMove(object))
370 {
371 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
372 }
373 friend class ApplicationCacheResource;
374 public:
375
376 Builder<STATE | UrlSet>& setUrl(const String& value)
377 {
378 COMPILE_ASSERT(!(STATE & UrlSet), property_url_already_set);
379 m_result->setString("url"_s, value);
380 return castState<UrlSet>();
381 }
382
383 Builder<STATE | SizeSet>& setSize(int value)
384 {
385 COMPILE_ASSERT(!(STATE & SizeSet), property_size_already_set);
386 m_result->setInteger("size"_s, value);
387 return castState<SizeSet>();
388 }
389
390 Builder<STATE | TypeSet>& setType(const String& value)
391 {
392 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
393 m_result->setString("type"_s, value);
394 return castState<TypeSet>();
395 }
396
397 Ref<ApplicationCacheResource> release()
398 {
399 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
400 COMPILE_ASSERT(sizeof(ApplicationCacheResource) == sizeof(JSON::Object), cannot_cast);
401
402 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
403 auto result = WTFMove(*reinterpret_cast<Ref<ApplicationCacheResource>*>(&jsonResult));
404 return result;
405 }
406 };
407
408 /*
409 * Synthetic constructor:
410 * Ref<ApplicationCacheResource> result = ApplicationCacheResource::create()
411 * .setUrl(...)
412 * .setSize(...)
413 * .setType(...)
414 * .release();
415 */
416 static Builder<NoFieldsSet> create()
417 {
418 return Builder<NoFieldsSet>(JSON::Object::create());
419 }
420};
421
422/* Detailed application cache information. */
423class ApplicationCache : public JSON::ObjectBase {
424public:
425 enum {
426 NoFieldsSet = 0,
427 ManifestURLSet = 1 << 0,
428 SizeSet = 1 << 1,
429 CreationTimeSet = 1 << 2,
430 UpdateTimeSet = 1 << 3,
431 ResourcesSet = 1 << 4,
432 AllFieldsSet = (ManifestURLSet | SizeSet | CreationTimeSet | UpdateTimeSet | ResourcesSet)
433 };
434
435 template<int STATE>
436 class Builder {
437 private:
438 RefPtr<JSON::Object> m_result;
439
440 template<int STEP> Builder<STATE | STEP>& castState()
441 {
442 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
443 }
444
445 Builder(Ref</*ApplicationCache*/JSON::Object>&& object)
446 : m_result(WTFMove(object))
447 {
448 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
449 }
450 friend class ApplicationCache;
451 public:
452
453 Builder<STATE | ManifestURLSet>& setManifestURL(const String& value)
454 {
455 COMPILE_ASSERT(!(STATE & ManifestURLSet), property_manifestURL_already_set);
456 m_result->setString("manifestURL"_s, value);
457 return castState<ManifestURLSet>();
458 }
459
460 Builder<STATE | SizeSet>& setSize(double value)
461 {
462 COMPILE_ASSERT(!(STATE & SizeSet), property_size_already_set);
463 m_result->setDouble("size"_s, value);
464 return castState<SizeSet>();
465 }
466
467 Builder<STATE | CreationTimeSet>& setCreationTime(double value)
468 {
469 COMPILE_ASSERT(!(STATE & CreationTimeSet), property_creationTime_already_set);
470 m_result->setDouble("creationTime"_s, value);
471 return castState<CreationTimeSet>();
472 }
473
474 Builder<STATE | UpdateTimeSet>& setUpdateTime(double value)
475 {
476 COMPILE_ASSERT(!(STATE & UpdateTimeSet), property_updateTime_already_set);
477 m_result->setDouble("updateTime"_s, value);
478 return castState<UpdateTimeSet>();
479 }
480
481 Builder<STATE | ResourcesSet>& setResources(RefPtr<JSON::ArrayOf<Inspector::Protocol::ApplicationCache::ApplicationCacheResource>> value)
482 {
483 COMPILE_ASSERT(!(STATE & ResourcesSet), property_resources_already_set);
484 m_result->setArray("resources"_s, value);
485 return castState<ResourcesSet>();
486 }
487
488 Ref<ApplicationCache> release()
489 {
490 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
491 COMPILE_ASSERT(sizeof(ApplicationCache) == sizeof(JSON::Object), cannot_cast);
492
493 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
494 auto result = WTFMove(*reinterpret_cast<Ref<ApplicationCache>*>(&jsonResult));
495 return result;
496 }
497 };
498
499 /*
500 * Synthetic constructor:
501 * Ref<ApplicationCache> result = ApplicationCache::create()
502 * .setManifestURL(...)
503 * .setSize(...)
504 * .setCreationTime(...)
505 * .setUpdateTime(...)
506 * .setResources(...)
507 * .release();
508 */
509 static Builder<NoFieldsSet> create()
510 {
511 return Builder<NoFieldsSet>(JSON::Object::create());
512 }
513};
514
515/* Frame identifier - manifest URL pair. */
516class FrameWithManifest : public JSON::ObjectBase {
517public:
518 enum {
519 NoFieldsSet = 0,
520 FrameIdSet = 1 << 0,
521 ManifestURLSet = 1 << 1,
522 StatusSet = 1 << 2,
523 AllFieldsSet = (FrameIdSet | ManifestURLSet | StatusSet)
524 };
525
526 template<int STATE>
527 class Builder {
528 private:
529 RefPtr<JSON::Object> m_result;
530
531 template<int STEP> Builder<STATE | STEP>& castState()
532 {
533 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
534 }
535
536 Builder(Ref</*FrameWithManifest*/JSON::Object>&& object)
537 : m_result(WTFMove(object))
538 {
539 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
540 }
541 friend class FrameWithManifest;
542 public:
543
544 Builder<STATE | FrameIdSet>& setFrameId(const String& value)
545 {
546 COMPILE_ASSERT(!(STATE & FrameIdSet), property_frameId_already_set);
547 m_result->setString("frameId"_s, value);
548 return castState<FrameIdSet>();
549 }
550
551 Builder<STATE | ManifestURLSet>& setManifestURL(const String& value)
552 {
553 COMPILE_ASSERT(!(STATE & ManifestURLSet), property_manifestURL_already_set);
554 m_result->setString("manifestURL"_s, value);
555 return castState<ManifestURLSet>();
556 }
557
558 Builder<STATE | StatusSet>& setStatus(int value)
559 {
560 COMPILE_ASSERT(!(STATE & StatusSet), property_status_already_set);
561 m_result->setInteger("status"_s, value);
562 return castState<StatusSet>();
563 }
564
565 Ref<FrameWithManifest> release()
566 {
567 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
568 COMPILE_ASSERT(sizeof(FrameWithManifest) == sizeof(JSON::Object), cannot_cast);
569
570 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
571 auto result = WTFMove(*reinterpret_cast<Ref<FrameWithManifest>*>(&jsonResult));
572 return result;
573 }
574 };
575
576 /*
577 * Synthetic constructor:
578 * Ref<FrameWithManifest> result = FrameWithManifest::create()
579 * .setFrameId(...)
580 * .setManifestURL(...)
581 * .setStatus(...)
582 * .release();
583 */
584 static Builder<NoFieldsSet> create()
585 {
586 return Builder<NoFieldsSet>(JSON::Object::create());
587 }
588};
589
590} // ApplicationCache
591
592#if ENABLE(RESOURCE_USAGE)
593namespace CPUProfiler {
594/* CPU usage for an individual thread. */
595class ThreadInfo : public JSON::ObjectBase {
596public:
597 // Named after property name 'type' while generating ThreadInfo.
598 enum class Type {
599 Main = 0,
600 WebKit = 1,
601 }; // enum class Type
602 enum {
603 NoFieldsSet = 0,
604 NameSet = 1 << 0,
605 UsageSet = 1 << 1,
606 AllFieldsSet = (NameSet | UsageSet)
607 };
608
609 template<int STATE>
610 class Builder {
611 private:
612 RefPtr<JSON::Object> m_result;
613
614 template<int STEP> Builder<STATE | STEP>& castState()
615 {
616 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
617 }
618
619 Builder(Ref</*ThreadInfo*/JSON::Object>&& object)
620 : m_result(WTFMove(object))
621 {
622 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
623 }
624 friend class ThreadInfo;
625 public:
626
627 Builder<STATE | NameSet>& setName(const String& value)
628 {
629 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
630 m_result->setString("name"_s, value);
631 return castState<NameSet>();
632 }
633
634 Builder<STATE | UsageSet>& setUsage(double value)
635 {
636 COMPILE_ASSERT(!(STATE & UsageSet), property_usage_already_set);
637 m_result->setDouble("usage"_s, value);
638 return castState<UsageSet>();
639 }
640
641 Ref<ThreadInfo> release()
642 {
643 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
644 COMPILE_ASSERT(sizeof(ThreadInfo) == sizeof(JSON::Object), cannot_cast);
645
646 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
647 auto result = WTFMove(*reinterpret_cast<Ref<ThreadInfo>*>(&jsonResult));
648 return result;
649 }
650 };
651
652 /*
653 * Synthetic constructor:
654 * Ref<ThreadInfo> result = ThreadInfo::create()
655 * .setName(...)
656 * .setUsage(...)
657 * .release();
658 */
659 static Builder<NoFieldsSet> create()
660 {
661 return Builder<NoFieldsSet>(JSON::Object::create());
662 }
663
664 void setType(Type value)
665 {
666 JSON::ObjectBase::setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
667 }
668
669 void setTargetId(const String& value)
670 {
671 JSON::ObjectBase::setString("targetId"_s, value);
672 }
673};
674
675class Event : public JSON::ObjectBase {
676public:
677 enum {
678 NoFieldsSet = 0,
679 TimestampSet = 1 << 0,
680 UsageSet = 1 << 1,
681 AllFieldsSet = (TimestampSet | UsageSet)
682 };
683
684 template<int STATE>
685 class Builder {
686 private:
687 RefPtr<JSON::Object> m_result;
688
689 template<int STEP> Builder<STATE | STEP>& castState()
690 {
691 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
692 }
693
694 Builder(Ref</*Event*/JSON::Object>&& object)
695 : m_result(WTFMove(object))
696 {
697 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
698 }
699 friend class Event;
700 public:
701
702 Builder<STATE | TimestampSet>& setTimestamp(double value)
703 {
704 COMPILE_ASSERT(!(STATE & TimestampSet), property_timestamp_already_set);
705 m_result->setDouble("timestamp"_s, value);
706 return castState<TimestampSet>();
707 }
708
709 Builder<STATE | UsageSet>& setUsage(double value)
710 {
711 COMPILE_ASSERT(!(STATE & UsageSet), property_usage_already_set);
712 m_result->setDouble("usage"_s, value);
713 return castState<UsageSet>();
714 }
715
716 Ref<Event> release()
717 {
718 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
719 COMPILE_ASSERT(sizeof(Event) == sizeof(JSON::Object), cannot_cast);
720
721 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
722 auto result = WTFMove(*reinterpret_cast<Ref<Event>*>(&jsonResult));
723 return result;
724 }
725 };
726
727 /*
728 * Synthetic constructor:
729 * Ref<Event> result = Event::create()
730 * .setTimestamp(...)
731 * .setUsage(...)
732 * .release();
733 */
734 static Builder<NoFieldsSet> create()
735 {
736 return Builder<NoFieldsSet>(JSON::Object::create());
737 }
738
739 void setThreads(RefPtr<JSON::ArrayOf<Inspector::Protocol::CPUProfiler::ThreadInfo>> value)
740 {
741 JSON::ObjectBase::setArray("threads"_s, WTFMove(value));
742 }
743};
744
745} // CPUProfiler
746#endif // ENABLE(RESOURCE_USAGE)
747
748namespace CSS {
749/* This object identifies a CSS style in a unique way. */
750class CSSStyleId : public JSON::ObjectBase {
751public:
752 enum {
753 NoFieldsSet = 0,
754 StyleSheetIdSet = 1 << 0,
755 OrdinalSet = 1 << 1,
756 AllFieldsSet = (StyleSheetIdSet | OrdinalSet)
757 };
758
759 template<int STATE>
760 class Builder {
761 private:
762 RefPtr<JSON::Object> m_result;
763
764 template<int STEP> Builder<STATE | STEP>& castState()
765 {
766 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
767 }
768
769 Builder(Ref</*CSSStyleId*/JSON::Object>&& object)
770 : m_result(WTFMove(object))
771 {
772 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
773 }
774 friend class CSSStyleId;
775 public:
776
777 Builder<STATE | StyleSheetIdSet>& setStyleSheetId(const String& value)
778 {
779 COMPILE_ASSERT(!(STATE & StyleSheetIdSet), property_styleSheetId_already_set);
780 m_result->setString("styleSheetId"_s, value);
781 return castState<StyleSheetIdSet>();
782 }
783
784 Builder<STATE | OrdinalSet>& setOrdinal(int value)
785 {
786 COMPILE_ASSERT(!(STATE & OrdinalSet), property_ordinal_already_set);
787 m_result->setInteger("ordinal"_s, value);
788 return castState<OrdinalSet>();
789 }
790
791 Ref<CSSStyleId> release()
792 {
793 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
794 COMPILE_ASSERT(sizeof(CSSStyleId) == sizeof(JSON::Object), cannot_cast);
795
796 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
797 auto result = WTFMove(*reinterpret_cast<Ref<CSSStyleId>*>(&jsonResult));
798 return result;
799 }
800 };
801
802 /*
803 * Synthetic constructor:
804 * Ref<CSSStyleId> result = CSSStyleId::create()
805 * .setStyleSheetId(...)
806 * .setOrdinal(...)
807 * .release();
808 */
809 static Builder<NoFieldsSet> create()
810 {
811 return Builder<NoFieldsSet>(JSON::Object::create());
812 }
813};
814
815/* Stylesheet type: "user" for user stylesheets, "user-agent" for user-agent stylesheets, "inspector" for stylesheets created by the inspector (i.e. those holding the "via inspector" rules), "regular" for regular stylesheets. */
816enum class StyleSheetOrigin {
817 User = 2,
818 UserAgent = 3,
819 Inspector = 4,
820 Regular = 5,
821}; // enum class StyleSheetOrigin
822/* This object identifies a CSS rule in a unique way. */
823class CSSRuleId : public JSON::ObjectBase {
824public:
825 enum {
826 NoFieldsSet = 0,
827 StyleSheetIdSet = 1 << 0,
828 OrdinalSet = 1 << 1,
829 AllFieldsSet = (StyleSheetIdSet | OrdinalSet)
830 };
831
832 template<int STATE>
833 class Builder {
834 private:
835 RefPtr<JSON::Object> m_result;
836
837 template<int STEP> Builder<STATE | STEP>& castState()
838 {
839 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
840 }
841
842 Builder(Ref</*CSSRuleId*/JSON::Object>&& object)
843 : m_result(WTFMove(object))
844 {
845 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
846 }
847 friend class CSSRuleId;
848 public:
849
850 Builder<STATE | StyleSheetIdSet>& setStyleSheetId(const String& value)
851 {
852 COMPILE_ASSERT(!(STATE & StyleSheetIdSet), property_styleSheetId_already_set);
853 m_result->setString("styleSheetId"_s, value);
854 return castState<StyleSheetIdSet>();
855 }
856
857 Builder<STATE | OrdinalSet>& setOrdinal(int value)
858 {
859 COMPILE_ASSERT(!(STATE & OrdinalSet), property_ordinal_already_set);
860 m_result->setInteger("ordinal"_s, value);
861 return castState<OrdinalSet>();
862 }
863
864 Ref<CSSRuleId> release()
865 {
866 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
867 COMPILE_ASSERT(sizeof(CSSRuleId) == sizeof(JSON::Object), cannot_cast);
868
869 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
870 auto result = WTFMove(*reinterpret_cast<Ref<CSSRuleId>*>(&jsonResult));
871 return result;
872 }
873 };
874
875 /*
876 * Synthetic constructor:
877 * Ref<CSSRuleId> result = CSSRuleId::create()
878 * .setStyleSheetId(...)
879 * .setOrdinal(...)
880 * .release();
881 */
882 static Builder<NoFieldsSet> create()
883 {
884 return Builder<NoFieldsSet>(JSON::Object::create());
885 }
886};
887
888/* Pseudo-style identifier (see <code>enum PseudoId</code> in <code>RenderStyleConstants.h</code>). */
889enum class PseudoId {
890 FirstLine = 6,
891 FirstLetter = 7,
892 Marker = 8,
893 Before = 9,
894 After = 10,
895 Selection = 11,
896 Scrollbar = 12,
897 ScrollbarThumb = 13,
898 ScrollbarButton = 14,
899 ScrollbarTrack = 15,
900 ScrollbarTrackPiece = 16,
901 ScrollbarCorner = 17,
902 Resizer = 18,
903}; // enum class PseudoId
904/* CSS rule collection for a single pseudo style. */
905class PseudoIdMatches : public JSON::ObjectBase {
906public:
907 enum {
908 NoFieldsSet = 0,
909 PseudoIdSet = 1 << 0,
910 MatchesSet = 1 << 1,
911 AllFieldsSet = (PseudoIdSet | MatchesSet)
912 };
913
914 template<int STATE>
915 class Builder {
916 private:
917 RefPtr<JSON::Object> m_result;
918
919 template<int STEP> Builder<STATE | STEP>& castState()
920 {
921 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
922 }
923
924 Builder(Ref</*PseudoIdMatches*/JSON::Object>&& object)
925 : m_result(WTFMove(object))
926 {
927 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
928 }
929 friend class PseudoIdMatches;
930 public:
931
932 Builder<STATE | PseudoIdSet>& setPseudoId(Inspector::Protocol::CSS::PseudoId value)
933 {
934 COMPILE_ASSERT(!(STATE & PseudoIdSet), property_pseudoId_already_set);
935 m_result->setString("pseudoId"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
936 return castState<PseudoIdSet>();
937 }
938
939 Builder<STATE | MatchesSet>& setMatches(RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::RuleMatch>> value)
940 {
941 COMPILE_ASSERT(!(STATE & MatchesSet), property_matches_already_set);
942 m_result->setArray("matches"_s, value);
943 return castState<MatchesSet>();
944 }
945
946 Ref<PseudoIdMatches> release()
947 {
948 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
949 COMPILE_ASSERT(sizeof(PseudoIdMatches) == sizeof(JSON::Object), cannot_cast);
950
951 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
952 auto result = WTFMove(*reinterpret_cast<Ref<PseudoIdMatches>*>(&jsonResult));
953 return result;
954 }
955 };
956
957 /*
958 * Synthetic constructor:
959 * Ref<PseudoIdMatches> result = PseudoIdMatches::create()
960 * .setPseudoId(...)
961 * .setMatches(...)
962 * .release();
963 */
964 static Builder<NoFieldsSet> create()
965 {
966 return Builder<NoFieldsSet>(JSON::Object::create());
967 }
968};
969
970/* CSS rule collection for a single pseudo style. */
971class InheritedStyleEntry : public JSON::ObjectBase {
972public:
973 enum {
974 NoFieldsSet = 0,
975 MatchedCSSRulesSet = 1 << 0,
976 AllFieldsSet = (MatchedCSSRulesSet)
977 };
978
979 template<int STATE>
980 class Builder {
981 private:
982 RefPtr<JSON::Object> m_result;
983
984 template<int STEP> Builder<STATE | STEP>& castState()
985 {
986 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
987 }
988
989 Builder(Ref</*InheritedStyleEntry*/JSON::Object>&& object)
990 : m_result(WTFMove(object))
991 {
992 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
993 }
994 friend class InheritedStyleEntry;
995 public:
996
997 Builder<STATE | MatchedCSSRulesSet>& setMatchedCSSRules(RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::RuleMatch>> value)
998 {
999 COMPILE_ASSERT(!(STATE & MatchedCSSRulesSet), property_matchedCSSRules_already_set);
1000 m_result->setArray("matchedCSSRules"_s, value);
1001 return castState<MatchedCSSRulesSet>();
1002 }
1003
1004 Ref<InheritedStyleEntry> release()
1005 {
1006 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
1007 COMPILE_ASSERT(sizeof(InheritedStyleEntry) == sizeof(JSON::Object), cannot_cast);
1008
1009 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
1010 auto result = WTFMove(*reinterpret_cast<Ref<InheritedStyleEntry>*>(&jsonResult));
1011 return result;
1012 }
1013 };
1014
1015 /*
1016 * Synthetic constructor:
1017 * Ref<InheritedStyleEntry> result = InheritedStyleEntry::create()
1018 * .setMatchedCSSRules(...)
1019 * .release();
1020 */
1021 static Builder<NoFieldsSet> create()
1022 {
1023 return Builder<NoFieldsSet>(JSON::Object::create());
1024 }
1025
1026 void setInlineStyle(RefPtr<Inspector::Protocol::CSS::CSSStyle> value)
1027 {
1028 JSON::ObjectBase::setObject("inlineStyle"_s, WTFMove(value));
1029 }
1030};
1031
1032/* Match data for a CSS rule. */
1033class RuleMatch : public JSON::ObjectBase {
1034public:
1035 enum {
1036 NoFieldsSet = 0,
1037 RuleSet = 1 << 0,
1038 MatchingSelectorsSet = 1 << 1,
1039 AllFieldsSet = (RuleSet | MatchingSelectorsSet)
1040 };
1041
1042 template<int STATE>
1043 class Builder {
1044 private:
1045 RefPtr<JSON::Object> m_result;
1046
1047 template<int STEP> Builder<STATE | STEP>& castState()
1048 {
1049 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
1050 }
1051
1052 Builder(Ref</*RuleMatch*/JSON::Object>&& object)
1053 : m_result(WTFMove(object))
1054 {
1055 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
1056 }
1057 friend class RuleMatch;
1058 public:
1059
1060 Builder<STATE | RuleSet>& setRule(RefPtr<Inspector::Protocol::CSS::CSSRule> value)
1061 {
1062 COMPILE_ASSERT(!(STATE & RuleSet), property_rule_already_set);
1063 m_result->setObject("rule"_s, value);
1064 return castState<RuleSet>();
1065 }
1066
1067 Builder<STATE | MatchingSelectorsSet>& setMatchingSelectors(RefPtr<JSON::ArrayOf<int>> value)
1068 {
1069 COMPILE_ASSERT(!(STATE & MatchingSelectorsSet), property_matchingSelectors_already_set);
1070 m_result->setArray("matchingSelectors"_s, value);
1071 return castState<MatchingSelectorsSet>();
1072 }
1073
1074 Ref<RuleMatch> release()
1075 {
1076 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
1077 COMPILE_ASSERT(sizeof(RuleMatch) == sizeof(JSON::Object), cannot_cast);
1078
1079 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
1080 auto result = WTFMove(*reinterpret_cast<Ref<RuleMatch>*>(&jsonResult));
1081 return result;
1082 }
1083 };
1084
1085 /*
1086 * Synthetic constructor:
1087 * Ref<RuleMatch> result = RuleMatch::create()
1088 * .setRule(...)
1089 * .setMatchingSelectors(...)
1090 * .release();
1091 */
1092 static Builder<NoFieldsSet> create()
1093 {
1094 return Builder<NoFieldsSet>(JSON::Object::create());
1095 }
1096};
1097
1098/* CSS selector. */
1099class CSSSelector : public JSON::ObjectBase {
1100public:
1101 enum {
1102 NoFieldsSet = 0,
1103 TextSet = 1 << 0,
1104 AllFieldsSet = (TextSet)
1105 };
1106
1107 template<int STATE>
1108 class Builder {
1109 private:
1110 RefPtr<JSON::Object> m_result;
1111
1112 template<int STEP> Builder<STATE | STEP>& castState()
1113 {
1114 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
1115 }
1116
1117 Builder(Ref</*CSSSelector*/JSON::Object>&& object)
1118 : m_result(WTFMove(object))
1119 {
1120 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
1121 }
1122 friend class CSSSelector;
1123 public:
1124
1125 Builder<STATE | TextSet>& setText(const String& value)
1126 {
1127 COMPILE_ASSERT(!(STATE & TextSet), property_text_already_set);
1128 m_result->setString("text"_s, value);
1129 return castState<TextSet>();
1130 }
1131
1132 Ref<CSSSelector> release()
1133 {
1134 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
1135 COMPILE_ASSERT(sizeof(CSSSelector) == sizeof(JSON::Object), cannot_cast);
1136
1137 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
1138 auto result = WTFMove(*reinterpret_cast<Ref<CSSSelector>*>(&jsonResult));
1139 return result;
1140 }
1141 };
1142
1143 /*
1144 * Synthetic constructor:
1145 * Ref<CSSSelector> result = CSSSelector::create()
1146 * .setText(...)
1147 * .release();
1148 */
1149 static Builder<NoFieldsSet> create()
1150 {
1151 return Builder<NoFieldsSet>(JSON::Object::create());
1152 }
1153
1154 void setSpecificity(RefPtr<JSON::ArrayOf<int>> value)
1155 {
1156 JSON::ObjectBase::setArray("specificity"_s, WTFMove(value));
1157 }
1158
1159 void setDynamic(bool value)
1160 {
1161 JSON::ObjectBase::setBoolean("dynamic"_s, value);
1162 }
1163};
1164
1165/* Selector list data. */
1166class SelectorList : public JSON::ObjectBase {
1167public:
1168 enum {
1169 NoFieldsSet = 0,
1170 SelectorsSet = 1 << 0,
1171 TextSet = 1 << 1,
1172 AllFieldsSet = (SelectorsSet | TextSet)
1173 };
1174
1175 template<int STATE>
1176 class Builder {
1177 private:
1178 RefPtr<JSON::Object> m_result;
1179
1180 template<int STEP> Builder<STATE | STEP>& castState()
1181 {
1182 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
1183 }
1184
1185 Builder(Ref</*SelectorList*/JSON::Object>&& object)
1186 : m_result(WTFMove(object))
1187 {
1188 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
1189 }
1190 friend class SelectorList;
1191 public:
1192
1193 Builder<STATE | SelectorsSet>& setSelectors(RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::CSSSelector>> value)
1194 {
1195 COMPILE_ASSERT(!(STATE & SelectorsSet), property_selectors_already_set);
1196 m_result->setArray("selectors"_s, value);
1197 return castState<SelectorsSet>();
1198 }
1199
1200 Builder<STATE | TextSet>& setText(const String& value)
1201 {
1202 COMPILE_ASSERT(!(STATE & TextSet), property_text_already_set);
1203 m_result->setString("text"_s, value);
1204 return castState<TextSet>();
1205 }
1206
1207 Ref<SelectorList> release()
1208 {
1209 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
1210 COMPILE_ASSERT(sizeof(SelectorList) == sizeof(JSON::Object), cannot_cast);
1211
1212 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
1213 auto result = WTFMove(*reinterpret_cast<Ref<SelectorList>*>(&jsonResult));
1214 return result;
1215 }
1216 };
1217
1218 /*
1219 * Synthetic constructor:
1220 * Ref<SelectorList> result = SelectorList::create()
1221 * .setSelectors(...)
1222 * .setText(...)
1223 * .release();
1224 */
1225 static Builder<NoFieldsSet> create()
1226 {
1227 return Builder<NoFieldsSet>(JSON::Object::create());
1228 }
1229
1230 void setRange(RefPtr<Inspector::Protocol::CSS::SourceRange> value)
1231 {
1232 JSON::ObjectBase::setObject("range"_s, WTFMove(value));
1233 }
1234};
1235
1236/* CSS style information for a DOM style attribute. */
1237class CSSStyleAttribute : public JSON::ObjectBase {
1238public:
1239 enum {
1240 NoFieldsSet = 0,
1241 NameSet = 1 << 0,
1242 StyleSet = 1 << 1,
1243 AllFieldsSet = (NameSet | StyleSet)
1244 };
1245
1246 template<int STATE>
1247 class Builder {
1248 private:
1249 RefPtr<JSON::Object> m_result;
1250
1251 template<int STEP> Builder<STATE | STEP>& castState()
1252 {
1253 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
1254 }
1255
1256 Builder(Ref</*CSSStyleAttribute*/JSON::Object>&& object)
1257 : m_result(WTFMove(object))
1258 {
1259 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
1260 }
1261 friend class CSSStyleAttribute;
1262 public:
1263
1264 Builder<STATE | NameSet>& setName(const String& value)
1265 {
1266 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
1267 m_result->setString("name"_s, value);
1268 return castState<NameSet>();
1269 }
1270
1271 Builder<STATE | StyleSet>& setStyle(RefPtr<Inspector::Protocol::CSS::CSSStyle> value)
1272 {
1273 COMPILE_ASSERT(!(STATE & StyleSet), property_style_already_set);
1274 m_result->setObject("style"_s, value);
1275 return castState<StyleSet>();
1276 }
1277
1278 Ref<CSSStyleAttribute> release()
1279 {
1280 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
1281 COMPILE_ASSERT(sizeof(CSSStyleAttribute) == sizeof(JSON::Object), cannot_cast);
1282
1283 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
1284 auto result = WTFMove(*reinterpret_cast<Ref<CSSStyleAttribute>*>(&jsonResult));
1285 return result;
1286 }
1287 };
1288
1289 /*
1290 * Synthetic constructor:
1291 * Ref<CSSStyleAttribute> result = CSSStyleAttribute::create()
1292 * .setName(...)
1293 * .setStyle(...)
1294 * .release();
1295 */
1296 static Builder<NoFieldsSet> create()
1297 {
1298 return Builder<NoFieldsSet>(JSON::Object::create());
1299 }
1300};
1301
1302/* CSS stylesheet meta-information. */
1303class CSSStyleSheetHeader : public JSON::ObjectBase {
1304public:
1305 enum {
1306 NoFieldsSet = 0,
1307 StyleSheetIdSet = 1 << 0,
1308 FrameIdSet = 1 << 1,
1309 SourceURLSet = 1 << 2,
1310 OriginSet = 1 << 3,
1311 TitleSet = 1 << 4,
1312 DisabledSet = 1 << 5,
1313 IsInlineSet = 1 << 6,
1314 StartLineSet = 1 << 7,
1315 StartColumnSet = 1 << 8,
1316 AllFieldsSet = (StyleSheetIdSet | FrameIdSet | SourceURLSet | OriginSet | TitleSet | DisabledSet | IsInlineSet | StartLineSet | StartColumnSet)
1317 };
1318
1319 template<int STATE>
1320 class Builder {
1321 private:
1322 RefPtr<JSON::Object> m_result;
1323
1324 template<int STEP> Builder<STATE | STEP>& castState()
1325 {
1326 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
1327 }
1328
1329 Builder(Ref</*CSSStyleSheetHeader*/JSON::Object>&& object)
1330 : m_result(WTFMove(object))
1331 {
1332 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
1333 }
1334 friend class CSSStyleSheetHeader;
1335 public:
1336
1337 Builder<STATE | StyleSheetIdSet>& setStyleSheetId(const String& value)
1338 {
1339 COMPILE_ASSERT(!(STATE & StyleSheetIdSet), property_styleSheetId_already_set);
1340 m_result->setString("styleSheetId"_s, value);
1341 return castState<StyleSheetIdSet>();
1342 }
1343
1344 Builder<STATE | FrameIdSet>& setFrameId(const String& value)
1345 {
1346 COMPILE_ASSERT(!(STATE & FrameIdSet), property_frameId_already_set);
1347 m_result->setString("frameId"_s, value);
1348 return castState<FrameIdSet>();
1349 }
1350
1351 Builder<STATE | SourceURLSet>& setSourceURL(const String& value)
1352 {
1353 COMPILE_ASSERT(!(STATE & SourceURLSet), property_sourceURL_already_set);
1354 m_result->setString("sourceURL"_s, value);
1355 return castState<SourceURLSet>();
1356 }
1357
1358 Builder<STATE | OriginSet>& setOrigin(Inspector::Protocol::CSS::StyleSheetOrigin value)
1359 {
1360 COMPILE_ASSERT(!(STATE & OriginSet), property_origin_already_set);
1361 m_result->setString("origin"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
1362 return castState<OriginSet>();
1363 }
1364
1365 Builder<STATE | TitleSet>& setTitle(const String& value)
1366 {
1367 COMPILE_ASSERT(!(STATE & TitleSet), property_title_already_set);
1368 m_result->setString("title"_s, value);
1369 return castState<TitleSet>();
1370 }
1371
1372 Builder<STATE | DisabledSet>& setDisabled(bool value)
1373 {
1374 COMPILE_ASSERT(!(STATE & DisabledSet), property_disabled_already_set);
1375 m_result->setBoolean("disabled"_s, value);
1376 return castState<DisabledSet>();
1377 }
1378
1379 Builder<STATE | IsInlineSet>& setIsInline(bool value)
1380 {
1381 COMPILE_ASSERT(!(STATE & IsInlineSet), property_isInline_already_set);
1382 m_result->setBoolean("isInline"_s, value);
1383 return castState<IsInlineSet>();
1384 }
1385
1386 Builder<STATE | StartLineSet>& setStartLine(double value)
1387 {
1388 COMPILE_ASSERT(!(STATE & StartLineSet), property_startLine_already_set);
1389 m_result->setDouble("startLine"_s, value);
1390 return castState<StartLineSet>();
1391 }
1392
1393 Builder<STATE | StartColumnSet>& setStartColumn(double value)
1394 {
1395 COMPILE_ASSERT(!(STATE & StartColumnSet), property_startColumn_already_set);
1396 m_result->setDouble("startColumn"_s, value);
1397 return castState<StartColumnSet>();
1398 }
1399
1400 Ref<CSSStyleSheetHeader> release()
1401 {
1402 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
1403 COMPILE_ASSERT(sizeof(CSSStyleSheetHeader) == sizeof(JSON::Object), cannot_cast);
1404
1405 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
1406 auto result = WTFMove(*reinterpret_cast<Ref<CSSStyleSheetHeader>*>(&jsonResult));
1407 return result;
1408 }
1409 };
1410
1411 /*
1412 * Synthetic constructor:
1413 * Ref<CSSStyleSheetHeader> result = CSSStyleSheetHeader::create()
1414 * .setStyleSheetId(...)
1415 * .setFrameId(...)
1416 * .setSourceURL(...)
1417 * .setOrigin(...)
1418 * .setTitle(...)
1419 * .setDisabled(...)
1420 * .setIsInline(...)
1421 * .setStartLine(...)
1422 * .setStartColumn(...)
1423 * .release();
1424 */
1425 static Builder<NoFieldsSet> create()
1426 {
1427 return Builder<NoFieldsSet>(JSON::Object::create());
1428 }
1429};
1430
1431/* CSS stylesheet contents. */
1432class CSSStyleSheetBody : public JSON::ObjectBase {
1433public:
1434 enum {
1435 NoFieldsSet = 0,
1436 StyleSheetIdSet = 1 << 0,
1437 RulesSet = 1 << 1,
1438 AllFieldsSet = (StyleSheetIdSet | RulesSet)
1439 };
1440
1441 template<int STATE>
1442 class Builder {
1443 private:
1444 RefPtr<JSON::Object> m_result;
1445
1446 template<int STEP> Builder<STATE | STEP>& castState()
1447 {
1448 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
1449 }
1450
1451 Builder(Ref</*CSSStyleSheetBody*/JSON::Object>&& object)
1452 : m_result(WTFMove(object))
1453 {
1454 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
1455 }
1456 friend class CSSStyleSheetBody;
1457 public:
1458
1459 Builder<STATE | StyleSheetIdSet>& setStyleSheetId(const String& value)
1460 {
1461 COMPILE_ASSERT(!(STATE & StyleSheetIdSet), property_styleSheetId_already_set);
1462 m_result->setString("styleSheetId"_s, value);
1463 return castState<StyleSheetIdSet>();
1464 }
1465
1466 Builder<STATE | RulesSet>& setRules(RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::CSSRule>> value)
1467 {
1468 COMPILE_ASSERT(!(STATE & RulesSet), property_rules_already_set);
1469 m_result->setArray("rules"_s, value);
1470 return castState<RulesSet>();
1471 }
1472
1473 Ref<CSSStyleSheetBody> release()
1474 {
1475 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
1476 COMPILE_ASSERT(sizeof(CSSStyleSheetBody) == sizeof(JSON::Object), cannot_cast);
1477
1478 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
1479 auto result = WTFMove(*reinterpret_cast<Ref<CSSStyleSheetBody>*>(&jsonResult));
1480 return result;
1481 }
1482 };
1483
1484 /*
1485 * Synthetic constructor:
1486 * Ref<CSSStyleSheetBody> result = CSSStyleSheetBody::create()
1487 * .setStyleSheetId(...)
1488 * .setRules(...)
1489 * .release();
1490 */
1491 static Builder<NoFieldsSet> create()
1492 {
1493 return Builder<NoFieldsSet>(JSON::Object::create());
1494 }
1495
1496 void setText(const String& value)
1497 {
1498 JSON::ObjectBase::setString("text"_s, value);
1499 }
1500};
1501
1502/* CSS rule representation. */
1503class CSSRule : public JSON::ObjectBase {
1504public:
1505 enum {
1506 NoFieldsSet = 0,
1507 SelectorListSet = 1 << 0,
1508 SourceLineSet = 1 << 1,
1509 OriginSet = 1 << 2,
1510 StyleSet = 1 << 3,
1511 AllFieldsSet = (SelectorListSet | SourceLineSet | OriginSet | StyleSet)
1512 };
1513
1514 template<int STATE>
1515 class Builder {
1516 private:
1517 RefPtr<JSON::Object> m_result;
1518
1519 template<int STEP> Builder<STATE | STEP>& castState()
1520 {
1521 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
1522 }
1523
1524 Builder(Ref</*CSSRule*/JSON::Object>&& object)
1525 : m_result(WTFMove(object))
1526 {
1527 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
1528 }
1529 friend class CSSRule;
1530 public:
1531
1532 Builder<STATE | SelectorListSet>& setSelectorList(RefPtr<Inspector::Protocol::CSS::SelectorList> value)
1533 {
1534 COMPILE_ASSERT(!(STATE & SelectorListSet), property_selectorList_already_set);
1535 m_result->setObject("selectorList"_s, value);
1536 return castState<SelectorListSet>();
1537 }
1538
1539 Builder<STATE | SourceLineSet>& setSourceLine(int value)
1540 {
1541 COMPILE_ASSERT(!(STATE & SourceLineSet), property_sourceLine_already_set);
1542 m_result->setInteger("sourceLine"_s, value);
1543 return castState<SourceLineSet>();
1544 }
1545
1546 Builder<STATE | OriginSet>& setOrigin(Inspector::Protocol::CSS::StyleSheetOrigin value)
1547 {
1548 COMPILE_ASSERT(!(STATE & OriginSet), property_origin_already_set);
1549 m_result->setString("origin"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
1550 return castState<OriginSet>();
1551 }
1552
1553 Builder<STATE | StyleSet>& setStyle(RefPtr<Inspector::Protocol::CSS::CSSStyle> value)
1554 {
1555 COMPILE_ASSERT(!(STATE & StyleSet), property_style_already_set);
1556 m_result->setObject("style"_s, value);
1557 return castState<StyleSet>();
1558 }
1559
1560 Ref<CSSRule> release()
1561 {
1562 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
1563 COMPILE_ASSERT(sizeof(CSSRule) == sizeof(JSON::Object), cannot_cast);
1564
1565 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
1566 auto result = WTFMove(*reinterpret_cast<Ref<CSSRule>*>(&jsonResult));
1567 return result;
1568 }
1569 };
1570
1571 /*
1572 * Synthetic constructor:
1573 * Ref<CSSRule> result = CSSRule::create()
1574 * .setSelectorList(...)
1575 * .setSourceLine(...)
1576 * .setOrigin(...)
1577 * .setStyle(...)
1578 * .release();
1579 */
1580 static Builder<NoFieldsSet> create()
1581 {
1582 return Builder<NoFieldsSet>(JSON::Object::create());
1583 }
1584
1585 void setRuleId(RefPtr<Inspector::Protocol::CSS::CSSRuleId> value)
1586 {
1587 JSON::ObjectBase::setObject("ruleId"_s, WTFMove(value));
1588 }
1589
1590 void setSourceURL(const String& value)
1591 {
1592 JSON::ObjectBase::setString("sourceURL"_s, value);
1593 }
1594
1595 void setMedia(RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::CSSMedia>> value)
1596 {
1597 JSON::ObjectBase::setArray("media"_s, WTFMove(value));
1598 }
1599};
1600
1601/* Text range within a resource. */
1602class SourceRange : public JSON::ObjectBase {
1603public:
1604 enum {
1605 NoFieldsSet = 0,
1606 StartLineSet = 1 << 0,
1607 StartColumnSet = 1 << 1,
1608 EndLineSet = 1 << 2,
1609 EndColumnSet = 1 << 3,
1610 AllFieldsSet = (StartLineSet | StartColumnSet | EndLineSet | EndColumnSet)
1611 };
1612
1613 template<int STATE>
1614 class Builder {
1615 private:
1616 RefPtr<JSON::Object> m_result;
1617
1618 template<int STEP> Builder<STATE | STEP>& castState()
1619 {
1620 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
1621 }
1622
1623 Builder(Ref</*SourceRange*/JSON::Object>&& object)
1624 : m_result(WTFMove(object))
1625 {
1626 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
1627 }
1628 friend class SourceRange;
1629 public:
1630
1631 Builder<STATE | StartLineSet>& setStartLine(int value)
1632 {
1633 COMPILE_ASSERT(!(STATE & StartLineSet), property_startLine_already_set);
1634 m_result->setInteger("startLine"_s, value);
1635 return castState<StartLineSet>();
1636 }
1637
1638 Builder<STATE | StartColumnSet>& setStartColumn(int value)
1639 {
1640 COMPILE_ASSERT(!(STATE & StartColumnSet), property_startColumn_already_set);
1641 m_result->setInteger("startColumn"_s, value);
1642 return castState<StartColumnSet>();
1643 }
1644
1645 Builder<STATE | EndLineSet>& setEndLine(int value)
1646 {
1647 COMPILE_ASSERT(!(STATE & EndLineSet), property_endLine_already_set);
1648 m_result->setInteger("endLine"_s, value);
1649 return castState<EndLineSet>();
1650 }
1651
1652 Builder<STATE | EndColumnSet>& setEndColumn(int value)
1653 {
1654 COMPILE_ASSERT(!(STATE & EndColumnSet), property_endColumn_already_set);
1655 m_result->setInteger("endColumn"_s, value);
1656 return castState<EndColumnSet>();
1657 }
1658
1659 Ref<SourceRange> release()
1660 {
1661 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
1662 COMPILE_ASSERT(sizeof(SourceRange) == sizeof(JSON::Object), cannot_cast);
1663
1664 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
1665 auto result = WTFMove(*reinterpret_cast<Ref<SourceRange>*>(&jsonResult));
1666 return result;
1667 }
1668 };
1669
1670 /*
1671 * Synthetic constructor:
1672 * Ref<SourceRange> result = SourceRange::create()
1673 * .setStartLine(...)
1674 * .setStartColumn(...)
1675 * .setEndLine(...)
1676 * .setEndColumn(...)
1677 * .release();
1678 */
1679 static Builder<NoFieldsSet> create()
1680 {
1681 return Builder<NoFieldsSet>(JSON::Object::create());
1682 }
1683};
1684
1685class ShorthandEntry : public JSON::ObjectBase {
1686public:
1687 enum {
1688 NoFieldsSet = 0,
1689 NameSet = 1 << 0,
1690 ValueSet = 1 << 1,
1691 AllFieldsSet = (NameSet | ValueSet)
1692 };
1693
1694 template<int STATE>
1695 class Builder {
1696 private:
1697 RefPtr<JSON::Object> m_result;
1698
1699 template<int STEP> Builder<STATE | STEP>& castState()
1700 {
1701 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
1702 }
1703
1704 Builder(Ref</*ShorthandEntry*/JSON::Object>&& object)
1705 : m_result(WTFMove(object))
1706 {
1707 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
1708 }
1709 friend class ShorthandEntry;
1710 public:
1711
1712 Builder<STATE | NameSet>& setName(const String& value)
1713 {
1714 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
1715 m_result->setString("name"_s, value);
1716 return castState<NameSet>();
1717 }
1718
1719 Builder<STATE | ValueSet>& setValue(const String& value)
1720 {
1721 COMPILE_ASSERT(!(STATE & ValueSet), property_value_already_set);
1722 m_result->setString("value"_s, value);
1723 return castState<ValueSet>();
1724 }
1725
1726 Ref<ShorthandEntry> release()
1727 {
1728 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
1729 COMPILE_ASSERT(sizeof(ShorthandEntry) == sizeof(JSON::Object), cannot_cast);
1730
1731 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
1732 auto result = WTFMove(*reinterpret_cast<Ref<ShorthandEntry>*>(&jsonResult));
1733 return result;
1734 }
1735 };
1736
1737 /*
1738 * Synthetic constructor:
1739 * Ref<ShorthandEntry> result = ShorthandEntry::create()
1740 * .setName(...)
1741 * .setValue(...)
1742 * .release();
1743 */
1744 static Builder<NoFieldsSet> create()
1745 {
1746 return Builder<NoFieldsSet>(JSON::Object::create());
1747 }
1748};
1749
1750class CSSPropertyInfo : public JSON::ObjectBase {
1751public:
1752 enum {
1753 NoFieldsSet = 0,
1754 NameSet = 1 << 0,
1755 AllFieldsSet = (NameSet)
1756 };
1757
1758 template<int STATE>
1759 class Builder {
1760 private:
1761 RefPtr<JSON::Object> m_result;
1762
1763 template<int STEP> Builder<STATE | STEP>& castState()
1764 {
1765 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
1766 }
1767
1768 Builder(Ref</*CSSPropertyInfo*/JSON::Object>&& object)
1769 : m_result(WTFMove(object))
1770 {
1771 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
1772 }
1773 friend class CSSPropertyInfo;
1774 public:
1775
1776 Builder<STATE | NameSet>& setName(const String& value)
1777 {
1778 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
1779 m_result->setString("name"_s, value);
1780 return castState<NameSet>();
1781 }
1782
1783 Ref<CSSPropertyInfo> release()
1784 {
1785 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
1786 COMPILE_ASSERT(sizeof(CSSPropertyInfo) == sizeof(JSON::Object), cannot_cast);
1787
1788 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
1789 auto result = WTFMove(*reinterpret_cast<Ref<CSSPropertyInfo>*>(&jsonResult));
1790 return result;
1791 }
1792 };
1793
1794 /*
1795 * Synthetic constructor:
1796 * Ref<CSSPropertyInfo> result = CSSPropertyInfo::create()
1797 * .setName(...)
1798 * .release();
1799 */
1800 static Builder<NoFieldsSet> create()
1801 {
1802 return Builder<NoFieldsSet>(JSON::Object::create());
1803 }
1804
1805 void setAliases(RefPtr<JSON::ArrayOf<String>> value)
1806 {
1807 JSON::ObjectBase::setArray("aliases"_s, WTFMove(value));
1808 }
1809
1810 void setLonghands(RefPtr<JSON::ArrayOf<String>> value)
1811 {
1812 JSON::ObjectBase::setArray("longhands"_s, WTFMove(value));
1813 }
1814
1815 void setValues(RefPtr<JSON::ArrayOf<String>> value)
1816 {
1817 JSON::ObjectBase::setArray("values"_s, WTFMove(value));
1818 }
1819
1820 void setInherited(bool value)
1821 {
1822 JSON::ObjectBase::setBoolean("inherited"_s, value);
1823 }
1824};
1825
1826class CSSComputedStyleProperty : public JSON::ObjectBase {
1827public:
1828 enum {
1829 NoFieldsSet = 0,
1830 NameSet = 1 << 0,
1831 ValueSet = 1 << 1,
1832 AllFieldsSet = (NameSet | ValueSet)
1833 };
1834
1835 template<int STATE>
1836 class Builder {
1837 private:
1838 RefPtr<JSON::Object> m_result;
1839
1840 template<int STEP> Builder<STATE | STEP>& castState()
1841 {
1842 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
1843 }
1844
1845 Builder(Ref</*CSSComputedStyleProperty*/JSON::Object>&& object)
1846 : m_result(WTFMove(object))
1847 {
1848 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
1849 }
1850 friend class CSSComputedStyleProperty;
1851 public:
1852
1853 Builder<STATE | NameSet>& setName(const String& value)
1854 {
1855 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
1856 m_result->setString("name"_s, value);
1857 return castState<NameSet>();
1858 }
1859
1860 Builder<STATE | ValueSet>& setValue(const String& value)
1861 {
1862 COMPILE_ASSERT(!(STATE & ValueSet), property_value_already_set);
1863 m_result->setString("value"_s, value);
1864 return castState<ValueSet>();
1865 }
1866
1867 Ref<CSSComputedStyleProperty> release()
1868 {
1869 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
1870 COMPILE_ASSERT(sizeof(CSSComputedStyleProperty) == sizeof(JSON::Object), cannot_cast);
1871
1872 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
1873 auto result = WTFMove(*reinterpret_cast<Ref<CSSComputedStyleProperty>*>(&jsonResult));
1874 return result;
1875 }
1876 };
1877
1878 /*
1879 * Synthetic constructor:
1880 * Ref<CSSComputedStyleProperty> result = CSSComputedStyleProperty::create()
1881 * .setName(...)
1882 * .setValue(...)
1883 * .release();
1884 */
1885 static Builder<NoFieldsSet> create()
1886 {
1887 return Builder<NoFieldsSet>(JSON::Object::create());
1888 }
1889};
1890
1891/* CSS style representation. */
1892class CSSStyle : public JSON::ObjectBase {
1893public:
1894 enum {
1895 NoFieldsSet = 0,
1896 CssPropertiesSet = 1 << 0,
1897 ShorthandEntriesSet = 1 << 1,
1898 AllFieldsSet = (CssPropertiesSet | ShorthandEntriesSet)
1899 };
1900
1901 template<int STATE>
1902 class Builder {
1903 private:
1904 RefPtr<JSON::Object> m_result;
1905
1906 template<int STEP> Builder<STATE | STEP>& castState()
1907 {
1908 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
1909 }
1910
1911 Builder(Ref</*CSSStyle*/JSON::Object>&& object)
1912 : m_result(WTFMove(object))
1913 {
1914 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
1915 }
1916 friend class CSSStyle;
1917 public:
1918
1919 Builder<STATE | CssPropertiesSet>& setCssProperties(RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::CSSProperty>> value)
1920 {
1921 COMPILE_ASSERT(!(STATE & CssPropertiesSet), property_cssProperties_already_set);
1922 m_result->setArray("cssProperties"_s, value);
1923 return castState<CssPropertiesSet>();
1924 }
1925
1926 Builder<STATE | ShorthandEntriesSet>& setShorthandEntries(RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::ShorthandEntry>> value)
1927 {
1928 COMPILE_ASSERT(!(STATE & ShorthandEntriesSet), property_shorthandEntries_already_set);
1929 m_result->setArray("shorthandEntries"_s, value);
1930 return castState<ShorthandEntriesSet>();
1931 }
1932
1933 Ref<CSSStyle> release()
1934 {
1935 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
1936 COMPILE_ASSERT(sizeof(CSSStyle) == sizeof(JSON::Object), cannot_cast);
1937
1938 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
1939 auto result = WTFMove(*reinterpret_cast<Ref<CSSStyle>*>(&jsonResult));
1940 return result;
1941 }
1942 };
1943
1944 /*
1945 * Synthetic constructor:
1946 * Ref<CSSStyle> result = CSSStyle::create()
1947 * .setCssProperties(...)
1948 * .setShorthandEntries(...)
1949 * .release();
1950 */
1951 static Builder<NoFieldsSet> create()
1952 {
1953 return Builder<NoFieldsSet>(JSON::Object::create());
1954 }
1955
1956 void setStyleId(RefPtr<Inspector::Protocol::CSS::CSSStyleId> value)
1957 {
1958 JSON::ObjectBase::setObject("styleId"_s, WTFMove(value));
1959 }
1960
1961 void setCssText(const String& value)
1962 {
1963 JSON::ObjectBase::setString("cssText"_s, value);
1964 }
1965
1966 void setRange(RefPtr<Inspector::Protocol::CSS::SourceRange> value)
1967 {
1968 JSON::ObjectBase::setObject("range"_s, WTFMove(value));
1969 }
1970
1971 void setWidth(const String& value)
1972 {
1973 JSON::ObjectBase::setString("width"_s, value);
1974 }
1975
1976 void setHeight(const String& value)
1977 {
1978 JSON::ObjectBase::setString("height"_s, value);
1979 }
1980};
1981
1982/* The property status: "active" if the property is effective in the style, "inactive" if the property is overridden by a same-named property in this style later on, "disabled" if the property is disabled by the user, "style" (implied if absent) if the property is reported by the browser rather than by the CSS source parser. */
1983enum class CSSPropertyStatus {
1984 Active = 19,
1985 Inactive = 20,
1986 Disabled = 21,
1987 Style = 22,
1988}; // enum class CSSPropertyStatus
1989/* CSS style effective visual dimensions and source offsets. */
1990class CSSProperty : public JSON::Object {
1991public:
1992 enum {
1993 NoFieldsSet = 0,
1994 NameSet = 1 << 0,
1995 ValueSet = 1 << 1,
1996 AllFieldsSet = (NameSet | ValueSet)
1997 };
1998
1999 template<int STATE>
2000 class Builder {
2001 private:
2002 RefPtr<JSON::Object> m_result;
2003
2004 template<int STEP> Builder<STATE | STEP>& castState()
2005 {
2006 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
2007 }
2008
2009 Builder(Ref</*CSSProperty*/JSON::Object>&& object)
2010 : m_result(WTFMove(object))
2011 {
2012 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
2013 }
2014 friend class CSSProperty;
2015 public:
2016
2017 Builder<STATE | NameSet>& setName(const String& value)
2018 {
2019 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
2020 m_result->setString("name"_s, value);
2021 return castState<NameSet>();
2022 }
2023
2024 Builder<STATE | ValueSet>& setValue(const String& value)
2025 {
2026 COMPILE_ASSERT(!(STATE & ValueSet), property_value_already_set);
2027 m_result->setString("value"_s, value);
2028 return castState<ValueSet>();
2029 }
2030
2031 Ref<CSSProperty> release()
2032 {
2033 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
2034 COMPILE_ASSERT(sizeof(CSSProperty) == sizeof(JSON::Object), cannot_cast);
2035
2036 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
2037 auto result = WTFMove(*reinterpret_cast<Ref<CSSProperty>*>(&jsonResult));
2038 return result;
2039 }
2040 };
2041
2042 /*
2043 * Synthetic constructor:
2044 * Ref<CSSProperty> result = CSSProperty::create()
2045 * .setName(...)
2046 * .setValue(...)
2047 * .release();
2048 */
2049 static Builder<NoFieldsSet> create()
2050 {
2051 return Builder<NoFieldsSet>(JSON::Object::create());
2052 }
2053
2054 void setPriority(const String& value)
2055 {
2056 JSON::ObjectBase::setString("priority"_s, value);
2057 }
2058
2059 void setImplicit(bool value)
2060 {
2061 JSON::ObjectBase::setBoolean("implicit"_s, value);
2062 }
2063
2064 void setText(const String& value)
2065 {
2066 JSON::ObjectBase::setString("text"_s, value);
2067 }
2068
2069 void setParsedOk(bool value)
2070 {
2071 JSON::ObjectBase::setBoolean("parsedOk"_s, value);
2072 }
2073
2074 void setStatus(Inspector::Protocol::CSS::CSSPropertyStatus value)
2075 {
2076 JSON::ObjectBase::setString("status"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
2077 }
2078
2079 void setRange(RefPtr<Inspector::Protocol::CSS::SourceRange> value)
2080 {
2081 JSON::ObjectBase::setObject("range"_s, WTFMove(value));
2082 }
2083
2084 // Property names for type generated as open.
2085 JS_EXPORT_PRIVATE static const char* Name;
2086 JS_EXPORT_PRIVATE static const char* Value;
2087 JS_EXPORT_PRIVATE static const char* Priority;
2088 JS_EXPORT_PRIVATE static const char* Implicit;
2089 JS_EXPORT_PRIVATE static const char* Text;
2090 JS_EXPORT_PRIVATE static const char* ParsedOk;
2091 JS_EXPORT_PRIVATE static const char* Status;
2092 JS_EXPORT_PRIVATE static const char* Range;
2093};
2094
2095/* CSS media query descriptor. */
2096class CSSMedia : public JSON::ObjectBase {
2097public:
2098 // Named after property name 'source' while generating CSSMedia.
2099 enum class Source {
2100 MediaRule = 23,
2101 ImportRule = 24,
2102 LinkedSheet = 25,
2103 InlineSheet = 26,
2104 }; // enum class Source
2105 enum {
2106 NoFieldsSet = 0,
2107 TextSet = 1 << 0,
2108 SourceSet = 1 << 1,
2109 AllFieldsSet = (TextSet | SourceSet)
2110 };
2111
2112 template<int STATE>
2113 class Builder {
2114 private:
2115 RefPtr<JSON::Object> m_result;
2116
2117 template<int STEP> Builder<STATE | STEP>& castState()
2118 {
2119 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
2120 }
2121
2122 Builder(Ref</*CSSMedia*/JSON::Object>&& object)
2123 : m_result(WTFMove(object))
2124 {
2125 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
2126 }
2127 friend class CSSMedia;
2128 public:
2129
2130 Builder<STATE | TextSet>& setText(const String& value)
2131 {
2132 COMPILE_ASSERT(!(STATE & TextSet), property_text_already_set);
2133 m_result->setString("text"_s, value);
2134 return castState<TextSet>();
2135 }
2136
2137 Builder<STATE | SourceSet>& setSource(Source value)
2138 {
2139 COMPILE_ASSERT(!(STATE & SourceSet), property_source_already_set);
2140 m_result->setString("source"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
2141 return castState<SourceSet>();
2142 }
2143
2144 Ref<CSSMedia> release()
2145 {
2146 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
2147 COMPILE_ASSERT(sizeof(CSSMedia) == sizeof(JSON::Object), cannot_cast);
2148
2149 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
2150 auto result = WTFMove(*reinterpret_cast<Ref<CSSMedia>*>(&jsonResult));
2151 return result;
2152 }
2153 };
2154
2155 /*
2156 * Synthetic constructor:
2157 * Ref<CSSMedia> result = CSSMedia::create()
2158 * .setText(...)
2159 * .setSource(...)
2160 * .release();
2161 */
2162 static Builder<NoFieldsSet> create()
2163 {
2164 return Builder<NoFieldsSet>(JSON::Object::create());
2165 }
2166
2167 void setSourceURL(const String& value)
2168 {
2169 JSON::ObjectBase::setString("sourceURL"_s, value);
2170 }
2171
2172 void setSourceLine(int value)
2173 {
2174 JSON::ObjectBase::setInteger("sourceLine"_s, value);
2175 }
2176};
2177
2178} // CSS
2179
2180namespace Canvas {
2181/* The type of rendering context backing the canvas element. */
2182enum class ContextType {
2183 Canvas2D = 27,
2184 BitmapRenderer = 28,
2185 WebGL = 29,
2186 WebGL2 = 30,
2187 WebGPU = 31,
2188}; // enum class ContextType
2189/* Shader type. WebGL supports vertex and fragment shaders. */
2190enum class ShaderType {
2191 Fragment = 32,
2192 Vertex = 33,
2193}; // enum class ShaderType
2194/* Drawing surface attributes. */
2195class ContextAttributes : public JSON::ObjectBase {
2196public:
2197 enum {
2198 NoFieldsSet = 0,
2199 AllFieldsSet = 0
2200 };
2201
2202 template<int STATE>
2203 class Builder {
2204 private:
2205 RefPtr<JSON::Object> m_result;
2206
2207 template<int STEP> Builder<STATE | STEP>& castState()
2208 {
2209 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
2210 }
2211
2212 Builder(Ref</*ContextAttributes*/JSON::Object>&& object)
2213 : m_result(WTFMove(object))
2214 {
2215 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
2216 }
2217 friend class ContextAttributes;
2218 public:
2219
2220 Ref<ContextAttributes> release()
2221 {
2222 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
2223 COMPILE_ASSERT(sizeof(ContextAttributes) == sizeof(JSON::Object), cannot_cast);
2224
2225 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
2226 auto result = WTFMove(*reinterpret_cast<Ref<ContextAttributes>*>(&jsonResult));
2227 return result;
2228 }
2229 };
2230
2231 /*
2232 * Synthetic constructor:
2233 * Ref<ContextAttributes> result = ContextAttributes::create()
2234 * .release();
2235 */
2236 static Builder<NoFieldsSet> create()
2237 {
2238 return Builder<NoFieldsSet>(JSON::Object::create());
2239 }
2240
2241 void setAlpha(bool value)
2242 {
2243 JSON::ObjectBase::setBoolean("alpha"_s, value);
2244 }
2245
2246 void setDepth(bool value)
2247 {
2248 JSON::ObjectBase::setBoolean("depth"_s, value);
2249 }
2250
2251 void setStencil(bool value)
2252 {
2253 JSON::ObjectBase::setBoolean("stencil"_s, value);
2254 }
2255
2256 void setAntialias(bool value)
2257 {
2258 JSON::ObjectBase::setBoolean("antialias"_s, value);
2259 }
2260
2261 void setPremultipliedAlpha(bool value)
2262 {
2263 JSON::ObjectBase::setBoolean("premultipliedAlpha"_s, value);
2264 }
2265
2266 void setPreserveDrawingBuffer(bool value)
2267 {
2268 JSON::ObjectBase::setBoolean("preserveDrawingBuffer"_s, value);
2269 }
2270
2271 void setFailIfMajorPerformanceCaveat(bool value)
2272 {
2273 JSON::ObjectBase::setBoolean("failIfMajorPerformanceCaveat"_s, value);
2274 }
2275};
2276
2277/* Information about a canvas for which a rendering context has been created. */
2278class Canvas : public JSON::ObjectBase {
2279public:
2280 enum {
2281 NoFieldsSet = 0,
2282 CanvasIdSet = 1 << 0,
2283 ContextTypeSet = 1 << 1,
2284 AllFieldsSet = (CanvasIdSet | ContextTypeSet)
2285 };
2286
2287 template<int STATE>
2288 class Builder {
2289 private:
2290 RefPtr<JSON::Object> m_result;
2291
2292 template<int STEP> Builder<STATE | STEP>& castState()
2293 {
2294 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
2295 }
2296
2297 Builder(Ref</*Canvas*/JSON::Object>&& object)
2298 : m_result(WTFMove(object))
2299 {
2300 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
2301 }
2302 friend class Canvas;
2303 public:
2304
2305 Builder<STATE | CanvasIdSet>& setCanvasId(const String& value)
2306 {
2307 COMPILE_ASSERT(!(STATE & CanvasIdSet), property_canvasId_already_set);
2308 m_result->setString("canvasId"_s, value);
2309 return castState<CanvasIdSet>();
2310 }
2311
2312 Builder<STATE | ContextTypeSet>& setContextType(Inspector::Protocol::Canvas::ContextType value)
2313 {
2314 COMPILE_ASSERT(!(STATE & ContextTypeSet), property_contextType_already_set);
2315 m_result->setString("contextType"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
2316 return castState<ContextTypeSet>();
2317 }
2318
2319 Ref<Canvas> release()
2320 {
2321 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
2322 COMPILE_ASSERT(sizeof(Canvas) == sizeof(JSON::Object), cannot_cast);
2323
2324 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
2325 auto result = WTFMove(*reinterpret_cast<Ref<Canvas>*>(&jsonResult));
2326 return result;
2327 }
2328 };
2329
2330 /*
2331 * Synthetic constructor:
2332 * Ref<Canvas> result = Canvas::create()
2333 * .setCanvasId(...)
2334 * .setContextType(...)
2335 * .release();
2336 */
2337 static Builder<NoFieldsSet> create()
2338 {
2339 return Builder<NoFieldsSet>(JSON::Object::create());
2340 }
2341
2342 void setNodeId(int value)
2343 {
2344 JSON::ObjectBase::setInteger("nodeId"_s, value);
2345 }
2346
2347 void setCssCanvasName(const String& value)
2348 {
2349 JSON::ObjectBase::setString("cssCanvasName"_s, value);
2350 }
2351
2352 void setContextAttributes(RefPtr<Inspector::Protocol::Canvas::ContextAttributes> value)
2353 {
2354 JSON::ObjectBase::setObject("contextAttributes"_s, WTFMove(value));
2355 }
2356
2357 void setMemoryCost(double value)
2358 {
2359 JSON::ObjectBase::setDouble("memoryCost"_s, value);
2360 }
2361
2362 void setBacktrace(RefPtr<JSON::ArrayOf<Inspector::Protocol::Console::CallFrame>> value)
2363 {
2364 JSON::ObjectBase::setArray("backtrace"_s, WTFMove(value));
2365 }
2366};
2367
2368} // Canvas
2369
2370namespace Console {
2371/* Channels for different types of log messages. */
2372enum class ChannelSource {
2373 XML = 34,
2374 JavaScript = 35,
2375 Network = 36,
2376 ConsoleAPI = 37,
2377 Storage = 38,
2378 Appcache = 39,
2379 Rendering = 40,
2380 CSS = 41,
2381 Security = 42,
2382 ContentBlocker = 43,
2383 Media = 44,
2384 MediaSource = 45,
2385 WebRTC = 46,
2386 Other = 47,
2387}; // enum class ChannelSource
2388/* Level of logging. */
2389enum class ChannelLevel {
2390 Off = 48,
2391 Basic = 49,
2392 Verbose = 50,
2393}; // enum class ChannelLevel
2394/* Logging channel. */
2395class Channel : public JSON::ObjectBase {
2396public:
2397 enum {
2398 NoFieldsSet = 0,
2399 SourceSet = 1 << 0,
2400 LevelSet = 1 << 1,
2401 AllFieldsSet = (SourceSet | LevelSet)
2402 };
2403
2404 template<int STATE>
2405 class Builder {
2406 private:
2407 RefPtr<JSON::Object> m_result;
2408
2409 template<int STEP> Builder<STATE | STEP>& castState()
2410 {
2411 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
2412 }
2413
2414 Builder(Ref</*Channel*/JSON::Object>&& object)
2415 : m_result(WTFMove(object))
2416 {
2417 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
2418 }
2419 friend class Channel;
2420 public:
2421
2422 Builder<STATE | SourceSet>& setSource(Inspector::Protocol::Console::ChannelSource value)
2423 {
2424 COMPILE_ASSERT(!(STATE & SourceSet), property_source_already_set);
2425 m_result->setString("source"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
2426 return castState<SourceSet>();
2427 }
2428
2429 Builder<STATE | LevelSet>& setLevel(Inspector::Protocol::Console::ChannelLevel value)
2430 {
2431 COMPILE_ASSERT(!(STATE & LevelSet), property_level_already_set);
2432 m_result->setString("level"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
2433 return castState<LevelSet>();
2434 }
2435
2436 Ref<Channel> release()
2437 {
2438 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
2439 COMPILE_ASSERT(sizeof(Channel) == sizeof(JSON::Object), cannot_cast);
2440
2441 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
2442 auto result = WTFMove(*reinterpret_cast<Ref<Channel>*>(&jsonResult));
2443 return result;
2444 }
2445 };
2446
2447 /*
2448 * Synthetic constructor:
2449 * Ref<Channel> result = Channel::create()
2450 * .setSource(...)
2451 * .setLevel(...)
2452 * .release();
2453 */
2454 static Builder<NoFieldsSet> create()
2455 {
2456 return Builder<NoFieldsSet>(JSON::Object::create());
2457 }
2458};
2459
2460/* Console message. */
2461class ConsoleMessage : public JSON::ObjectBase {
2462public:
2463 // Named after property name 'level' while generating ConsoleMessage.
2464 enum class Level {
2465 Log = 51,
2466 Info = 52,
2467 Warning = 53,
2468 Error = 54,
2469 Debug = 55,
2470 }; // enum class Level
2471 // Named after property name 'type' while generating ConsoleMessage.
2472 enum class Type {
2473 Log = 51,
2474 Dir = 56,
2475 DirXML = 57,
2476 Table = 58,
2477 Trace = 59,
2478 Clear = 60,
2479 StartGroup = 61,
2480 StartGroupCollapsed = 62,
2481 EndGroup = 63,
2482 Assert = 64,
2483 Timing = 65,
2484 Profile = 66,
2485 ProfileEnd = 67,
2486 Image = 68,
2487 }; // enum class Type
2488 enum {
2489 NoFieldsSet = 0,
2490 SourceSet = 1 << 0,
2491 LevelSet = 1 << 1,
2492 TextSet = 1 << 2,
2493 AllFieldsSet = (SourceSet | LevelSet | TextSet)
2494 };
2495
2496 template<int STATE>
2497 class Builder {
2498 private:
2499 RefPtr<JSON::Object> m_result;
2500
2501 template<int STEP> Builder<STATE | STEP>& castState()
2502 {
2503 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
2504 }
2505
2506 Builder(Ref</*ConsoleMessage*/JSON::Object>&& object)
2507 : m_result(WTFMove(object))
2508 {
2509 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
2510 }
2511 friend class ConsoleMessage;
2512 public:
2513
2514 Builder<STATE | SourceSet>& setSource(Inspector::Protocol::Console::ChannelSource value)
2515 {
2516 COMPILE_ASSERT(!(STATE & SourceSet), property_source_already_set);
2517 m_result->setString("source"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
2518 return castState<SourceSet>();
2519 }
2520
2521 Builder<STATE | LevelSet>& setLevel(Level value)
2522 {
2523 COMPILE_ASSERT(!(STATE & LevelSet), property_level_already_set);
2524 m_result->setString("level"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
2525 return castState<LevelSet>();
2526 }
2527
2528 Builder<STATE | TextSet>& setText(const String& value)
2529 {
2530 COMPILE_ASSERT(!(STATE & TextSet), property_text_already_set);
2531 m_result->setString("text"_s, value);
2532 return castState<TextSet>();
2533 }
2534
2535 Ref<ConsoleMessage> release()
2536 {
2537 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
2538 COMPILE_ASSERT(sizeof(ConsoleMessage) == sizeof(JSON::Object), cannot_cast);
2539
2540 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
2541 auto result = WTFMove(*reinterpret_cast<Ref<ConsoleMessage>*>(&jsonResult));
2542 return result;
2543 }
2544 };
2545
2546 /*
2547 * Synthetic constructor:
2548 * Ref<ConsoleMessage> result = ConsoleMessage::create()
2549 * .setSource(...)
2550 * .setLevel(...)
2551 * .setText(...)
2552 * .release();
2553 */
2554 static Builder<NoFieldsSet> create()
2555 {
2556 return Builder<NoFieldsSet>(JSON::Object::create());
2557 }
2558
2559 void setType(Type value)
2560 {
2561 JSON::ObjectBase::setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
2562 }
2563
2564 void setUrl(const String& value)
2565 {
2566 JSON::ObjectBase::setString("url"_s, value);
2567 }
2568
2569 void setLine(int value)
2570 {
2571 JSON::ObjectBase::setInteger("line"_s, value);
2572 }
2573
2574 void setColumn(int value)
2575 {
2576 JSON::ObjectBase::setInteger("column"_s, value);
2577 }
2578
2579 void setRepeatCount(int value)
2580 {
2581 JSON::ObjectBase::setInteger("repeatCount"_s, value);
2582 }
2583
2584 void setParameters(RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::RemoteObject>> value)
2585 {
2586 JSON::ObjectBase::setArray("parameters"_s, WTFMove(value));
2587 }
2588
2589 void setStackTrace(RefPtr<JSON::ArrayOf<Inspector::Protocol::Console::CallFrame>> value)
2590 {
2591 JSON::ObjectBase::setArray("stackTrace"_s, WTFMove(value));
2592 }
2593
2594 void setNetworkRequestId(const String& value)
2595 {
2596 JSON::ObjectBase::setString("networkRequestId"_s, value);
2597 }
2598};
2599
2600/* Stack entry for console errors and assertions. */
2601class CallFrame : public JSON::ObjectBase {
2602public:
2603 enum {
2604 NoFieldsSet = 0,
2605 FunctionNameSet = 1 << 0,
2606 UrlSet = 1 << 1,
2607 ScriptIdSet = 1 << 2,
2608 LineNumberSet = 1 << 3,
2609 ColumnNumberSet = 1 << 4,
2610 AllFieldsSet = (FunctionNameSet | UrlSet | ScriptIdSet | LineNumberSet | ColumnNumberSet)
2611 };
2612
2613 template<int STATE>
2614 class Builder {
2615 private:
2616 RefPtr<JSON::Object> m_result;
2617
2618 template<int STEP> Builder<STATE | STEP>& castState()
2619 {
2620 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
2621 }
2622
2623 Builder(Ref</*CallFrame*/JSON::Object>&& object)
2624 : m_result(WTFMove(object))
2625 {
2626 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
2627 }
2628 friend class CallFrame;
2629 public:
2630
2631 Builder<STATE | FunctionNameSet>& setFunctionName(const String& value)
2632 {
2633 COMPILE_ASSERT(!(STATE & FunctionNameSet), property_functionName_already_set);
2634 m_result->setString("functionName"_s, value);
2635 return castState<FunctionNameSet>();
2636 }
2637
2638 Builder<STATE | UrlSet>& setUrl(const String& value)
2639 {
2640 COMPILE_ASSERT(!(STATE & UrlSet), property_url_already_set);
2641 m_result->setString("url"_s, value);
2642 return castState<UrlSet>();
2643 }
2644
2645 Builder<STATE | ScriptIdSet>& setScriptId(const String& value)
2646 {
2647 COMPILE_ASSERT(!(STATE & ScriptIdSet), property_scriptId_already_set);
2648 m_result->setString("scriptId"_s, value);
2649 return castState<ScriptIdSet>();
2650 }
2651
2652 Builder<STATE | LineNumberSet>& setLineNumber(int value)
2653 {
2654 COMPILE_ASSERT(!(STATE & LineNumberSet), property_lineNumber_already_set);
2655 m_result->setInteger("lineNumber"_s, value);
2656 return castState<LineNumberSet>();
2657 }
2658
2659 Builder<STATE | ColumnNumberSet>& setColumnNumber(int value)
2660 {
2661 COMPILE_ASSERT(!(STATE & ColumnNumberSet), property_columnNumber_already_set);
2662 m_result->setInteger("columnNumber"_s, value);
2663 return castState<ColumnNumberSet>();
2664 }
2665
2666 Ref<CallFrame> release()
2667 {
2668 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
2669 COMPILE_ASSERT(sizeof(CallFrame) == sizeof(JSON::Object), cannot_cast);
2670
2671 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
2672 auto result = WTFMove(*reinterpret_cast<Ref<CallFrame>*>(&jsonResult));
2673 return result;
2674 }
2675 };
2676
2677 /*
2678 * Synthetic constructor:
2679 * Ref<CallFrame> result = CallFrame::create()
2680 * .setFunctionName(...)
2681 * .setUrl(...)
2682 * .setScriptId(...)
2683 * .setLineNumber(...)
2684 * .setColumnNumber(...)
2685 * .release();
2686 */
2687 static Builder<NoFieldsSet> create()
2688 {
2689 return Builder<NoFieldsSet>(JSON::Object::create());
2690 }
2691};
2692
2693/* Call frames for async function calls, console assertions, and error messages. */
2694class StackTrace : public JSON::ObjectBase {
2695public:
2696 enum {
2697 NoFieldsSet = 0,
2698 CallFramesSet = 1 << 0,
2699 AllFieldsSet = (CallFramesSet)
2700 };
2701
2702 template<int STATE>
2703 class Builder {
2704 private:
2705 RefPtr<JSON::Object> m_result;
2706
2707 template<int STEP> Builder<STATE | STEP>& castState()
2708 {
2709 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
2710 }
2711
2712 Builder(Ref</*StackTrace*/JSON::Object>&& object)
2713 : m_result(WTFMove(object))
2714 {
2715 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
2716 }
2717 friend class StackTrace;
2718 public:
2719
2720 Builder<STATE | CallFramesSet>& setCallFrames(RefPtr<JSON::ArrayOf<Inspector::Protocol::Console::CallFrame>> value)
2721 {
2722 COMPILE_ASSERT(!(STATE & CallFramesSet), property_callFrames_already_set);
2723 m_result->setArray("callFrames"_s, value);
2724 return castState<CallFramesSet>();
2725 }
2726
2727 Ref<StackTrace> release()
2728 {
2729 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
2730 COMPILE_ASSERT(sizeof(StackTrace) == sizeof(JSON::Object), cannot_cast);
2731
2732 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
2733 auto result = WTFMove(*reinterpret_cast<Ref<StackTrace>*>(&jsonResult));
2734 return result;
2735 }
2736 };
2737
2738 /*
2739 * Synthetic constructor:
2740 * Ref<StackTrace> result = StackTrace::create()
2741 * .setCallFrames(...)
2742 * .release();
2743 */
2744 static Builder<NoFieldsSet> create()
2745 {
2746 return Builder<NoFieldsSet>(JSON::Object::create());
2747 }
2748
2749 void setTopCallFrameIsBoundary(bool value)
2750 {
2751 JSON::ObjectBase::setBoolean("topCallFrameIsBoundary"_s, value);
2752 }
2753
2754 void setTruncated(bool value)
2755 {
2756 JSON::ObjectBase::setBoolean("truncated"_s, value);
2757 }
2758
2759 void setParentStackTrace(RefPtr<Inspector::Protocol::Console::StackTrace> value)
2760 {
2761 JSON::ObjectBase::setObject("parentStackTrace"_s, WTFMove(value));
2762 }
2763};
2764
2765} // Console
2766
2767namespace DOM {
2768/* Pseudo element type. */
2769enum class PseudoType {
2770 Before = 9,
2771 After = 10,
2772}; // enum class PseudoType
2773/* Shadow root type. */
2774enum class ShadowRootType {
2775 UserAgent = 3,
2776 Open = 69,
2777 Closed = 70,
2778}; // enum class ShadowRootType
2779/* Custom element state. */
2780enum class CustomElementState {
2781 Builtin = 71,
2782 Custom = 72,
2783 Waiting = 73,
2784 Failed = 74,
2785}; // enum class CustomElementState
2786/* Token values of @aria-relevant attribute. */
2787enum class LiveRegionRelevant {
2788 Additions = 75,
2789 Removals = 76,
2790 Text = 77,
2791}; // enum class LiveRegionRelevant
2792/* DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type. */
2793class Node : public JSON::ObjectBase {
2794public:
2795 enum {
2796 NoFieldsSet = 0,
2797 NodeIdSet = 1 << 0,
2798 NodeTypeSet = 1 << 1,
2799 NodeNameSet = 1 << 2,
2800 LocalNameSet = 1 << 3,
2801 NodeValueSet = 1 << 4,
2802 AllFieldsSet = (NodeIdSet | NodeTypeSet | NodeNameSet | LocalNameSet | NodeValueSet)
2803 };
2804
2805 template<int STATE>
2806 class Builder {
2807 private:
2808 RefPtr<JSON::Object> m_result;
2809
2810 template<int STEP> Builder<STATE | STEP>& castState()
2811 {
2812 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
2813 }
2814
2815 Builder(Ref</*Node*/JSON::Object>&& object)
2816 : m_result(WTFMove(object))
2817 {
2818 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
2819 }
2820 friend class Node;
2821 public:
2822
2823 Builder<STATE | NodeIdSet>& setNodeId(int value)
2824 {
2825 COMPILE_ASSERT(!(STATE & NodeIdSet), property_nodeId_already_set);
2826 m_result->setInteger("nodeId"_s, value);
2827 return castState<NodeIdSet>();
2828 }
2829
2830 Builder<STATE | NodeTypeSet>& setNodeType(int value)
2831 {
2832 COMPILE_ASSERT(!(STATE & NodeTypeSet), property_nodeType_already_set);
2833 m_result->setInteger("nodeType"_s, value);
2834 return castState<NodeTypeSet>();
2835 }
2836
2837 Builder<STATE | NodeNameSet>& setNodeName(const String& value)
2838 {
2839 COMPILE_ASSERT(!(STATE & NodeNameSet), property_nodeName_already_set);
2840 m_result->setString("nodeName"_s, value);
2841 return castState<NodeNameSet>();
2842 }
2843
2844 Builder<STATE | LocalNameSet>& setLocalName(const String& value)
2845 {
2846 COMPILE_ASSERT(!(STATE & LocalNameSet), property_localName_already_set);
2847 m_result->setString("localName"_s, value);
2848 return castState<LocalNameSet>();
2849 }
2850
2851 Builder<STATE | NodeValueSet>& setNodeValue(const String& value)
2852 {
2853 COMPILE_ASSERT(!(STATE & NodeValueSet), property_nodeValue_already_set);
2854 m_result->setString("nodeValue"_s, value);
2855 return castState<NodeValueSet>();
2856 }
2857
2858 Ref<Node> release()
2859 {
2860 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
2861 COMPILE_ASSERT(sizeof(Node) == sizeof(JSON::Object), cannot_cast);
2862
2863 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
2864 auto result = WTFMove(*reinterpret_cast<Ref<Node>*>(&jsonResult));
2865 return result;
2866 }
2867 };
2868
2869 /*
2870 * Synthetic constructor:
2871 * Ref<Node> result = Node::create()
2872 * .setNodeId(...)
2873 * .setNodeType(...)
2874 * .setNodeName(...)
2875 * .setLocalName(...)
2876 * .setNodeValue(...)
2877 * .release();
2878 */
2879 static Builder<NoFieldsSet> create()
2880 {
2881 return Builder<NoFieldsSet>(JSON::Object::create());
2882 }
2883
2884 void setFrameId(const String& value)
2885 {
2886 JSON::ObjectBase::setString("frameId"_s, value);
2887 }
2888
2889 void setChildNodeCount(int value)
2890 {
2891 JSON::ObjectBase::setInteger("childNodeCount"_s, value);
2892 }
2893
2894 void setChildren(RefPtr<JSON::ArrayOf<Inspector::Protocol::DOM::Node>> value)
2895 {
2896 JSON::ObjectBase::setArray("children"_s, WTFMove(value));
2897 }
2898
2899 void setAttributes(RefPtr<JSON::ArrayOf<String>> value)
2900 {
2901 JSON::ObjectBase::setArray("attributes"_s, WTFMove(value));
2902 }
2903
2904 void setDocumentURL(const String& value)
2905 {
2906 JSON::ObjectBase::setString("documentURL"_s, value);
2907 }
2908
2909 void setBaseURL(const String& value)
2910 {
2911 JSON::ObjectBase::setString("baseURL"_s, value);
2912 }
2913
2914 void setPublicId(const String& value)
2915 {
2916 JSON::ObjectBase::setString("publicId"_s, value);
2917 }
2918
2919 void setSystemId(const String& value)
2920 {
2921 JSON::ObjectBase::setString("systemId"_s, value);
2922 }
2923
2924 void setXmlVersion(const String& value)
2925 {
2926 JSON::ObjectBase::setString("xmlVersion"_s, value);
2927 }
2928
2929 void setName(const String& value)
2930 {
2931 JSON::ObjectBase::setString("name"_s, value);
2932 }
2933
2934 void setValue(const String& value)
2935 {
2936 JSON::ObjectBase::setString("value"_s, value);
2937 }
2938
2939 void setPseudoType(Inspector::Protocol::DOM::PseudoType value)
2940 {
2941 JSON::ObjectBase::setString("pseudoType"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
2942 }
2943
2944 void setShadowRootType(Inspector::Protocol::DOM::ShadowRootType value)
2945 {
2946 JSON::ObjectBase::setString("shadowRootType"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
2947 }
2948
2949 void setCustomElementState(Inspector::Protocol::DOM::CustomElementState value)
2950 {
2951 JSON::ObjectBase::setString("customElementState"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
2952 }
2953
2954 void setContentDocument(RefPtr<Inspector::Protocol::DOM::Node> value)
2955 {
2956 JSON::ObjectBase::setObject("contentDocument"_s, WTFMove(value));
2957 }
2958
2959 void setShadowRoots(RefPtr<JSON::ArrayOf<Inspector::Protocol::DOM::Node>> value)
2960 {
2961 JSON::ObjectBase::setArray("shadowRoots"_s, WTFMove(value));
2962 }
2963
2964 void setTemplateContent(RefPtr<Inspector::Protocol::DOM::Node> value)
2965 {
2966 JSON::ObjectBase::setObject("templateContent"_s, WTFMove(value));
2967 }
2968
2969 void setPseudoElements(RefPtr<JSON::ArrayOf<Inspector::Protocol::DOM::Node>> value)
2970 {
2971 JSON::ObjectBase::setArray("pseudoElements"_s, WTFMove(value));
2972 }
2973
2974 void setContentSecurityPolicyHash(const String& value)
2975 {
2976 JSON::ObjectBase::setString("contentSecurityPolicyHash"_s, value);
2977 }
2978};
2979
2980/* Relationship between data that is associated with a node and the node itself. */
2981class DataBinding : public JSON::ObjectBase {
2982public:
2983 enum {
2984 NoFieldsSet = 0,
2985 BindingSet = 1 << 0,
2986 ValueSet = 1 << 1,
2987 AllFieldsSet = (BindingSet | ValueSet)
2988 };
2989
2990 template<int STATE>
2991 class Builder {
2992 private:
2993 RefPtr<JSON::Object> m_result;
2994
2995 template<int STEP> Builder<STATE | STEP>& castState()
2996 {
2997 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
2998 }
2999
3000 Builder(Ref</*DataBinding*/JSON::Object>&& object)
3001 : m_result(WTFMove(object))
3002 {
3003 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
3004 }
3005 friend class DataBinding;
3006 public:
3007
3008 Builder<STATE | BindingSet>& setBinding(const String& value)
3009 {
3010 COMPILE_ASSERT(!(STATE & BindingSet), property_binding_already_set);
3011 m_result->setString("binding"_s, value);
3012 return castState<BindingSet>();
3013 }
3014
3015 Builder<STATE | ValueSet>& setValue(const String& value)
3016 {
3017 COMPILE_ASSERT(!(STATE & ValueSet), property_value_already_set);
3018 m_result->setString("value"_s, value);
3019 return castState<ValueSet>();
3020 }
3021
3022 Ref<DataBinding> release()
3023 {
3024 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
3025 COMPILE_ASSERT(sizeof(DataBinding) == sizeof(JSON::Object), cannot_cast);
3026
3027 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
3028 auto result = WTFMove(*reinterpret_cast<Ref<DataBinding>*>(&jsonResult));
3029 return result;
3030 }
3031 };
3032
3033 /*
3034 * Synthetic constructor:
3035 * Ref<DataBinding> result = DataBinding::create()
3036 * .setBinding(...)
3037 * .setValue(...)
3038 * .release();
3039 */
3040 static Builder<NoFieldsSet> create()
3041 {
3042 return Builder<NoFieldsSet>(JSON::Object::create());
3043 }
3044
3045 void setType(const String& value)
3046 {
3047 JSON::ObjectBase::setString("type"_s, value);
3048 }
3049};
3050
3051/* A structure holding event listener properties. */
3052class EventListener : public JSON::ObjectBase {
3053public:
3054 enum {
3055 NoFieldsSet = 0,
3056 EventListenerIdSet = 1 << 0,
3057 TypeSet = 1 << 1,
3058 UseCaptureSet = 1 << 2,
3059 IsAttributeSet = 1 << 3,
3060 AllFieldsSet = (EventListenerIdSet | TypeSet | UseCaptureSet | IsAttributeSet)
3061 };
3062
3063 template<int STATE>
3064 class Builder {
3065 private:
3066 RefPtr<JSON::Object> m_result;
3067
3068 template<int STEP> Builder<STATE | STEP>& castState()
3069 {
3070 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
3071 }
3072
3073 Builder(Ref</*EventListener*/JSON::Object>&& object)
3074 : m_result(WTFMove(object))
3075 {
3076 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
3077 }
3078 friend class EventListener;
3079 public:
3080
3081 Builder<STATE | EventListenerIdSet>& setEventListenerId(int value)
3082 {
3083 COMPILE_ASSERT(!(STATE & EventListenerIdSet), property_eventListenerId_already_set);
3084 m_result->setInteger("eventListenerId"_s, value);
3085 return castState<EventListenerIdSet>();
3086 }
3087
3088 Builder<STATE | TypeSet>& setType(const String& value)
3089 {
3090 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
3091 m_result->setString("type"_s, value);
3092 return castState<TypeSet>();
3093 }
3094
3095 Builder<STATE | UseCaptureSet>& setUseCapture(bool value)
3096 {
3097 COMPILE_ASSERT(!(STATE & UseCaptureSet), property_useCapture_already_set);
3098 m_result->setBoolean("useCapture"_s, value);
3099 return castState<UseCaptureSet>();
3100 }
3101
3102 Builder<STATE | IsAttributeSet>& setIsAttribute(bool value)
3103 {
3104 COMPILE_ASSERT(!(STATE & IsAttributeSet), property_isAttribute_already_set);
3105 m_result->setBoolean("isAttribute"_s, value);
3106 return castState<IsAttributeSet>();
3107 }
3108
3109 Ref<EventListener> release()
3110 {
3111 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
3112 COMPILE_ASSERT(sizeof(EventListener) == sizeof(JSON::Object), cannot_cast);
3113
3114 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
3115 auto result = WTFMove(*reinterpret_cast<Ref<EventListener>*>(&jsonResult));
3116 return result;
3117 }
3118 };
3119
3120 /*
3121 * Synthetic constructor:
3122 * Ref<EventListener> result = EventListener::create()
3123 * .setEventListenerId(...)
3124 * .setType(...)
3125 * .setUseCapture(...)
3126 * .setIsAttribute(...)
3127 * .release();
3128 */
3129 static Builder<NoFieldsSet> create()
3130 {
3131 return Builder<NoFieldsSet>(JSON::Object::create());
3132 }
3133
3134 void setNodeId(int value)
3135 {
3136 JSON::ObjectBase::setInteger("nodeId"_s, value);
3137 }
3138
3139 void setOnWindow(bool value)
3140 {
3141 JSON::ObjectBase::setBoolean("onWindow"_s, value);
3142 }
3143
3144 void setLocation(RefPtr<Inspector::Protocol::Debugger::Location> value)
3145 {
3146 JSON::ObjectBase::setObject("location"_s, WTFMove(value));
3147 }
3148
3149 void setHandlerName(const String& value)
3150 {
3151 JSON::ObjectBase::setString("handlerName"_s, value);
3152 }
3153
3154 void setPassive(bool value)
3155 {
3156 JSON::ObjectBase::setBoolean("passive"_s, value);
3157 }
3158
3159 void setOnce(bool value)
3160 {
3161 JSON::ObjectBase::setBoolean("once"_s, value);
3162 }
3163
3164 void setDisabled(bool value)
3165 {
3166 JSON::ObjectBase::setBoolean("disabled"_s, value);
3167 }
3168
3169 void setHasBreakpoint(bool value)
3170 {
3171 JSON::ObjectBase::setBoolean("hasBreakpoint"_s, value);
3172 }
3173};
3174
3175/* A structure holding accessibility properties. */
3176class AccessibilityProperties : public JSON::ObjectBase {
3177public:
3178 // Named after property name 'checked' while generating AccessibilityProperties.
3179 enum class Checked {
3180 True = 78,
3181 False = 79,
3182 Mixed = 80,
3183 }; // enum class Checked
3184 // Named after property name 'current' while generating AccessibilityProperties.
3185 enum class Current {
3186 True = 78,
3187 False = 79,
3188 Page = 81,
3189 Step = 82,
3190 Location = 83,
3191 Date = 84,
3192 Time = 85,
3193 }; // enum class Current
3194 // Named after property name 'invalid' while generating AccessibilityProperties.
3195 enum class Invalid {
3196 True = 78,
3197 False = 79,
3198 Grammar = 86,
3199 Spelling = 87,
3200 }; // enum class Invalid
3201 // Named after property name 'liveRegionStatus' while generating AccessibilityProperties.
3202 enum class LiveRegionStatus {
3203 Assertive = 88,
3204 Polite = 89,
3205 Off = 48,
3206 }; // enum class LiveRegionStatus
3207 enum {
3208 NoFieldsSet = 0,
3209 ExistsSet = 1 << 0,
3210 LabelSet = 1 << 1,
3211 NodeIdSet = 1 << 2,
3212 RoleSet = 1 << 3,
3213 AllFieldsSet = (ExistsSet | LabelSet | NodeIdSet | RoleSet)
3214 };
3215
3216 template<int STATE>
3217 class Builder {
3218 private:
3219 RefPtr<JSON::Object> m_result;
3220
3221 template<int STEP> Builder<STATE | STEP>& castState()
3222 {
3223 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
3224 }
3225
3226 Builder(Ref</*AccessibilityProperties*/JSON::Object>&& object)
3227 : m_result(WTFMove(object))
3228 {
3229 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
3230 }
3231 friend class AccessibilityProperties;
3232 public:
3233
3234 Builder<STATE | ExistsSet>& setExists(bool value)
3235 {
3236 COMPILE_ASSERT(!(STATE & ExistsSet), property_exists_already_set);
3237 m_result->setBoolean("exists"_s, value);
3238 return castState<ExistsSet>();
3239 }
3240
3241 Builder<STATE | LabelSet>& setLabel(const String& value)
3242 {
3243 COMPILE_ASSERT(!(STATE & LabelSet), property_label_already_set);
3244 m_result->setString("label"_s, value);
3245 return castState<LabelSet>();
3246 }
3247
3248 Builder<STATE | NodeIdSet>& setNodeId(int value)
3249 {
3250 COMPILE_ASSERT(!(STATE & NodeIdSet), property_nodeId_already_set);
3251 m_result->setInteger("nodeId"_s, value);
3252 return castState<NodeIdSet>();
3253 }
3254
3255 Builder<STATE | RoleSet>& setRole(const String& value)
3256 {
3257 COMPILE_ASSERT(!(STATE & RoleSet), property_role_already_set);
3258 m_result->setString("role"_s, value);
3259 return castState<RoleSet>();
3260 }
3261
3262 Ref<AccessibilityProperties> release()
3263 {
3264 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
3265 COMPILE_ASSERT(sizeof(AccessibilityProperties) == sizeof(JSON::Object), cannot_cast);
3266
3267 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
3268 auto result = WTFMove(*reinterpret_cast<Ref<AccessibilityProperties>*>(&jsonResult));
3269 return result;
3270 }
3271 };
3272
3273 /*
3274 * Synthetic constructor:
3275 * Ref<AccessibilityProperties> result = AccessibilityProperties::create()
3276 * .setExists(...)
3277 * .setLabel(...)
3278 * .setNodeId(...)
3279 * .setRole(...)
3280 * .release();
3281 */
3282 static Builder<NoFieldsSet> create()
3283 {
3284 return Builder<NoFieldsSet>(JSON::Object::create());
3285 }
3286
3287 void setActiveDescendantNodeId(int value)
3288 {
3289 JSON::ObjectBase::setInteger("activeDescendantNodeId"_s, value);
3290 }
3291
3292 void setBusy(bool value)
3293 {
3294 JSON::ObjectBase::setBoolean("busy"_s, value);
3295 }
3296
3297 void setChecked(Checked value)
3298 {
3299 JSON::ObjectBase::setString("checked"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
3300 }
3301
3302 void setChildNodeIds(RefPtr<JSON::ArrayOf<int>> value)
3303 {
3304 JSON::ObjectBase::setArray("childNodeIds"_s, WTFMove(value));
3305 }
3306
3307 void setControlledNodeIds(RefPtr<JSON::ArrayOf<int>> value)
3308 {
3309 JSON::ObjectBase::setArray("controlledNodeIds"_s, WTFMove(value));
3310 }
3311
3312 void setCurrent(Current value)
3313 {
3314 JSON::ObjectBase::setString("current"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
3315 }
3316
3317 void setDisabled(bool value)
3318 {
3319 JSON::ObjectBase::setBoolean("disabled"_s, value);
3320 }
3321
3322 void setHeadingLevel(double value)
3323 {
3324 JSON::ObjectBase::setDouble("headingLevel"_s, value);
3325 }
3326
3327 void setHierarchyLevel(double value)
3328 {
3329 JSON::ObjectBase::setDouble("hierarchyLevel"_s, value);
3330 }
3331
3332 void setIsPopUpButton(bool value)
3333 {
3334 JSON::ObjectBase::setBoolean("isPopUpButton"_s, value);
3335 }
3336
3337 void setExpanded(bool value)
3338 {
3339 JSON::ObjectBase::setBoolean("expanded"_s, value);
3340 }
3341
3342 void setFlowedNodeIds(RefPtr<JSON::ArrayOf<int>> value)
3343 {
3344 JSON::ObjectBase::setArray("flowedNodeIds"_s, WTFMove(value));
3345 }
3346
3347 void setFocused(bool value)
3348 {
3349 JSON::ObjectBase::setBoolean("focused"_s, value);
3350 }
3351
3352 void setIgnored(bool value)
3353 {
3354 JSON::ObjectBase::setBoolean("ignored"_s, value);
3355 }
3356
3357 void setIgnoredByDefault(bool value)
3358 {
3359 JSON::ObjectBase::setBoolean("ignoredByDefault"_s, value);
3360 }
3361
3362 void setInvalid(Invalid value)
3363 {
3364 JSON::ObjectBase::setString("invalid"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
3365 }
3366
3367 void setHidden(bool value)
3368 {
3369 JSON::ObjectBase::setBoolean("hidden"_s, value);
3370 }
3371
3372 void setLiveRegionAtomic(bool value)
3373 {
3374 JSON::ObjectBase::setBoolean("liveRegionAtomic"_s, value);
3375 }
3376
3377 void setLiveRegionRelevant(RefPtr<JSON::ArrayOf<String>> value)
3378 {
3379 JSON::ObjectBase::setArray("liveRegionRelevant"_s, WTFMove(value));
3380 }
3381
3382 void setLiveRegionStatus(LiveRegionStatus value)
3383 {
3384 JSON::ObjectBase::setString("liveRegionStatus"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
3385 }
3386
3387 void setMouseEventNodeId(int value)
3388 {
3389 JSON::ObjectBase::setInteger("mouseEventNodeId"_s, value);
3390 }
3391
3392 void setOwnedNodeIds(RefPtr<JSON::ArrayOf<int>> value)
3393 {
3394 JSON::ObjectBase::setArray("ownedNodeIds"_s, WTFMove(value));
3395 }
3396
3397 void setParentNodeId(int value)
3398 {
3399 JSON::ObjectBase::setInteger("parentNodeId"_s, value);
3400 }
3401
3402 void setPressed(bool value)
3403 {
3404 JSON::ObjectBase::setBoolean("pressed"_s, value);
3405 }
3406
3407 void setReadonly(bool value)
3408 {
3409 JSON::ObjectBase::setBoolean("readonly"_s, value);
3410 }
3411
3412 void setRequired(bool value)
3413 {
3414 JSON::ObjectBase::setBoolean("required"_s, value);
3415 }
3416
3417 void setSelected(bool value)
3418 {
3419 JSON::ObjectBase::setBoolean("selected"_s, value);
3420 }
3421
3422 void setSelectedChildNodeIds(RefPtr<JSON::ArrayOf<int>> value)
3423 {
3424 JSON::ObjectBase::setArray("selectedChildNodeIds"_s, WTFMove(value));
3425 }
3426};
3427
3428/* A structure holding an RGBA color. */
3429class RGBAColor : public JSON::ObjectBase {
3430public:
3431 enum {
3432 NoFieldsSet = 0,
3433 RSet = 1 << 0,
3434 GSet = 1 << 1,
3435 BSet = 1 << 2,
3436 AllFieldsSet = (RSet | GSet | BSet)
3437 };
3438
3439 template<int STATE>
3440 class Builder {
3441 private:
3442 RefPtr<JSON::Object> m_result;
3443
3444 template<int STEP> Builder<STATE | STEP>& castState()
3445 {
3446 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
3447 }
3448
3449 Builder(Ref</*RGBAColor*/JSON::Object>&& object)
3450 : m_result(WTFMove(object))
3451 {
3452 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
3453 }
3454 friend class RGBAColor;
3455 public:
3456
3457 Builder<STATE | RSet>& setR(int value)
3458 {
3459 COMPILE_ASSERT(!(STATE & RSet), property_r_already_set);
3460 m_result->setInteger("r"_s, value);
3461 return castState<RSet>();
3462 }
3463
3464 Builder<STATE | GSet>& setG(int value)
3465 {
3466 COMPILE_ASSERT(!(STATE & GSet), property_g_already_set);
3467 m_result->setInteger("g"_s, value);
3468 return castState<GSet>();
3469 }
3470
3471 Builder<STATE | BSet>& setB(int value)
3472 {
3473 COMPILE_ASSERT(!(STATE & BSet), property_b_already_set);
3474 m_result->setInteger("b"_s, value);
3475 return castState<BSet>();
3476 }
3477
3478 Ref<RGBAColor> release()
3479 {
3480 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
3481 COMPILE_ASSERT(sizeof(RGBAColor) == sizeof(JSON::Object), cannot_cast);
3482
3483 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
3484 auto result = WTFMove(*reinterpret_cast<Ref<RGBAColor>*>(&jsonResult));
3485 return result;
3486 }
3487 };
3488
3489 /*
3490 * Synthetic constructor:
3491 * Ref<RGBAColor> result = RGBAColor::create()
3492 * .setR(...)
3493 * .setG(...)
3494 * .setB(...)
3495 * .release();
3496 */
3497 static Builder<NoFieldsSet> create()
3498 {
3499 return Builder<NoFieldsSet>(JSON::Object::create());
3500 }
3501
3502 void setA(double value)
3503 {
3504 JSON::ObjectBase::setDouble("a"_s, value);
3505 }
3506};
3507
3508/* Configuration data for the highlighting of page elements. */
3509class HighlightConfig : public JSON::ObjectBase {
3510public:
3511 enum {
3512 NoFieldsSet = 0,
3513 AllFieldsSet = 0
3514 };
3515
3516 template<int STATE>
3517 class Builder {
3518 private:
3519 RefPtr<JSON::Object> m_result;
3520
3521 template<int STEP> Builder<STATE | STEP>& castState()
3522 {
3523 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
3524 }
3525
3526 Builder(Ref</*HighlightConfig*/JSON::Object>&& object)
3527 : m_result(WTFMove(object))
3528 {
3529 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
3530 }
3531 friend class HighlightConfig;
3532 public:
3533
3534 Ref<HighlightConfig> release()
3535 {
3536 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
3537 COMPILE_ASSERT(sizeof(HighlightConfig) == sizeof(JSON::Object), cannot_cast);
3538
3539 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
3540 auto result = WTFMove(*reinterpret_cast<Ref<HighlightConfig>*>(&jsonResult));
3541 return result;
3542 }
3543 };
3544
3545 /*
3546 * Synthetic constructor:
3547 * Ref<HighlightConfig> result = HighlightConfig::create()
3548 * .release();
3549 */
3550 static Builder<NoFieldsSet> create()
3551 {
3552 return Builder<NoFieldsSet>(JSON::Object::create());
3553 }
3554
3555 void setShowInfo(bool value)
3556 {
3557 JSON::ObjectBase::setBoolean("showInfo"_s, value);
3558 }
3559
3560 void setContentColor(RefPtr<Inspector::Protocol::DOM::RGBAColor> value)
3561 {
3562 JSON::ObjectBase::setObject("contentColor"_s, WTFMove(value));
3563 }
3564
3565 void setPaddingColor(RefPtr<Inspector::Protocol::DOM::RGBAColor> value)
3566 {
3567 JSON::ObjectBase::setObject("paddingColor"_s, WTFMove(value));
3568 }
3569
3570 void setBorderColor(RefPtr<Inspector::Protocol::DOM::RGBAColor> value)
3571 {
3572 JSON::ObjectBase::setObject("borderColor"_s, WTFMove(value));
3573 }
3574
3575 void setMarginColor(RefPtr<Inspector::Protocol::DOM::RGBAColor> value)
3576 {
3577 JSON::ObjectBase::setObject("marginColor"_s, WTFMove(value));
3578 }
3579};
3580
3581} // DOM
3582
3583namespace DOMDebugger {
3584/* DOM breakpoint type. */
3585enum class DOMBreakpointType {
3586 SubtreeModified = 90,
3587 AttributeModified = 91,
3588 NodeRemoved = 92,
3589}; // enum class DOMBreakpointType
3590/* Event breakpoint type. */
3591enum class EventBreakpointType {
3592 AnimationFrame = 93,
3593 Listener = 94,
3594 Timer = 95,
3595}; // enum class EventBreakpointType
3596} // DOMDebugger
3597
3598namespace DOMStorage {
3599/* DOM Storage identifier. */
3600class StorageId : public JSON::ObjectBase {
3601public:
3602 enum {
3603 NoFieldsSet = 0,
3604 SecurityOriginSet = 1 << 0,
3605 IsLocalStorageSet = 1 << 1,
3606 AllFieldsSet = (SecurityOriginSet | IsLocalStorageSet)
3607 };
3608
3609 template<int STATE>
3610 class Builder {
3611 private:
3612 RefPtr<JSON::Object> m_result;
3613
3614 template<int STEP> Builder<STATE | STEP>& castState()
3615 {
3616 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
3617 }
3618
3619 Builder(Ref</*StorageId*/JSON::Object>&& object)
3620 : m_result(WTFMove(object))
3621 {
3622 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
3623 }
3624 friend class StorageId;
3625 public:
3626
3627 Builder<STATE | SecurityOriginSet>& setSecurityOrigin(const String& value)
3628 {
3629 COMPILE_ASSERT(!(STATE & SecurityOriginSet), property_securityOrigin_already_set);
3630 m_result->setString("securityOrigin"_s, value);
3631 return castState<SecurityOriginSet>();
3632 }
3633
3634 Builder<STATE | IsLocalStorageSet>& setIsLocalStorage(bool value)
3635 {
3636 COMPILE_ASSERT(!(STATE & IsLocalStorageSet), property_isLocalStorage_already_set);
3637 m_result->setBoolean("isLocalStorage"_s, value);
3638 return castState<IsLocalStorageSet>();
3639 }
3640
3641 Ref<StorageId> release()
3642 {
3643 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
3644 COMPILE_ASSERT(sizeof(StorageId) == sizeof(JSON::Object), cannot_cast);
3645
3646 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
3647 auto result = WTFMove(*reinterpret_cast<Ref<StorageId>*>(&jsonResult));
3648 return result;
3649 }
3650 };
3651
3652 /*
3653 * Synthetic constructor:
3654 * Ref<StorageId> result = StorageId::create()
3655 * .setSecurityOrigin(...)
3656 * .setIsLocalStorage(...)
3657 * .release();
3658 */
3659 static Builder<NoFieldsSet> create()
3660 {
3661 return Builder<NoFieldsSet>(JSON::Object::create());
3662 }
3663};
3664
3665} // DOMStorage
3666
3667namespace Database {
3668/* Database object. */
3669class Database : public JSON::ObjectBase {
3670public:
3671 enum {
3672 NoFieldsSet = 0,
3673 IdSet = 1 << 0,
3674 DomainSet = 1 << 1,
3675 NameSet = 1 << 2,
3676 VersionSet = 1 << 3,
3677 AllFieldsSet = (IdSet | DomainSet | NameSet | VersionSet)
3678 };
3679
3680 template<int STATE>
3681 class Builder {
3682 private:
3683 RefPtr<JSON::Object> m_result;
3684
3685 template<int STEP> Builder<STATE | STEP>& castState()
3686 {
3687 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
3688 }
3689
3690 Builder(Ref</*Database*/JSON::Object>&& object)
3691 : m_result(WTFMove(object))
3692 {
3693 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
3694 }
3695 friend class Database;
3696 public:
3697
3698 Builder<STATE | IdSet>& setId(const String& value)
3699 {
3700 COMPILE_ASSERT(!(STATE & IdSet), property_id_already_set);
3701 m_result->setString("id"_s, value);
3702 return castState<IdSet>();
3703 }
3704
3705 Builder<STATE | DomainSet>& setDomain(const String& value)
3706 {
3707 COMPILE_ASSERT(!(STATE & DomainSet), property_domain_already_set);
3708 m_result->setString("domain"_s, value);
3709 return castState<DomainSet>();
3710 }
3711
3712 Builder<STATE | NameSet>& setName(const String& value)
3713 {
3714 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
3715 m_result->setString("name"_s, value);
3716 return castState<NameSet>();
3717 }
3718
3719 Builder<STATE | VersionSet>& setVersion(const String& value)
3720 {
3721 COMPILE_ASSERT(!(STATE & VersionSet), property_version_already_set);
3722 m_result->setString("version"_s, value);
3723 return castState<VersionSet>();
3724 }
3725
3726 Ref<Database> release()
3727 {
3728 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
3729 COMPILE_ASSERT(sizeof(Database) == sizeof(JSON::Object), cannot_cast);
3730
3731 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
3732 auto result = WTFMove(*reinterpret_cast<Ref<Database>*>(&jsonResult));
3733 return result;
3734 }
3735 };
3736
3737 /*
3738 * Synthetic constructor:
3739 * Ref<Database> result = Database::create()
3740 * .setId(...)
3741 * .setDomain(...)
3742 * .setName(...)
3743 * .setVersion(...)
3744 * .release();
3745 */
3746 static Builder<NoFieldsSet> create()
3747 {
3748 return Builder<NoFieldsSet>(JSON::Object::create());
3749 }
3750};
3751
3752/* Database error. */
3753class Error : public JSON::ObjectBase {
3754public:
3755 enum {
3756 NoFieldsSet = 0,
3757 MessageSet = 1 << 0,
3758 CodeSet = 1 << 1,
3759 AllFieldsSet = (MessageSet | CodeSet)
3760 };
3761
3762 template<int STATE>
3763 class Builder {
3764 private:
3765 RefPtr<JSON::Object> m_result;
3766
3767 template<int STEP> Builder<STATE | STEP>& castState()
3768 {
3769 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
3770 }
3771
3772 Builder(Ref</*Error*/JSON::Object>&& object)
3773 : m_result(WTFMove(object))
3774 {
3775 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
3776 }
3777 friend class Error;
3778 public:
3779
3780 Builder<STATE | MessageSet>& setMessage(const String& value)
3781 {
3782 COMPILE_ASSERT(!(STATE & MessageSet), property_message_already_set);
3783 m_result->setString("message"_s, value);
3784 return castState<MessageSet>();
3785 }
3786
3787 Builder<STATE | CodeSet>& setCode(int value)
3788 {
3789 COMPILE_ASSERT(!(STATE & CodeSet), property_code_already_set);
3790 m_result->setInteger("code"_s, value);
3791 return castState<CodeSet>();
3792 }
3793
3794 Ref<Error> release()
3795 {
3796 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
3797 COMPILE_ASSERT(sizeof(Error) == sizeof(JSON::Object), cannot_cast);
3798
3799 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
3800 auto result = WTFMove(*reinterpret_cast<Ref<Error>*>(&jsonResult));
3801 return result;
3802 }
3803 };
3804
3805 /*
3806 * Synthetic constructor:
3807 * Ref<Error> result = Error::create()
3808 * .setMessage(...)
3809 * .setCode(...)
3810 * .release();
3811 */
3812 static Builder<NoFieldsSet> create()
3813 {
3814 return Builder<NoFieldsSet>(JSON::Object::create());
3815 }
3816};
3817
3818} // Database
3819
3820namespace Debugger {
3821/* Location in the source code. */
3822class Location : public JSON::ObjectBase {
3823public:
3824 enum {
3825 NoFieldsSet = 0,
3826 ScriptIdSet = 1 << 0,
3827 LineNumberSet = 1 << 1,
3828 AllFieldsSet = (ScriptIdSet | LineNumberSet)
3829 };
3830
3831 template<int STATE>
3832 class Builder {
3833 private:
3834 RefPtr<JSON::Object> m_result;
3835
3836 template<int STEP> Builder<STATE | STEP>& castState()
3837 {
3838 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
3839 }
3840
3841 Builder(Ref</*Location*/JSON::Object>&& object)
3842 : m_result(WTFMove(object))
3843 {
3844 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
3845 }
3846 friend class Location;
3847 public:
3848
3849 Builder<STATE | ScriptIdSet>& setScriptId(const String& value)
3850 {
3851 COMPILE_ASSERT(!(STATE & ScriptIdSet), property_scriptId_already_set);
3852 m_result->setString("scriptId"_s, value);
3853 return castState<ScriptIdSet>();
3854 }
3855
3856 Builder<STATE | LineNumberSet>& setLineNumber(int value)
3857 {
3858 COMPILE_ASSERT(!(STATE & LineNumberSet), property_lineNumber_already_set);
3859 m_result->setInteger("lineNumber"_s, value);
3860 return castState<LineNumberSet>();
3861 }
3862
3863 Ref<Location> release()
3864 {
3865 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
3866 COMPILE_ASSERT(sizeof(Location) == sizeof(JSON::Object), cannot_cast);
3867
3868 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
3869 auto result = WTFMove(*reinterpret_cast<Ref<Location>*>(&jsonResult));
3870 return result;
3871 }
3872 };
3873
3874 /*
3875 * Synthetic constructor:
3876 * Ref<Location> result = Location::create()
3877 * .setScriptId(...)
3878 * .setLineNumber(...)
3879 * .release();
3880 */
3881 static Builder<NoFieldsSet> create()
3882 {
3883 return Builder<NoFieldsSet>(JSON::Object::create());
3884 }
3885
3886 void setColumnNumber(int value)
3887 {
3888 JSON::ObjectBase::setInteger("columnNumber"_s, value);
3889 }
3890};
3891
3892/* Action to perform when a breakpoint is triggered. */
3893class BreakpointAction : public JSON::ObjectBase {
3894public:
3895 // Named after property name 'type' while generating BreakpointAction.
3896 enum class Type {
3897 Log = 51,
3898 Evaluate = 96,
3899 Sound = 97,
3900 Probe = 98,
3901 }; // enum class Type
3902 enum {
3903 NoFieldsSet = 0,
3904 TypeSet = 1 << 0,
3905 AllFieldsSet = (TypeSet)
3906 };
3907
3908 template<int STATE>
3909 class Builder {
3910 private:
3911 RefPtr<JSON::Object> m_result;
3912
3913 template<int STEP> Builder<STATE | STEP>& castState()
3914 {
3915 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
3916 }
3917
3918 Builder(Ref</*BreakpointAction*/JSON::Object>&& object)
3919 : m_result(WTFMove(object))
3920 {
3921 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
3922 }
3923 friend class BreakpointAction;
3924 public:
3925
3926 Builder<STATE | TypeSet>& setType(Type value)
3927 {
3928 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
3929 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
3930 return castState<TypeSet>();
3931 }
3932
3933 Ref<BreakpointAction> release()
3934 {
3935 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
3936 COMPILE_ASSERT(sizeof(BreakpointAction) == sizeof(JSON::Object), cannot_cast);
3937
3938 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
3939 auto result = WTFMove(*reinterpret_cast<Ref<BreakpointAction>*>(&jsonResult));
3940 return result;
3941 }
3942 };
3943
3944 /*
3945 * Synthetic constructor:
3946 * Ref<BreakpointAction> result = BreakpointAction::create()
3947 * .setType(...)
3948 * .release();
3949 */
3950 static Builder<NoFieldsSet> create()
3951 {
3952 return Builder<NoFieldsSet>(JSON::Object::create());
3953 }
3954
3955 void setData(const String& value)
3956 {
3957 JSON::ObjectBase::setString("data"_s, value);
3958 }
3959
3960 void setId(int value)
3961 {
3962 JSON::ObjectBase::setInteger("id"_s, value);
3963 }
3964};
3965
3966/* Extra options that modify breakpoint behavior. */
3967class BreakpointOptions : public JSON::ObjectBase {
3968public:
3969 enum {
3970 NoFieldsSet = 0,
3971 AllFieldsSet = 0
3972 };
3973
3974 template<int STATE>
3975 class Builder {
3976 private:
3977 RefPtr<JSON::Object> m_result;
3978
3979 template<int STEP> Builder<STATE | STEP>& castState()
3980 {
3981 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
3982 }
3983
3984 Builder(Ref</*BreakpointOptions*/JSON::Object>&& object)
3985 : m_result(WTFMove(object))
3986 {
3987 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
3988 }
3989 friend class BreakpointOptions;
3990 public:
3991
3992 Ref<BreakpointOptions> release()
3993 {
3994 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
3995 COMPILE_ASSERT(sizeof(BreakpointOptions) == sizeof(JSON::Object), cannot_cast);
3996
3997 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
3998 auto result = WTFMove(*reinterpret_cast<Ref<BreakpointOptions>*>(&jsonResult));
3999 return result;
4000 }
4001 };
4002
4003 /*
4004 * Synthetic constructor:
4005 * Ref<BreakpointOptions> result = BreakpointOptions::create()
4006 * .release();
4007 */
4008 static Builder<NoFieldsSet> create()
4009 {
4010 return Builder<NoFieldsSet>(JSON::Object::create());
4011 }
4012
4013 void setCondition(const String& value)
4014 {
4015 JSON::ObjectBase::setString("condition"_s, value);
4016 }
4017
4018 void setActions(RefPtr<JSON::ArrayOf<Inspector::Protocol::Debugger::BreakpointAction>> value)
4019 {
4020 JSON::ObjectBase::setArray("actions"_s, WTFMove(value));
4021 }
4022
4023 void setAutoContinue(bool value)
4024 {
4025 JSON::ObjectBase::setBoolean("autoContinue"_s, value);
4026 }
4027
4028 void setIgnoreCount(int value)
4029 {
4030 JSON::ObjectBase::setInteger("ignoreCount"_s, value);
4031 }
4032};
4033
4034/* Information about the function. */
4035class FunctionDetails : public JSON::ObjectBase {
4036public:
4037 enum {
4038 NoFieldsSet = 0,
4039 LocationSet = 1 << 0,
4040 AllFieldsSet = (LocationSet)
4041 };
4042
4043 template<int STATE>
4044 class Builder {
4045 private:
4046 RefPtr<JSON::Object> m_result;
4047
4048 template<int STEP> Builder<STATE | STEP>& castState()
4049 {
4050 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
4051 }
4052
4053 Builder(Ref</*FunctionDetails*/JSON::Object>&& object)
4054 : m_result(WTFMove(object))
4055 {
4056 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
4057 }
4058 friend class FunctionDetails;
4059 public:
4060
4061 Builder<STATE | LocationSet>& setLocation(RefPtr<Inspector::Protocol::Debugger::Location> value)
4062 {
4063 COMPILE_ASSERT(!(STATE & LocationSet), property_location_already_set);
4064 m_result->setObject("location"_s, value);
4065 return castState<LocationSet>();
4066 }
4067
4068 Ref<FunctionDetails> release()
4069 {
4070 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
4071 COMPILE_ASSERT(sizeof(FunctionDetails) == sizeof(JSON::Object), cannot_cast);
4072
4073 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
4074 auto result = WTFMove(*reinterpret_cast<Ref<FunctionDetails>*>(&jsonResult));
4075 return result;
4076 }
4077 };
4078
4079 /*
4080 * Synthetic constructor:
4081 * Ref<FunctionDetails> result = FunctionDetails::create()
4082 * .setLocation(...)
4083 * .release();
4084 */
4085 static Builder<NoFieldsSet> create()
4086 {
4087 return Builder<NoFieldsSet>(JSON::Object::create());
4088 }
4089
4090 void setName(const String& value)
4091 {
4092 JSON::ObjectBase::setString("name"_s, value);
4093 }
4094
4095 void setDisplayName(const String& value)
4096 {
4097 JSON::ObjectBase::setString("displayName"_s, value);
4098 }
4099
4100 void setScopeChain(RefPtr<JSON::ArrayOf<Inspector::Protocol::Debugger::Scope>> value)
4101 {
4102 JSON::ObjectBase::setArray("scopeChain"_s, WTFMove(value));
4103 }
4104};
4105
4106/* JavaScript call frame. Array of call frames form the call stack. */
4107class CallFrame : public JSON::ObjectBase {
4108public:
4109 enum {
4110 NoFieldsSet = 0,
4111 CallFrameIdSet = 1 << 0,
4112 FunctionNameSet = 1 << 1,
4113 LocationSet = 1 << 2,
4114 ScopeChainSet = 1 << 3,
4115 ThisSet = 1 << 4,
4116 IsTailDeletedSet = 1 << 5,
4117 AllFieldsSet = (CallFrameIdSet | FunctionNameSet | LocationSet | ScopeChainSet | ThisSet | IsTailDeletedSet)
4118 };
4119
4120 template<int STATE>
4121 class Builder {
4122 private:
4123 RefPtr<JSON::Object> m_result;
4124
4125 template<int STEP> Builder<STATE | STEP>& castState()
4126 {
4127 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
4128 }
4129
4130 Builder(Ref</*CallFrame*/JSON::Object>&& object)
4131 : m_result(WTFMove(object))
4132 {
4133 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
4134 }
4135 friend class CallFrame;
4136 public:
4137
4138 Builder<STATE | CallFrameIdSet>& setCallFrameId(const String& value)
4139 {
4140 COMPILE_ASSERT(!(STATE & CallFrameIdSet), property_callFrameId_already_set);
4141 m_result->setString("callFrameId"_s, value);
4142 return castState<CallFrameIdSet>();
4143 }
4144
4145 Builder<STATE | FunctionNameSet>& setFunctionName(const String& value)
4146 {
4147 COMPILE_ASSERT(!(STATE & FunctionNameSet), property_functionName_already_set);
4148 m_result->setString("functionName"_s, value);
4149 return castState<FunctionNameSet>();
4150 }
4151
4152 Builder<STATE | LocationSet>& setLocation(RefPtr<Inspector::Protocol::Debugger::Location> value)
4153 {
4154 COMPILE_ASSERT(!(STATE & LocationSet), property_location_already_set);
4155 m_result->setObject("location"_s, value);
4156 return castState<LocationSet>();
4157 }
4158
4159 Builder<STATE | ScopeChainSet>& setScopeChain(RefPtr<JSON::ArrayOf<Inspector::Protocol::Debugger::Scope>> value)
4160 {
4161 COMPILE_ASSERT(!(STATE & ScopeChainSet), property_scopeChain_already_set);
4162 m_result->setArray("scopeChain"_s, value);
4163 return castState<ScopeChainSet>();
4164 }
4165
4166 Builder<STATE | ThisSet>& setThis(RefPtr<Inspector::Protocol::Runtime::RemoteObject> value)
4167 {
4168 COMPILE_ASSERT(!(STATE & ThisSet), property_this_already_set);
4169 m_result->setObject("this"_s, value);
4170 return castState<ThisSet>();
4171 }
4172
4173 Builder<STATE | IsTailDeletedSet>& setIsTailDeleted(bool value)
4174 {
4175 COMPILE_ASSERT(!(STATE & IsTailDeletedSet), property_isTailDeleted_already_set);
4176 m_result->setBoolean("isTailDeleted"_s, value);
4177 return castState<IsTailDeletedSet>();
4178 }
4179
4180 Ref<CallFrame> release()
4181 {
4182 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
4183 COMPILE_ASSERT(sizeof(CallFrame) == sizeof(JSON::Object), cannot_cast);
4184
4185 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
4186 auto result = WTFMove(*reinterpret_cast<Ref<CallFrame>*>(&jsonResult));
4187 return result;
4188 }
4189 };
4190
4191 /*
4192 * Synthetic constructor:
4193 * Ref<CallFrame> result = CallFrame::create()
4194 * .setCallFrameId(...)
4195 * .setFunctionName(...)
4196 * .setLocation(...)
4197 * .setScopeChain(...)
4198 * .setThis(...)
4199 * .setIsTailDeleted(...)
4200 * .release();
4201 */
4202 static Builder<NoFieldsSet> create()
4203 {
4204 return Builder<NoFieldsSet>(JSON::Object::create());
4205 }
4206};
4207
4208/* Scope description. */
4209class Scope : public JSON::ObjectBase {
4210public:
4211 // Named after property name 'type' while generating Scope.
4212 enum class Type {
4213 Global = 99,
4214 With = 100,
4215 Closure = 101,
4216 Catch = 102,
4217 FunctionName = 103,
4218 GlobalLexicalEnvironment = 104,
4219 NestedLexical = 105,
4220 }; // enum class Type
4221 enum {
4222 NoFieldsSet = 0,
4223 ObjectSet = 1 << 0,
4224 TypeSet = 1 << 1,
4225 AllFieldsSet = (ObjectSet | TypeSet)
4226 };
4227
4228 template<int STATE>
4229 class Builder {
4230 private:
4231 RefPtr<JSON::Object> m_result;
4232
4233 template<int STEP> Builder<STATE | STEP>& castState()
4234 {
4235 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
4236 }
4237
4238 Builder(Ref</*Scope*/JSON::Object>&& object)
4239 : m_result(WTFMove(object))
4240 {
4241 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
4242 }
4243 friend class Scope;
4244 public:
4245
4246 Builder<STATE | ObjectSet>& setObject(RefPtr<Inspector::Protocol::Runtime::RemoteObject> value)
4247 {
4248 COMPILE_ASSERT(!(STATE & ObjectSet), property_object_already_set);
4249 m_result->setObject("object"_s, value);
4250 return castState<ObjectSet>();
4251 }
4252
4253 Builder<STATE | TypeSet>& setType(Type value)
4254 {
4255 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
4256 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
4257 return castState<TypeSet>();
4258 }
4259
4260 Ref<Scope> release()
4261 {
4262 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
4263 COMPILE_ASSERT(sizeof(Scope) == sizeof(JSON::Object), cannot_cast);
4264
4265 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
4266 auto result = WTFMove(*reinterpret_cast<Ref<Scope>*>(&jsonResult));
4267 return result;
4268 }
4269 };
4270
4271 /*
4272 * Synthetic constructor:
4273 * Ref<Scope> result = Scope::create()
4274 * .setObject(...)
4275 * .setType(...)
4276 * .release();
4277 */
4278 static Builder<NoFieldsSet> create()
4279 {
4280 return Builder<NoFieldsSet>(JSON::Object::create());
4281 }
4282
4283 void setName(const String& value)
4284 {
4285 JSON::ObjectBase::setString("name"_s, value);
4286 }
4287
4288 void setLocation(RefPtr<Inspector::Protocol::Debugger::Location> value)
4289 {
4290 JSON::ObjectBase::setObject("location"_s, WTFMove(value));
4291 }
4292
4293 void setEmpty(bool value)
4294 {
4295 JSON::ObjectBase::setBoolean("empty"_s, value);
4296 }
4297};
4298
4299/* A sample collected by evaluating a probe breakpoint action. */
4300class ProbeSample : public JSON::ObjectBase {
4301public:
4302 enum {
4303 NoFieldsSet = 0,
4304 ProbeIdSet = 1 << 0,
4305 SampleIdSet = 1 << 1,
4306 BatchIdSet = 1 << 2,
4307 TimestampSet = 1 << 3,
4308 PayloadSet = 1 << 4,
4309 AllFieldsSet = (ProbeIdSet | SampleIdSet | BatchIdSet | TimestampSet | PayloadSet)
4310 };
4311
4312 template<int STATE>
4313 class Builder {
4314 private:
4315 RefPtr<JSON::Object> m_result;
4316
4317 template<int STEP> Builder<STATE | STEP>& castState()
4318 {
4319 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
4320 }
4321
4322 Builder(Ref</*ProbeSample*/JSON::Object>&& object)
4323 : m_result(WTFMove(object))
4324 {
4325 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
4326 }
4327 friend class ProbeSample;
4328 public:
4329
4330 Builder<STATE | ProbeIdSet>& setProbeId(int value)
4331 {
4332 COMPILE_ASSERT(!(STATE & ProbeIdSet), property_probeId_already_set);
4333 m_result->setInteger("probeId"_s, value);
4334 return castState<ProbeIdSet>();
4335 }
4336
4337 Builder<STATE | SampleIdSet>& setSampleId(int value)
4338 {
4339 COMPILE_ASSERT(!(STATE & SampleIdSet), property_sampleId_already_set);
4340 m_result->setInteger("sampleId"_s, value);
4341 return castState<SampleIdSet>();
4342 }
4343
4344 Builder<STATE | BatchIdSet>& setBatchId(int value)
4345 {
4346 COMPILE_ASSERT(!(STATE & BatchIdSet), property_batchId_already_set);
4347 m_result->setInteger("batchId"_s, value);
4348 return castState<BatchIdSet>();
4349 }
4350
4351 Builder<STATE | TimestampSet>& setTimestamp(double value)
4352 {
4353 COMPILE_ASSERT(!(STATE & TimestampSet), property_timestamp_already_set);
4354 m_result->setDouble("timestamp"_s, value);
4355 return castState<TimestampSet>();
4356 }
4357
4358 Builder<STATE | PayloadSet>& setPayload(RefPtr<Inspector::Protocol::Runtime::RemoteObject> value)
4359 {
4360 COMPILE_ASSERT(!(STATE & PayloadSet), property_payload_already_set);
4361 m_result->setObject("payload"_s, value);
4362 return castState<PayloadSet>();
4363 }
4364
4365 Ref<ProbeSample> release()
4366 {
4367 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
4368 COMPILE_ASSERT(sizeof(ProbeSample) == sizeof(JSON::Object), cannot_cast);
4369
4370 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
4371 auto result = WTFMove(*reinterpret_cast<Ref<ProbeSample>*>(&jsonResult));
4372 return result;
4373 }
4374 };
4375
4376 /*
4377 * Synthetic constructor:
4378 * Ref<ProbeSample> result = ProbeSample::create()
4379 * .setProbeId(...)
4380 * .setSampleId(...)
4381 * .setBatchId(...)
4382 * .setTimestamp(...)
4383 * .setPayload(...)
4384 * .release();
4385 */
4386 static Builder<NoFieldsSet> create()
4387 {
4388 return Builder<NoFieldsSet>(JSON::Object::create());
4389 }
4390};
4391
4392/* The pause reason auxiliary data when paused because of an assertion. */
4393class AssertPauseReason : public JSON::ObjectBase {
4394public:
4395 enum {
4396 NoFieldsSet = 0,
4397 AllFieldsSet = 0
4398 };
4399
4400 template<int STATE>
4401 class Builder {
4402 private:
4403 RefPtr<JSON::Object> m_result;
4404
4405 template<int STEP> Builder<STATE | STEP>& castState()
4406 {
4407 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
4408 }
4409
4410 Builder(Ref</*AssertPauseReason*/JSON::Object>&& object)
4411 : m_result(WTFMove(object))
4412 {
4413 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
4414 }
4415 friend class AssertPauseReason;
4416 public:
4417
4418 Ref<AssertPauseReason> release()
4419 {
4420 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
4421 COMPILE_ASSERT(sizeof(AssertPauseReason) == sizeof(JSON::Object), cannot_cast);
4422
4423 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
4424 auto result = WTFMove(*reinterpret_cast<Ref<AssertPauseReason>*>(&jsonResult));
4425 return result;
4426 }
4427 };
4428
4429 /*
4430 * Synthetic constructor:
4431 * Ref<AssertPauseReason> result = AssertPauseReason::create()
4432 * .release();
4433 */
4434 static Builder<NoFieldsSet> create()
4435 {
4436 return Builder<NoFieldsSet>(JSON::Object::create());
4437 }
4438
4439 void setMessage(const String& value)
4440 {
4441 JSON::ObjectBase::setString("message"_s, value);
4442 }
4443};
4444
4445/* The pause reason auxiliary data when paused because of hitting a breakpoint. */
4446class BreakpointPauseReason : public JSON::ObjectBase {
4447public:
4448 enum {
4449 NoFieldsSet = 0,
4450 BreakpointIdSet = 1 << 0,
4451 AllFieldsSet = (BreakpointIdSet)
4452 };
4453
4454 template<int STATE>
4455 class Builder {
4456 private:
4457 RefPtr<JSON::Object> m_result;
4458
4459 template<int STEP> Builder<STATE | STEP>& castState()
4460 {
4461 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
4462 }
4463
4464 Builder(Ref</*BreakpointPauseReason*/JSON::Object>&& object)
4465 : m_result(WTFMove(object))
4466 {
4467 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
4468 }
4469 friend class BreakpointPauseReason;
4470 public:
4471
4472 Builder<STATE | BreakpointIdSet>& setBreakpointId(const String& value)
4473 {
4474 COMPILE_ASSERT(!(STATE & BreakpointIdSet), property_breakpointId_already_set);
4475 m_result->setString("breakpointId"_s, value);
4476 return castState<BreakpointIdSet>();
4477 }
4478
4479 Ref<BreakpointPauseReason> release()
4480 {
4481 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
4482 COMPILE_ASSERT(sizeof(BreakpointPauseReason) == sizeof(JSON::Object), cannot_cast);
4483
4484 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
4485 auto result = WTFMove(*reinterpret_cast<Ref<BreakpointPauseReason>*>(&jsonResult));
4486 return result;
4487 }
4488 };
4489
4490 /*
4491 * Synthetic constructor:
4492 * Ref<BreakpointPauseReason> result = BreakpointPauseReason::create()
4493 * .setBreakpointId(...)
4494 * .release();
4495 */
4496 static Builder<NoFieldsSet> create()
4497 {
4498 return Builder<NoFieldsSet>(JSON::Object::create());
4499 }
4500};
4501
4502/* The pause reason auxiliary data when paused because of a Content Security Policy directive. */
4503class CSPViolationPauseReason : public JSON::ObjectBase {
4504public:
4505 enum {
4506 NoFieldsSet = 0,
4507 DirectiveSet = 1 << 0,
4508 AllFieldsSet = (DirectiveSet)
4509 };
4510
4511 template<int STATE>
4512 class Builder {
4513 private:
4514 RefPtr<JSON::Object> m_result;
4515
4516 template<int STEP> Builder<STATE | STEP>& castState()
4517 {
4518 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
4519 }
4520
4521 Builder(Ref</*CSPViolationPauseReason*/JSON::Object>&& object)
4522 : m_result(WTFMove(object))
4523 {
4524 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
4525 }
4526 friend class CSPViolationPauseReason;
4527 public:
4528
4529 Builder<STATE | DirectiveSet>& setDirective(const String& value)
4530 {
4531 COMPILE_ASSERT(!(STATE & DirectiveSet), property_directive_already_set);
4532 m_result->setString("directive"_s, value);
4533 return castState<DirectiveSet>();
4534 }
4535
4536 Ref<CSPViolationPauseReason> release()
4537 {
4538 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
4539 COMPILE_ASSERT(sizeof(CSPViolationPauseReason) == sizeof(JSON::Object), cannot_cast);
4540
4541 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
4542 auto result = WTFMove(*reinterpret_cast<Ref<CSPViolationPauseReason>*>(&jsonResult));
4543 return result;
4544 }
4545 };
4546
4547 /*
4548 * Synthetic constructor:
4549 * Ref<CSPViolationPauseReason> result = CSPViolationPauseReason::create()
4550 * .setDirective(...)
4551 * .release();
4552 */
4553 static Builder<NoFieldsSet> create()
4554 {
4555 return Builder<NoFieldsSet>(JSON::Object::create());
4556 }
4557};
4558
4559} // Debugger
4560
4561namespace GenericTypes {
4562/* Search match in a resource. */
4563class SearchMatch : public JSON::ObjectBase {
4564public:
4565 enum {
4566 NoFieldsSet = 0,
4567 LineNumberSet = 1 << 0,
4568 LineContentSet = 1 << 1,
4569 AllFieldsSet = (LineNumberSet | LineContentSet)
4570 };
4571
4572 template<int STATE>
4573 class Builder {
4574 private:
4575 RefPtr<JSON::Object> m_result;
4576
4577 template<int STEP> Builder<STATE | STEP>& castState()
4578 {
4579 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
4580 }
4581
4582 Builder(Ref</*SearchMatch*/JSON::Object>&& object)
4583 : m_result(WTFMove(object))
4584 {
4585 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
4586 }
4587 friend class SearchMatch;
4588 public:
4589
4590 Builder<STATE | LineNumberSet>& setLineNumber(double value)
4591 {
4592 COMPILE_ASSERT(!(STATE & LineNumberSet), property_lineNumber_already_set);
4593 m_result->setDouble("lineNumber"_s, value);
4594 return castState<LineNumberSet>();
4595 }
4596
4597 Builder<STATE | LineContentSet>& setLineContent(const String& value)
4598 {
4599 COMPILE_ASSERT(!(STATE & LineContentSet), property_lineContent_already_set);
4600 m_result->setString("lineContent"_s, value);
4601 return castState<LineContentSet>();
4602 }
4603
4604 Ref<SearchMatch> release()
4605 {
4606 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
4607 COMPILE_ASSERT(sizeof(SearchMatch) == sizeof(JSON::Object), cannot_cast);
4608
4609 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
4610 auto result = WTFMove(*reinterpret_cast<Ref<SearchMatch>*>(&jsonResult));
4611 return result;
4612 }
4613 };
4614
4615 /*
4616 * Synthetic constructor:
4617 * Ref<SearchMatch> result = SearchMatch::create()
4618 * .setLineNumber(...)
4619 * .setLineContent(...)
4620 * .release();
4621 */
4622 static Builder<NoFieldsSet> create()
4623 {
4624 return Builder<NoFieldsSet>(JSON::Object::create());
4625 }
4626};
4627
4628} // GenericTypes
4629
4630namespace Heap {
4631/* Information about a garbage collection. */
4632class GarbageCollection : public JSON::ObjectBase {
4633public:
4634 // Named after property name 'type' while generating GarbageCollection.
4635 enum class Type {
4636 Full = 106,
4637 Partial = 107,
4638 }; // enum class Type
4639 enum {
4640 NoFieldsSet = 0,
4641 TypeSet = 1 << 0,
4642 StartTimeSet = 1 << 1,
4643 EndTimeSet = 1 << 2,
4644 AllFieldsSet = (TypeSet | StartTimeSet | EndTimeSet)
4645 };
4646
4647 template<int STATE>
4648 class Builder {
4649 private:
4650 RefPtr<JSON::Object> m_result;
4651
4652 template<int STEP> Builder<STATE | STEP>& castState()
4653 {
4654 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
4655 }
4656
4657 Builder(Ref</*GarbageCollection*/JSON::Object>&& object)
4658 : m_result(WTFMove(object))
4659 {
4660 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
4661 }
4662 friend class GarbageCollection;
4663 public:
4664
4665 Builder<STATE | TypeSet>& setType(Type value)
4666 {
4667 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
4668 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
4669 return castState<TypeSet>();
4670 }
4671
4672 Builder<STATE | StartTimeSet>& setStartTime(double value)
4673 {
4674 COMPILE_ASSERT(!(STATE & StartTimeSet), property_startTime_already_set);
4675 m_result->setDouble("startTime"_s, value);
4676 return castState<StartTimeSet>();
4677 }
4678
4679 Builder<STATE | EndTimeSet>& setEndTime(double value)
4680 {
4681 COMPILE_ASSERT(!(STATE & EndTimeSet), property_endTime_already_set);
4682 m_result->setDouble("endTime"_s, value);
4683 return castState<EndTimeSet>();
4684 }
4685
4686 Ref<GarbageCollection> release()
4687 {
4688 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
4689 COMPILE_ASSERT(sizeof(GarbageCollection) == sizeof(JSON::Object), cannot_cast);
4690
4691 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
4692 auto result = WTFMove(*reinterpret_cast<Ref<GarbageCollection>*>(&jsonResult));
4693 return result;
4694 }
4695 };
4696
4697 /*
4698 * Synthetic constructor:
4699 * Ref<GarbageCollection> result = GarbageCollection::create()
4700 * .setType(...)
4701 * .setStartTime(...)
4702 * .setEndTime(...)
4703 * .release();
4704 */
4705 static Builder<NoFieldsSet> create()
4706 {
4707 return Builder<NoFieldsSet>(JSON::Object::create());
4708 }
4709};
4710
4711} // Heap
4712
4713#if ENABLE(INDEXED_DATABASE)
4714namespace IndexedDB {
4715/* Database with an array of object stores. */
4716class DatabaseWithObjectStores : public JSON::ObjectBase {
4717public:
4718 enum {
4719 NoFieldsSet = 0,
4720 NameSet = 1 << 0,
4721 VersionSet = 1 << 1,
4722 ObjectStoresSet = 1 << 2,
4723 AllFieldsSet = (NameSet | VersionSet | ObjectStoresSet)
4724 };
4725
4726 template<int STATE>
4727 class Builder {
4728 private:
4729 RefPtr<JSON::Object> m_result;
4730
4731 template<int STEP> Builder<STATE | STEP>& castState()
4732 {
4733 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
4734 }
4735
4736 Builder(Ref</*DatabaseWithObjectStores*/JSON::Object>&& object)
4737 : m_result(WTFMove(object))
4738 {
4739 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
4740 }
4741 friend class DatabaseWithObjectStores;
4742 public:
4743
4744 Builder<STATE | NameSet>& setName(const String& value)
4745 {
4746 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
4747 m_result->setString("name"_s, value);
4748 return castState<NameSet>();
4749 }
4750
4751 Builder<STATE | VersionSet>& setVersion(double value)
4752 {
4753 COMPILE_ASSERT(!(STATE & VersionSet), property_version_already_set);
4754 m_result->setDouble("version"_s, value);
4755 return castState<VersionSet>();
4756 }
4757
4758 Builder<STATE | ObjectStoresSet>& setObjectStores(RefPtr<JSON::ArrayOf<Inspector::Protocol::IndexedDB::ObjectStore>> value)
4759 {
4760 COMPILE_ASSERT(!(STATE & ObjectStoresSet), property_objectStores_already_set);
4761 m_result->setArray("objectStores"_s, value);
4762 return castState<ObjectStoresSet>();
4763 }
4764
4765 Ref<DatabaseWithObjectStores> release()
4766 {
4767 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
4768 COMPILE_ASSERT(sizeof(DatabaseWithObjectStores) == sizeof(JSON::Object), cannot_cast);
4769
4770 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
4771 auto result = WTFMove(*reinterpret_cast<Ref<DatabaseWithObjectStores>*>(&jsonResult));
4772 return result;
4773 }
4774 };
4775
4776 /*
4777 * Synthetic constructor:
4778 * Ref<DatabaseWithObjectStores> result = DatabaseWithObjectStores::create()
4779 * .setName(...)
4780 * .setVersion(...)
4781 * .setObjectStores(...)
4782 * .release();
4783 */
4784 static Builder<NoFieldsSet> create()
4785 {
4786 return Builder<NoFieldsSet>(JSON::Object::create());
4787 }
4788};
4789
4790/* Object store. */
4791class ObjectStore : public JSON::ObjectBase {
4792public:
4793 enum {
4794 NoFieldsSet = 0,
4795 NameSet = 1 << 0,
4796 KeyPathSet = 1 << 1,
4797 AutoIncrementSet = 1 << 2,
4798 IndexesSet = 1 << 3,
4799 AllFieldsSet = (NameSet | KeyPathSet | AutoIncrementSet | IndexesSet)
4800 };
4801
4802 template<int STATE>
4803 class Builder {
4804 private:
4805 RefPtr<JSON::Object> m_result;
4806
4807 template<int STEP> Builder<STATE | STEP>& castState()
4808 {
4809 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
4810 }
4811
4812 Builder(Ref</*ObjectStore*/JSON::Object>&& object)
4813 : m_result(WTFMove(object))
4814 {
4815 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
4816 }
4817 friend class ObjectStore;
4818 public:
4819
4820 Builder<STATE | NameSet>& setName(const String& value)
4821 {
4822 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
4823 m_result->setString("name"_s, value);
4824 return castState<NameSet>();
4825 }
4826
4827 Builder<STATE | KeyPathSet>& setKeyPath(RefPtr<Inspector::Protocol::IndexedDB::KeyPath> value)
4828 {
4829 COMPILE_ASSERT(!(STATE & KeyPathSet), property_keyPath_already_set);
4830 m_result->setObject("keyPath"_s, value);
4831 return castState<KeyPathSet>();
4832 }
4833
4834 Builder<STATE | AutoIncrementSet>& setAutoIncrement(bool value)
4835 {
4836 COMPILE_ASSERT(!(STATE & AutoIncrementSet), property_autoIncrement_already_set);
4837 m_result->setBoolean("autoIncrement"_s, value);
4838 return castState<AutoIncrementSet>();
4839 }
4840
4841 Builder<STATE | IndexesSet>& setIndexes(RefPtr<JSON::ArrayOf<Inspector::Protocol::IndexedDB::ObjectStoreIndex>> value)
4842 {
4843 COMPILE_ASSERT(!(STATE & IndexesSet), property_indexes_already_set);
4844 m_result->setArray("indexes"_s, value);
4845 return castState<IndexesSet>();
4846 }
4847
4848 Ref<ObjectStore> release()
4849 {
4850 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
4851 COMPILE_ASSERT(sizeof(ObjectStore) == sizeof(JSON::Object), cannot_cast);
4852
4853 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
4854 auto result = WTFMove(*reinterpret_cast<Ref<ObjectStore>*>(&jsonResult));
4855 return result;
4856 }
4857 };
4858
4859 /*
4860 * Synthetic constructor:
4861 * Ref<ObjectStore> result = ObjectStore::create()
4862 * .setName(...)
4863 * .setKeyPath(...)
4864 * .setAutoIncrement(...)
4865 * .setIndexes(...)
4866 * .release();
4867 */
4868 static Builder<NoFieldsSet> create()
4869 {
4870 return Builder<NoFieldsSet>(JSON::Object::create());
4871 }
4872};
4873
4874/* Object store index. */
4875class ObjectStoreIndex : public JSON::ObjectBase {
4876public:
4877 enum {
4878 NoFieldsSet = 0,
4879 NameSet = 1 << 0,
4880 KeyPathSet = 1 << 1,
4881 UniqueSet = 1 << 2,
4882 MultiEntrySet = 1 << 3,
4883 AllFieldsSet = (NameSet | KeyPathSet | UniqueSet | MultiEntrySet)
4884 };
4885
4886 template<int STATE>
4887 class Builder {
4888 private:
4889 RefPtr<JSON::Object> m_result;
4890
4891 template<int STEP> Builder<STATE | STEP>& castState()
4892 {
4893 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
4894 }
4895
4896 Builder(Ref</*ObjectStoreIndex*/JSON::Object>&& object)
4897 : m_result(WTFMove(object))
4898 {
4899 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
4900 }
4901 friend class ObjectStoreIndex;
4902 public:
4903
4904 Builder<STATE | NameSet>& setName(const String& value)
4905 {
4906 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
4907 m_result->setString("name"_s, value);
4908 return castState<NameSet>();
4909 }
4910
4911 Builder<STATE | KeyPathSet>& setKeyPath(RefPtr<Inspector::Protocol::IndexedDB::KeyPath> value)
4912 {
4913 COMPILE_ASSERT(!(STATE & KeyPathSet), property_keyPath_already_set);
4914 m_result->setObject("keyPath"_s, value);
4915 return castState<KeyPathSet>();
4916 }
4917
4918 Builder<STATE | UniqueSet>& setUnique(bool value)
4919 {
4920 COMPILE_ASSERT(!(STATE & UniqueSet), property_unique_already_set);
4921 m_result->setBoolean("unique"_s, value);
4922 return castState<UniqueSet>();
4923 }
4924
4925 Builder<STATE | MultiEntrySet>& setMultiEntry(bool value)
4926 {
4927 COMPILE_ASSERT(!(STATE & MultiEntrySet), property_multiEntry_already_set);
4928 m_result->setBoolean("multiEntry"_s, value);
4929 return castState<MultiEntrySet>();
4930 }
4931
4932 Ref<ObjectStoreIndex> release()
4933 {
4934 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
4935 COMPILE_ASSERT(sizeof(ObjectStoreIndex) == sizeof(JSON::Object), cannot_cast);
4936
4937 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
4938 auto result = WTFMove(*reinterpret_cast<Ref<ObjectStoreIndex>*>(&jsonResult));
4939 return result;
4940 }
4941 };
4942
4943 /*
4944 * Synthetic constructor:
4945 * Ref<ObjectStoreIndex> result = ObjectStoreIndex::create()
4946 * .setName(...)
4947 * .setKeyPath(...)
4948 * .setUnique(...)
4949 * .setMultiEntry(...)
4950 * .release();
4951 */
4952 static Builder<NoFieldsSet> create()
4953 {
4954 return Builder<NoFieldsSet>(JSON::Object::create());
4955 }
4956};
4957
4958/* Key. */
4959class Key : public JSON::ObjectBase {
4960public:
4961 // Named after property name 'type' while generating Key.
4962 enum class Type {
4963 Number = 108,
4964 String = 109,
4965 Date = 84,
4966 Array = 110,
4967 }; // enum class Type
4968 enum {
4969 NoFieldsSet = 0,
4970 TypeSet = 1 << 0,
4971 AllFieldsSet = (TypeSet)
4972 };
4973
4974 template<int STATE>
4975 class Builder {
4976 private:
4977 RefPtr<JSON::Object> m_result;
4978
4979 template<int STEP> Builder<STATE | STEP>& castState()
4980 {
4981 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
4982 }
4983
4984 Builder(Ref</*Key*/JSON::Object>&& object)
4985 : m_result(WTFMove(object))
4986 {
4987 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
4988 }
4989 friend class Key;
4990 public:
4991
4992 Builder<STATE | TypeSet>& setType(Type value)
4993 {
4994 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
4995 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
4996 return castState<TypeSet>();
4997 }
4998
4999 Ref<Key> release()
5000 {
5001 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
5002 COMPILE_ASSERT(sizeof(Key) == sizeof(JSON::Object), cannot_cast);
5003
5004 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
5005 auto result = WTFMove(*reinterpret_cast<Ref<Key>*>(&jsonResult));
5006 return result;
5007 }
5008 };
5009
5010 /*
5011 * Synthetic constructor:
5012 * Ref<Key> result = Key::create()
5013 * .setType(...)
5014 * .release();
5015 */
5016 static Builder<NoFieldsSet> create()
5017 {
5018 return Builder<NoFieldsSet>(JSON::Object::create());
5019 }
5020
5021 void setNumber(double value)
5022 {
5023 JSON::ObjectBase::setDouble("number"_s, value);
5024 }
5025
5026 void setString(const String& value)
5027 {
5028 JSON::ObjectBase::setString("string"_s, value);
5029 }
5030
5031 void setDate(double value)
5032 {
5033 JSON::ObjectBase::setDouble("date"_s, value);
5034 }
5035
5036 void setArray(RefPtr<JSON::ArrayOf<Inspector::Protocol::IndexedDB::Key>> value)
5037 {
5038 JSON::ObjectBase::setArray("array"_s, WTFMove(value));
5039 }
5040};
5041
5042/* Key range. */
5043class KeyRange : public JSON::ObjectBase {
5044public:
5045 enum {
5046 NoFieldsSet = 0,
5047 LowerOpenSet = 1 << 0,
5048 UpperOpenSet = 1 << 1,
5049 AllFieldsSet = (LowerOpenSet | UpperOpenSet)
5050 };
5051
5052 template<int STATE>
5053 class Builder {
5054 private:
5055 RefPtr<JSON::Object> m_result;
5056
5057 template<int STEP> Builder<STATE | STEP>& castState()
5058 {
5059 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
5060 }
5061
5062 Builder(Ref</*KeyRange*/JSON::Object>&& object)
5063 : m_result(WTFMove(object))
5064 {
5065 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
5066 }
5067 friend class KeyRange;
5068 public:
5069
5070 Builder<STATE | LowerOpenSet>& setLowerOpen(bool value)
5071 {
5072 COMPILE_ASSERT(!(STATE & LowerOpenSet), property_lowerOpen_already_set);
5073 m_result->setBoolean("lowerOpen"_s, value);
5074 return castState<LowerOpenSet>();
5075 }
5076
5077 Builder<STATE | UpperOpenSet>& setUpperOpen(bool value)
5078 {
5079 COMPILE_ASSERT(!(STATE & UpperOpenSet), property_upperOpen_already_set);
5080 m_result->setBoolean("upperOpen"_s, value);
5081 return castState<UpperOpenSet>();
5082 }
5083
5084 Ref<KeyRange> release()
5085 {
5086 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
5087 COMPILE_ASSERT(sizeof(KeyRange) == sizeof(JSON::Object), cannot_cast);
5088
5089 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
5090 auto result = WTFMove(*reinterpret_cast<Ref<KeyRange>*>(&jsonResult));
5091 return result;
5092 }
5093 };
5094
5095 /*
5096 * Synthetic constructor:
5097 * Ref<KeyRange> result = KeyRange::create()
5098 * .setLowerOpen(...)
5099 * .setUpperOpen(...)
5100 * .release();
5101 */
5102 static Builder<NoFieldsSet> create()
5103 {
5104 return Builder<NoFieldsSet>(JSON::Object::create());
5105 }
5106
5107 void setLower(RefPtr<Inspector::Protocol::IndexedDB::Key> value)
5108 {
5109 JSON::ObjectBase::setObject("lower"_s, WTFMove(value));
5110 }
5111
5112 void setUpper(RefPtr<Inspector::Protocol::IndexedDB::Key> value)
5113 {
5114 JSON::ObjectBase::setObject("upper"_s, WTFMove(value));
5115 }
5116};
5117
5118/* Data entry. */
5119class DataEntry : public JSON::ObjectBase {
5120public:
5121 enum {
5122 NoFieldsSet = 0,
5123 KeySet = 1 << 0,
5124 PrimaryKeySet = 1 << 1,
5125 ValueSet = 1 << 2,
5126 AllFieldsSet = (KeySet | PrimaryKeySet | ValueSet)
5127 };
5128
5129 template<int STATE>
5130 class Builder {
5131 private:
5132 RefPtr<JSON::Object> m_result;
5133
5134 template<int STEP> Builder<STATE | STEP>& castState()
5135 {
5136 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
5137 }
5138
5139 Builder(Ref</*DataEntry*/JSON::Object>&& object)
5140 : m_result(WTFMove(object))
5141 {
5142 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
5143 }
5144 friend class DataEntry;
5145 public:
5146
5147 Builder<STATE | KeySet>& setKey(RefPtr<Inspector::Protocol::Runtime::RemoteObject> value)
5148 {
5149 COMPILE_ASSERT(!(STATE & KeySet), property_key_already_set);
5150 m_result->setObject("key"_s, value);
5151 return castState<KeySet>();
5152 }
5153
5154 Builder<STATE | PrimaryKeySet>& setPrimaryKey(RefPtr<Inspector::Protocol::Runtime::RemoteObject> value)
5155 {
5156 COMPILE_ASSERT(!(STATE & PrimaryKeySet), property_primaryKey_already_set);
5157 m_result->setObject("primaryKey"_s, value);
5158 return castState<PrimaryKeySet>();
5159 }
5160
5161 Builder<STATE | ValueSet>& setValue(RefPtr<Inspector::Protocol::Runtime::RemoteObject> value)
5162 {
5163 COMPILE_ASSERT(!(STATE & ValueSet), property_value_already_set);
5164 m_result->setObject("value"_s, value);
5165 return castState<ValueSet>();
5166 }
5167
5168 Ref<DataEntry> release()
5169 {
5170 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
5171 COMPILE_ASSERT(sizeof(DataEntry) == sizeof(JSON::Object), cannot_cast);
5172
5173 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
5174 auto result = WTFMove(*reinterpret_cast<Ref<DataEntry>*>(&jsonResult));
5175 return result;
5176 }
5177 };
5178
5179 /*
5180 * Synthetic constructor:
5181 * Ref<DataEntry> result = DataEntry::create()
5182 * .setKey(...)
5183 * .setPrimaryKey(...)
5184 * .setValue(...)
5185 * .release();
5186 */
5187 static Builder<NoFieldsSet> create()
5188 {
5189 return Builder<NoFieldsSet>(JSON::Object::create());
5190 }
5191};
5192
5193/* Key path. */
5194class KeyPath : public JSON::ObjectBase {
5195public:
5196 // Named after property name 'type' while generating KeyPath.
5197 enum class Type {
5198 Null = 111,
5199 String = 109,
5200 Array = 110,
5201 }; // enum class Type
5202 enum {
5203 NoFieldsSet = 0,
5204 TypeSet = 1 << 0,
5205 AllFieldsSet = (TypeSet)
5206 };
5207
5208 template<int STATE>
5209 class Builder {
5210 private:
5211 RefPtr<JSON::Object> m_result;
5212
5213 template<int STEP> Builder<STATE | STEP>& castState()
5214 {
5215 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
5216 }
5217
5218 Builder(Ref</*KeyPath*/JSON::Object>&& object)
5219 : m_result(WTFMove(object))
5220 {
5221 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
5222 }
5223 friend class KeyPath;
5224 public:
5225
5226 Builder<STATE | TypeSet>& setType(Type value)
5227 {
5228 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
5229 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
5230 return castState<TypeSet>();
5231 }
5232
5233 Ref<KeyPath> release()
5234 {
5235 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
5236 COMPILE_ASSERT(sizeof(KeyPath) == sizeof(JSON::Object), cannot_cast);
5237
5238 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
5239 auto result = WTFMove(*reinterpret_cast<Ref<KeyPath>*>(&jsonResult));
5240 return result;
5241 }
5242 };
5243
5244 /*
5245 * Synthetic constructor:
5246 * Ref<KeyPath> result = KeyPath::create()
5247 * .setType(...)
5248 * .release();
5249 */
5250 static Builder<NoFieldsSet> create()
5251 {
5252 return Builder<NoFieldsSet>(JSON::Object::create());
5253 }
5254
5255 void setString(const String& value)
5256 {
5257 JSON::ObjectBase::setString("string"_s, value);
5258 }
5259
5260 void setArray(RefPtr<JSON::ArrayOf<String>> value)
5261 {
5262 JSON::ObjectBase::setArray("array"_s, WTFMove(value));
5263 }
5264};
5265
5266} // IndexedDB
5267#endif // ENABLE(INDEXED_DATABASE)
5268
5269namespace LayerTree {
5270/* A rectangle. */
5271class IntRect : public JSON::ObjectBase {
5272public:
5273 enum {
5274 NoFieldsSet = 0,
5275 XSet = 1 << 0,
5276 YSet = 1 << 1,
5277 WidthSet = 1 << 2,
5278 HeightSet = 1 << 3,
5279 AllFieldsSet = (XSet | YSet | WidthSet | HeightSet)
5280 };
5281
5282 template<int STATE>
5283 class Builder {
5284 private:
5285 RefPtr<JSON::Object> m_result;
5286
5287 template<int STEP> Builder<STATE | STEP>& castState()
5288 {
5289 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
5290 }
5291
5292 Builder(Ref</*IntRect*/JSON::Object>&& object)
5293 : m_result(WTFMove(object))
5294 {
5295 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
5296 }
5297 friend class IntRect;
5298 public:
5299
5300 Builder<STATE | XSet>& setX(int value)
5301 {
5302 COMPILE_ASSERT(!(STATE & XSet), property_x_already_set);
5303 m_result->setInteger("x"_s, value);
5304 return castState<XSet>();
5305 }
5306
5307 Builder<STATE | YSet>& setY(int value)
5308 {
5309 COMPILE_ASSERT(!(STATE & YSet), property_y_already_set);
5310 m_result->setInteger("y"_s, value);
5311 return castState<YSet>();
5312 }
5313
5314 Builder<STATE | WidthSet>& setWidth(int value)
5315 {
5316 COMPILE_ASSERT(!(STATE & WidthSet), property_width_already_set);
5317 m_result->setInteger("width"_s, value);
5318 return castState<WidthSet>();
5319 }
5320
5321 Builder<STATE | HeightSet>& setHeight(int value)
5322 {
5323 COMPILE_ASSERT(!(STATE & HeightSet), property_height_already_set);
5324 m_result->setInteger("height"_s, value);
5325 return castState<HeightSet>();
5326 }
5327
5328 Ref<IntRect> release()
5329 {
5330 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
5331 COMPILE_ASSERT(sizeof(IntRect) == sizeof(JSON::Object), cannot_cast);
5332
5333 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
5334 auto result = WTFMove(*reinterpret_cast<Ref<IntRect>*>(&jsonResult));
5335 return result;
5336 }
5337 };
5338
5339 /*
5340 * Synthetic constructor:
5341 * Ref<IntRect> result = IntRect::create()
5342 * .setX(...)
5343 * .setY(...)
5344 * .setWidth(...)
5345 * .setHeight(...)
5346 * .release();
5347 */
5348 static Builder<NoFieldsSet> create()
5349 {
5350 return Builder<NoFieldsSet>(JSON::Object::create());
5351 }
5352};
5353
5354/* Information about a compositing layer. */
5355class Layer : public JSON::ObjectBase {
5356public:
5357 enum {
5358 NoFieldsSet = 0,
5359 LayerIdSet = 1 << 0,
5360 NodeIdSet = 1 << 1,
5361 BoundsSet = 1 << 2,
5362 PaintCountSet = 1 << 3,
5363 MemorySet = 1 << 4,
5364 CompositedBoundsSet = 1 << 5,
5365 AllFieldsSet = (LayerIdSet | NodeIdSet | BoundsSet | PaintCountSet | MemorySet | CompositedBoundsSet)
5366 };
5367
5368 template<int STATE>
5369 class Builder {
5370 private:
5371 RefPtr<JSON::Object> m_result;
5372
5373 template<int STEP> Builder<STATE | STEP>& castState()
5374 {
5375 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
5376 }
5377
5378 Builder(Ref</*Layer*/JSON::Object>&& object)
5379 : m_result(WTFMove(object))
5380 {
5381 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
5382 }
5383 friend class Layer;
5384 public:
5385
5386 Builder<STATE | LayerIdSet>& setLayerId(const String& value)
5387 {
5388 COMPILE_ASSERT(!(STATE & LayerIdSet), property_layerId_already_set);
5389 m_result->setString("layerId"_s, value);
5390 return castState<LayerIdSet>();
5391 }
5392
5393 Builder<STATE | NodeIdSet>& setNodeId(int value)
5394 {
5395 COMPILE_ASSERT(!(STATE & NodeIdSet), property_nodeId_already_set);
5396 m_result->setInteger("nodeId"_s, value);
5397 return castState<NodeIdSet>();
5398 }
5399
5400 Builder<STATE | BoundsSet>& setBounds(RefPtr<Inspector::Protocol::LayerTree::IntRect> value)
5401 {
5402 COMPILE_ASSERT(!(STATE & BoundsSet), property_bounds_already_set);
5403 m_result->setObject("bounds"_s, value);
5404 return castState<BoundsSet>();
5405 }
5406
5407 Builder<STATE | PaintCountSet>& setPaintCount(int value)
5408 {
5409 COMPILE_ASSERT(!(STATE & PaintCountSet), property_paintCount_already_set);
5410 m_result->setInteger("paintCount"_s, value);
5411 return castState<PaintCountSet>();
5412 }
5413
5414 Builder<STATE | MemorySet>& setMemory(int value)
5415 {
5416 COMPILE_ASSERT(!(STATE & MemorySet), property_memory_already_set);
5417 m_result->setInteger("memory"_s, value);
5418 return castState<MemorySet>();
5419 }
5420
5421 Builder<STATE | CompositedBoundsSet>& setCompositedBounds(RefPtr<Inspector::Protocol::LayerTree::IntRect> value)
5422 {
5423 COMPILE_ASSERT(!(STATE & CompositedBoundsSet), property_compositedBounds_already_set);
5424 m_result->setObject("compositedBounds"_s, value);
5425 return castState<CompositedBoundsSet>();
5426 }
5427
5428 Ref<Layer> release()
5429 {
5430 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
5431 COMPILE_ASSERT(sizeof(Layer) == sizeof(JSON::Object), cannot_cast);
5432
5433 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
5434 auto result = WTFMove(*reinterpret_cast<Ref<Layer>*>(&jsonResult));
5435 return result;
5436 }
5437 };
5438
5439 /*
5440 * Synthetic constructor:
5441 * Ref<Layer> result = Layer::create()
5442 * .setLayerId(...)
5443 * .setNodeId(...)
5444 * .setBounds(...)
5445 * .setPaintCount(...)
5446 * .setMemory(...)
5447 * .setCompositedBounds(...)
5448 * .release();
5449 */
5450 static Builder<NoFieldsSet> create()
5451 {
5452 return Builder<NoFieldsSet>(JSON::Object::create());
5453 }
5454
5455 void setIsInShadowTree(bool value)
5456 {
5457 JSON::ObjectBase::setBoolean("isInShadowTree"_s, value);
5458 }
5459
5460 void setIsReflection(bool value)
5461 {
5462 JSON::ObjectBase::setBoolean("isReflection"_s, value);
5463 }
5464
5465 void setIsGeneratedContent(bool value)
5466 {
5467 JSON::ObjectBase::setBoolean("isGeneratedContent"_s, value);
5468 }
5469
5470 void setIsAnonymous(bool value)
5471 {
5472 JSON::ObjectBase::setBoolean("isAnonymous"_s, value);
5473 }
5474
5475 void setPseudoElementId(const String& value)
5476 {
5477 JSON::ObjectBase::setString("pseudoElementId"_s, value);
5478 }
5479
5480 void setPseudoElement(const String& value)
5481 {
5482 JSON::ObjectBase::setString("pseudoElement"_s, value);
5483 }
5484};
5485
5486/* An object containing the reasons why the layer was composited as properties. */
5487class CompositingReasons : public JSON::ObjectBase {
5488public:
5489 enum {
5490 NoFieldsSet = 0,
5491 AllFieldsSet = 0
5492 };
5493
5494 template<int STATE>
5495 class Builder {
5496 private:
5497 RefPtr<JSON::Object> m_result;
5498
5499 template<int STEP> Builder<STATE | STEP>& castState()
5500 {
5501 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
5502 }
5503
5504 Builder(Ref</*CompositingReasons*/JSON::Object>&& object)
5505 : m_result(WTFMove(object))
5506 {
5507 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
5508 }
5509 friend class CompositingReasons;
5510 public:
5511
5512 Ref<CompositingReasons> release()
5513 {
5514 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
5515 COMPILE_ASSERT(sizeof(CompositingReasons) == sizeof(JSON::Object), cannot_cast);
5516
5517 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
5518 auto result = WTFMove(*reinterpret_cast<Ref<CompositingReasons>*>(&jsonResult));
5519 return result;
5520 }
5521 };
5522
5523 /*
5524 * Synthetic constructor:
5525 * Ref<CompositingReasons> result = CompositingReasons::create()
5526 * .release();
5527 */
5528 static Builder<NoFieldsSet> create()
5529 {
5530 return Builder<NoFieldsSet>(JSON::Object::create());
5531 }
5532
5533 void setTransform3D(bool value)
5534 {
5535 JSON::ObjectBase::setBoolean("transform3D"_s, value);
5536 }
5537
5538 void setVideo(bool value)
5539 {
5540 JSON::ObjectBase::setBoolean("video"_s, value);
5541 }
5542
5543 void setCanvas(bool value)
5544 {
5545 JSON::ObjectBase::setBoolean("canvas"_s, value);
5546 }
5547
5548 void setPlugin(bool value)
5549 {
5550 JSON::ObjectBase::setBoolean("plugin"_s, value);
5551 }
5552
5553 void setIFrame(bool value)
5554 {
5555 JSON::ObjectBase::setBoolean("iFrame"_s, value);
5556 }
5557
5558 void setBackfaceVisibilityHidden(bool value)
5559 {
5560 JSON::ObjectBase::setBoolean("backfaceVisibilityHidden"_s, value);
5561 }
5562
5563 void setClipsCompositingDescendants(bool value)
5564 {
5565 JSON::ObjectBase::setBoolean("clipsCompositingDescendants"_s, value);
5566 }
5567
5568 void setAnimation(bool value)
5569 {
5570 JSON::ObjectBase::setBoolean("animation"_s, value);
5571 }
5572
5573 void setFilters(bool value)
5574 {
5575 JSON::ObjectBase::setBoolean("filters"_s, value);
5576 }
5577
5578 void setPositionFixed(bool value)
5579 {
5580 JSON::ObjectBase::setBoolean("positionFixed"_s, value);
5581 }
5582
5583 void setPositionSticky(bool value)
5584 {
5585 JSON::ObjectBase::setBoolean("positionSticky"_s, value);
5586 }
5587
5588 void setOverflowScrollingTouch(bool value)
5589 {
5590 JSON::ObjectBase::setBoolean("overflowScrollingTouch"_s, value);
5591 }
5592
5593 void setStacking(bool value)
5594 {
5595 JSON::ObjectBase::setBoolean("stacking"_s, value);
5596 }
5597
5598 void setOverlap(bool value)
5599 {
5600 JSON::ObjectBase::setBoolean("overlap"_s, value);
5601 }
5602
5603 void setNegativeZIndexChildren(bool value)
5604 {
5605 JSON::ObjectBase::setBoolean("negativeZIndexChildren"_s, value);
5606 }
5607
5608 void setTransformWithCompositedDescendants(bool value)
5609 {
5610 JSON::ObjectBase::setBoolean("transformWithCompositedDescendants"_s, value);
5611 }
5612
5613 void setOpacityWithCompositedDescendants(bool value)
5614 {
5615 JSON::ObjectBase::setBoolean("opacityWithCompositedDescendants"_s, value);
5616 }
5617
5618 void setMaskWithCompositedDescendants(bool value)
5619 {
5620 JSON::ObjectBase::setBoolean("maskWithCompositedDescendants"_s, value);
5621 }
5622
5623 void setReflectionWithCompositedDescendants(bool value)
5624 {
5625 JSON::ObjectBase::setBoolean("reflectionWithCompositedDescendants"_s, value);
5626 }
5627
5628 void setFilterWithCompositedDescendants(bool value)
5629 {
5630 JSON::ObjectBase::setBoolean("filterWithCompositedDescendants"_s, value);
5631 }
5632
5633 void setBlendingWithCompositedDescendants(bool value)
5634 {
5635 JSON::ObjectBase::setBoolean("blendingWithCompositedDescendants"_s, value);
5636 }
5637
5638 void setIsolatesCompositedBlendingDescendants(bool value)
5639 {
5640 JSON::ObjectBase::setBoolean("isolatesCompositedBlendingDescendants"_s, value);
5641 }
5642
5643 void setPerspective(bool value)
5644 {
5645 JSON::ObjectBase::setBoolean("perspective"_s, value);
5646 }
5647
5648 void setPreserve3D(bool value)
5649 {
5650 JSON::ObjectBase::setBoolean("preserve3D"_s, value);
5651 }
5652
5653 void setWillChange(bool value)
5654 {
5655 JSON::ObjectBase::setBoolean("willChange"_s, value);
5656 }
5657
5658 void setRoot(bool value)
5659 {
5660 JSON::ObjectBase::setBoolean("root"_s, value);
5661 }
5662
5663 void setBlending(bool value)
5664 {
5665 JSON::ObjectBase::setBoolean("blending"_s, value);
5666 }
5667};
5668
5669} // LayerTree
5670
5671#if ENABLE(RESOURCE_USAGE)
5672namespace Memory {
5673class Event : public JSON::ObjectBase {
5674public:
5675 enum {
5676 NoFieldsSet = 0,
5677 TimestampSet = 1 << 0,
5678 CategoriesSet = 1 << 1,
5679 AllFieldsSet = (TimestampSet | CategoriesSet)
5680 };
5681
5682 template<int STATE>
5683 class Builder {
5684 private:
5685 RefPtr<JSON::Object> m_result;
5686
5687 template<int STEP> Builder<STATE | STEP>& castState()
5688 {
5689 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
5690 }
5691
5692 Builder(Ref</*Event*/JSON::Object>&& object)
5693 : m_result(WTFMove(object))
5694 {
5695 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
5696 }
5697 friend class Event;
5698 public:
5699
5700 Builder<STATE | TimestampSet>& setTimestamp(double value)
5701 {
5702 COMPILE_ASSERT(!(STATE & TimestampSet), property_timestamp_already_set);
5703 m_result->setDouble("timestamp"_s, value);
5704 return castState<TimestampSet>();
5705 }
5706
5707 Builder<STATE | CategoriesSet>& setCategories(RefPtr<JSON::ArrayOf<Inspector::Protocol::Memory::CategoryData>> value)
5708 {
5709 COMPILE_ASSERT(!(STATE & CategoriesSet), property_categories_already_set);
5710 m_result->setArray("categories"_s, value);
5711 return castState<CategoriesSet>();
5712 }
5713
5714 Ref<Event> release()
5715 {
5716 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
5717 COMPILE_ASSERT(sizeof(Event) == sizeof(JSON::Object), cannot_cast);
5718
5719 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
5720 auto result = WTFMove(*reinterpret_cast<Ref<Event>*>(&jsonResult));
5721 return result;
5722 }
5723 };
5724
5725 /*
5726 * Synthetic constructor:
5727 * Ref<Event> result = Event::create()
5728 * .setTimestamp(...)
5729 * .setCategories(...)
5730 * .release();
5731 */
5732 static Builder<NoFieldsSet> create()
5733 {
5734 return Builder<NoFieldsSet>(JSON::Object::create());
5735 }
5736};
5737
5738class CategoryData : public JSON::ObjectBase {
5739public:
5740 // Named after property name 'type' while generating CategoryData.
5741 enum class Type {
5742 JavaScript = 35,
5743 JIT = 112,
5744 Images = 113,
5745 Layers = 114,
5746 Page = 81,
5747 Other = 47,
5748 }; // enum class Type
5749 enum {
5750 NoFieldsSet = 0,
5751 TypeSet = 1 << 0,
5752 SizeSet = 1 << 1,
5753 AllFieldsSet = (TypeSet | SizeSet)
5754 };
5755
5756 template<int STATE>
5757 class Builder {
5758 private:
5759 RefPtr<JSON::Object> m_result;
5760
5761 template<int STEP> Builder<STATE | STEP>& castState()
5762 {
5763 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
5764 }
5765
5766 Builder(Ref</*CategoryData*/JSON::Object>&& object)
5767 : m_result(WTFMove(object))
5768 {
5769 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
5770 }
5771 friend class CategoryData;
5772 public:
5773
5774 Builder<STATE | TypeSet>& setType(Type value)
5775 {
5776 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
5777 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
5778 return castState<TypeSet>();
5779 }
5780
5781 Builder<STATE | SizeSet>& setSize(double value)
5782 {
5783 COMPILE_ASSERT(!(STATE & SizeSet), property_size_already_set);
5784 m_result->setDouble("size"_s, value);
5785 return castState<SizeSet>();
5786 }
5787
5788 Ref<CategoryData> release()
5789 {
5790 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
5791 COMPILE_ASSERT(sizeof(CategoryData) == sizeof(JSON::Object), cannot_cast);
5792
5793 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
5794 auto result = WTFMove(*reinterpret_cast<Ref<CategoryData>*>(&jsonResult));
5795 return result;
5796 }
5797 };
5798
5799 /*
5800 * Synthetic constructor:
5801 * Ref<CategoryData> result = CategoryData::create()
5802 * .setType(...)
5803 * .setSize(...)
5804 * .release();
5805 */
5806 static Builder<NoFieldsSet> create()
5807 {
5808 return Builder<NoFieldsSet>(JSON::Object::create());
5809 }
5810};
5811
5812} // Memory
5813#endif // ENABLE(RESOURCE_USAGE)
5814
5815namespace Network {
5816/* Timing information for the request. */
5817class ResourceTiming : public JSON::ObjectBase {
5818public:
5819 enum {
5820 NoFieldsSet = 0,
5821 StartTimeSet = 1 << 0,
5822 RedirectStartSet = 1 << 1,
5823 RedirectEndSet = 1 << 2,
5824 FetchStartSet = 1 << 3,
5825 DomainLookupStartSet = 1 << 4,
5826 DomainLookupEndSet = 1 << 5,
5827 ConnectStartSet = 1 << 6,
5828 ConnectEndSet = 1 << 7,
5829 SecureConnectionStartSet = 1 << 8,
5830 RequestStartSet = 1 << 9,
5831 ResponseStartSet = 1 << 10,
5832 ResponseEndSet = 1 << 11,
5833 AllFieldsSet = (StartTimeSet | RedirectStartSet | RedirectEndSet | FetchStartSet | DomainLookupStartSet | DomainLookupEndSet | ConnectStartSet | ConnectEndSet | SecureConnectionStartSet | RequestStartSet | ResponseStartSet | ResponseEndSet)
5834 };
5835
5836 template<int STATE>
5837 class Builder {
5838 private:
5839 RefPtr<JSON::Object> m_result;
5840
5841 template<int STEP> Builder<STATE | STEP>& castState()
5842 {
5843 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
5844 }
5845
5846 Builder(Ref</*ResourceTiming*/JSON::Object>&& object)
5847 : m_result(WTFMove(object))
5848 {
5849 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
5850 }
5851 friend class ResourceTiming;
5852 public:
5853
5854 Builder<STATE | StartTimeSet>& setStartTime(double value)
5855 {
5856 COMPILE_ASSERT(!(STATE & StartTimeSet), property_startTime_already_set);
5857 m_result->setDouble("startTime"_s, value);
5858 return castState<StartTimeSet>();
5859 }
5860
5861 Builder<STATE | RedirectStartSet>& setRedirectStart(double value)
5862 {
5863 COMPILE_ASSERT(!(STATE & RedirectStartSet), property_redirectStart_already_set);
5864 m_result->setDouble("redirectStart"_s, value);
5865 return castState<RedirectStartSet>();
5866 }
5867
5868 Builder<STATE | RedirectEndSet>& setRedirectEnd(double value)
5869 {
5870 COMPILE_ASSERT(!(STATE & RedirectEndSet), property_redirectEnd_already_set);
5871 m_result->setDouble("redirectEnd"_s, value);
5872 return castState<RedirectEndSet>();
5873 }
5874
5875 Builder<STATE | FetchStartSet>& setFetchStart(double value)
5876 {
5877 COMPILE_ASSERT(!(STATE & FetchStartSet), property_fetchStart_already_set);
5878 m_result->setDouble("fetchStart"_s, value);
5879 return castState<FetchStartSet>();
5880 }
5881
5882 Builder<STATE | DomainLookupStartSet>& setDomainLookupStart(double value)
5883 {
5884 COMPILE_ASSERT(!(STATE & DomainLookupStartSet), property_domainLookupStart_already_set);
5885 m_result->setDouble("domainLookupStart"_s, value);
5886 return castState<DomainLookupStartSet>();
5887 }
5888
5889 Builder<STATE | DomainLookupEndSet>& setDomainLookupEnd(double value)
5890 {
5891 COMPILE_ASSERT(!(STATE & DomainLookupEndSet), property_domainLookupEnd_already_set);
5892 m_result->setDouble("domainLookupEnd"_s, value);
5893 return castState<DomainLookupEndSet>();
5894 }
5895
5896 Builder<STATE | ConnectStartSet>& setConnectStart(double value)
5897 {
5898 COMPILE_ASSERT(!(STATE & ConnectStartSet), property_connectStart_already_set);
5899 m_result->setDouble("connectStart"_s, value);
5900 return castState<ConnectStartSet>();
5901 }
5902
5903 Builder<STATE | ConnectEndSet>& setConnectEnd(double value)
5904 {
5905 COMPILE_ASSERT(!(STATE & ConnectEndSet), property_connectEnd_already_set);
5906 m_result->setDouble("connectEnd"_s, value);
5907 return castState<ConnectEndSet>();
5908 }
5909
5910 Builder<STATE | SecureConnectionStartSet>& setSecureConnectionStart(double value)
5911 {
5912 COMPILE_ASSERT(!(STATE & SecureConnectionStartSet), property_secureConnectionStart_already_set);
5913 m_result->setDouble("secureConnectionStart"_s, value);
5914 return castState<SecureConnectionStartSet>();
5915 }
5916
5917 Builder<STATE | RequestStartSet>& setRequestStart(double value)
5918 {
5919 COMPILE_ASSERT(!(STATE & RequestStartSet), property_requestStart_already_set);
5920 m_result->setDouble("requestStart"_s, value);
5921 return castState<RequestStartSet>();
5922 }
5923
5924 Builder<STATE | ResponseStartSet>& setResponseStart(double value)
5925 {
5926 COMPILE_ASSERT(!(STATE & ResponseStartSet), property_responseStart_already_set);
5927 m_result->setDouble("responseStart"_s, value);
5928 return castState<ResponseStartSet>();
5929 }
5930
5931 Builder<STATE | ResponseEndSet>& setResponseEnd(double value)
5932 {
5933 COMPILE_ASSERT(!(STATE & ResponseEndSet), property_responseEnd_already_set);
5934 m_result->setDouble("responseEnd"_s, value);
5935 return castState<ResponseEndSet>();
5936 }
5937
5938 Ref<ResourceTiming> release()
5939 {
5940 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
5941 COMPILE_ASSERT(sizeof(ResourceTiming) == sizeof(JSON::Object), cannot_cast);
5942
5943 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
5944 auto result = WTFMove(*reinterpret_cast<Ref<ResourceTiming>*>(&jsonResult));
5945 return result;
5946 }
5947 };
5948
5949 /*
5950 * Synthetic constructor:
5951 * Ref<ResourceTiming> result = ResourceTiming::create()
5952 * .setStartTime(...)
5953 * .setRedirectStart(...)
5954 * .setRedirectEnd(...)
5955 * .setFetchStart(...)
5956 * .setDomainLookupStart(...)
5957 * .setDomainLookupEnd(...)
5958 * .setConnectStart(...)
5959 * .setConnectEnd(...)
5960 * .setSecureConnectionStart(...)
5961 * .setRequestStart(...)
5962 * .setResponseStart(...)
5963 * .setResponseEnd(...)
5964 * .release();
5965 */
5966 static Builder<NoFieldsSet> create()
5967 {
5968 return Builder<NoFieldsSet>(JSON::Object::create());
5969 }
5970};
5971
5972/* HTTP request data. */
5973class Request : public JSON::ObjectBase {
5974public:
5975 enum {
5976 NoFieldsSet = 0,
5977 UrlSet = 1 << 0,
5978 MethodSet = 1 << 1,
5979 HeadersSet = 1 << 2,
5980 AllFieldsSet = (UrlSet | MethodSet | HeadersSet)
5981 };
5982
5983 template<int STATE>
5984 class Builder {
5985 private:
5986 RefPtr<JSON::Object> m_result;
5987
5988 template<int STEP> Builder<STATE | STEP>& castState()
5989 {
5990 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
5991 }
5992
5993 Builder(Ref</*Request*/JSON::Object>&& object)
5994 : m_result(WTFMove(object))
5995 {
5996 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
5997 }
5998 friend class Request;
5999 public:
6000
6001 Builder<STATE | UrlSet>& setUrl(const String& value)
6002 {
6003 COMPILE_ASSERT(!(STATE & UrlSet), property_url_already_set);
6004 m_result->setString("url"_s, value);
6005 return castState<UrlSet>();
6006 }
6007
6008 Builder<STATE | MethodSet>& setMethod(const String& value)
6009 {
6010 COMPILE_ASSERT(!(STATE & MethodSet), property_method_already_set);
6011 m_result->setString("method"_s, value);
6012 return castState<MethodSet>();
6013 }
6014
6015 Builder<STATE | HeadersSet>& setHeaders(RefPtr<JSON::Object> value)
6016 {
6017 COMPILE_ASSERT(!(STATE & HeadersSet), property_headers_already_set);
6018 m_result->setObject("headers"_s, value);
6019 return castState<HeadersSet>();
6020 }
6021
6022 Ref<Request> release()
6023 {
6024 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
6025 COMPILE_ASSERT(sizeof(Request) == sizeof(JSON::Object), cannot_cast);
6026
6027 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
6028 auto result = WTFMove(*reinterpret_cast<Ref<Request>*>(&jsonResult));
6029 return result;
6030 }
6031 };
6032
6033 /*
6034 * Synthetic constructor:
6035 * Ref<Request> result = Request::create()
6036 * .setUrl(...)
6037 * .setMethod(...)
6038 * .setHeaders(...)
6039 * .release();
6040 */
6041 static Builder<NoFieldsSet> create()
6042 {
6043 return Builder<NoFieldsSet>(JSON::Object::create());
6044 }
6045
6046 void setPostData(const String& value)
6047 {
6048 JSON::ObjectBase::setString("postData"_s, value);
6049 }
6050};
6051
6052/* HTTP response data. */
6053class Response : public JSON::Object {
6054public:
6055 // Named after property name 'source' while generating Response.
6056 enum class Source {
6057 Unknown = 115,
6058 Network = 36,
6059 MemoryCache = 116,
6060 DiskCache = 117,
6061 ServiceWorker = 118,
6062 }; // enum class Source
6063 enum {
6064 NoFieldsSet = 0,
6065 UrlSet = 1 << 0,
6066 StatusSet = 1 << 1,
6067 StatusTextSet = 1 << 2,
6068 HeadersSet = 1 << 3,
6069 MimeTypeSet = 1 << 4,
6070 SourceSet = 1 << 5,
6071 AllFieldsSet = (UrlSet | StatusSet | StatusTextSet | HeadersSet | MimeTypeSet | SourceSet)
6072 };
6073
6074 template<int STATE>
6075 class Builder {
6076 private:
6077 RefPtr<JSON::Object> m_result;
6078
6079 template<int STEP> Builder<STATE | STEP>& castState()
6080 {
6081 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
6082 }
6083
6084 Builder(Ref</*Response*/JSON::Object>&& object)
6085 : m_result(WTFMove(object))
6086 {
6087 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
6088 }
6089 friend class Response;
6090 public:
6091
6092 Builder<STATE | UrlSet>& setUrl(const String& value)
6093 {
6094 COMPILE_ASSERT(!(STATE & UrlSet), property_url_already_set);
6095 m_result->setString("url"_s, value);
6096 return castState<UrlSet>();
6097 }
6098
6099 Builder<STATE | StatusSet>& setStatus(int value)
6100 {
6101 COMPILE_ASSERT(!(STATE & StatusSet), property_status_already_set);
6102 m_result->setInteger("status"_s, value);
6103 return castState<StatusSet>();
6104 }
6105
6106 Builder<STATE | StatusTextSet>& setStatusText(const String& value)
6107 {
6108 COMPILE_ASSERT(!(STATE & StatusTextSet), property_statusText_already_set);
6109 m_result->setString("statusText"_s, value);
6110 return castState<StatusTextSet>();
6111 }
6112
6113 Builder<STATE | HeadersSet>& setHeaders(RefPtr<JSON::Object> value)
6114 {
6115 COMPILE_ASSERT(!(STATE & HeadersSet), property_headers_already_set);
6116 m_result->setObject("headers"_s, value);
6117 return castState<HeadersSet>();
6118 }
6119
6120 Builder<STATE | MimeTypeSet>& setMimeType(const String& value)
6121 {
6122 COMPILE_ASSERT(!(STATE & MimeTypeSet), property_mimeType_already_set);
6123 m_result->setString("mimeType"_s, value);
6124 return castState<MimeTypeSet>();
6125 }
6126
6127 Builder<STATE | SourceSet>& setSource(Source value)
6128 {
6129 COMPILE_ASSERT(!(STATE & SourceSet), property_source_already_set);
6130 m_result->setString("source"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
6131 return castState<SourceSet>();
6132 }
6133
6134 Ref<Response> release()
6135 {
6136 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
6137 COMPILE_ASSERT(sizeof(Response) == sizeof(JSON::Object), cannot_cast);
6138
6139 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
6140 auto result = WTFMove(*reinterpret_cast<Ref<Response>*>(&jsonResult));
6141 return result;
6142 }
6143 };
6144
6145 /*
6146 * Synthetic constructor:
6147 * Ref<Response> result = Response::create()
6148 * .setUrl(...)
6149 * .setStatus(...)
6150 * .setStatusText(...)
6151 * .setHeaders(...)
6152 * .setMimeType(...)
6153 * .setSource(...)
6154 * .release();
6155 */
6156 static Builder<NoFieldsSet> create()
6157 {
6158 return Builder<NoFieldsSet>(JSON::Object::create());
6159 }
6160
6161 void setRequestHeaders(RefPtr<JSON::Object> value)
6162 {
6163 JSON::ObjectBase::setObject("requestHeaders"_s, WTFMove(value));
6164 }
6165
6166 void setTiming(RefPtr<Inspector::Protocol::Network::ResourceTiming> value)
6167 {
6168 JSON::ObjectBase::setObject("timing"_s, WTFMove(value));
6169 }
6170
6171 void setSecurity(RefPtr<Inspector::Protocol::Security::Security> value)
6172 {
6173 JSON::ObjectBase::setObject("security"_s, WTFMove(value));
6174 }
6175
6176 // Property names for type generated as open.
6177 JS_EXPORT_PRIVATE static const char* MimeType;
6178};
6179
6180/* Network load metrics. */
6181class Metrics : public JSON::ObjectBase {
6182public:
6183 // Named after property name 'priority' while generating Metrics.
6184 enum class Priority {
6185 Low = 119,
6186 Medium = 120,
6187 High = 121,
6188 }; // enum class Priority
6189 enum {
6190 NoFieldsSet = 0,
6191 AllFieldsSet = 0
6192 };
6193
6194 template<int STATE>
6195 class Builder {
6196 private:
6197 RefPtr<JSON::Object> m_result;
6198
6199 template<int STEP> Builder<STATE | STEP>& castState()
6200 {
6201 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
6202 }
6203
6204 Builder(Ref</*Metrics*/JSON::Object>&& object)
6205 : m_result(WTFMove(object))
6206 {
6207 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
6208 }
6209 friend class Metrics;
6210 public:
6211
6212 Ref<Metrics> release()
6213 {
6214 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
6215 COMPILE_ASSERT(sizeof(Metrics) == sizeof(JSON::Object), cannot_cast);
6216
6217 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
6218 auto result = WTFMove(*reinterpret_cast<Ref<Metrics>*>(&jsonResult));
6219 return result;
6220 }
6221 };
6222
6223 /*
6224 * Synthetic constructor:
6225 * Ref<Metrics> result = Metrics::create()
6226 * .release();
6227 */
6228 static Builder<NoFieldsSet> create()
6229 {
6230 return Builder<NoFieldsSet>(JSON::Object::create());
6231 }
6232
6233 void setProtocol(const String& value)
6234 {
6235 JSON::ObjectBase::setString("protocol"_s, value);
6236 }
6237
6238 void setPriority(Priority value)
6239 {
6240 JSON::ObjectBase::setString("priority"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
6241 }
6242
6243 void setConnectionIdentifier(const String& value)
6244 {
6245 JSON::ObjectBase::setString("connectionIdentifier"_s, value);
6246 }
6247
6248 void setRemoteAddress(const String& value)
6249 {
6250 JSON::ObjectBase::setString("remoteAddress"_s, value);
6251 }
6252
6253 void setRequestHeaders(RefPtr<JSON::Object> value)
6254 {
6255 JSON::ObjectBase::setObject("requestHeaders"_s, WTFMove(value));
6256 }
6257
6258 void setRequestHeaderBytesSent(double value)
6259 {
6260 JSON::ObjectBase::setDouble("requestHeaderBytesSent"_s, value);
6261 }
6262
6263 void setRequestBodyBytesSent(double value)
6264 {
6265 JSON::ObjectBase::setDouble("requestBodyBytesSent"_s, value);
6266 }
6267
6268 void setResponseHeaderBytesReceived(double value)
6269 {
6270 JSON::ObjectBase::setDouble("responseHeaderBytesReceived"_s, value);
6271 }
6272
6273 void setResponseBodyBytesReceived(double value)
6274 {
6275 JSON::ObjectBase::setDouble("responseBodyBytesReceived"_s, value);
6276 }
6277
6278 void setResponseBodyDecodedSize(double value)
6279 {
6280 JSON::ObjectBase::setDouble("responseBodyDecodedSize"_s, value);
6281 }
6282
6283 void setSecurityConnection(RefPtr<Inspector::Protocol::Security::Connection> value)
6284 {
6285 JSON::ObjectBase::setObject("securityConnection"_s, WTFMove(value));
6286 }
6287};
6288
6289/* WebSocket request data. */
6290class WebSocketRequest : public JSON::ObjectBase {
6291public:
6292 enum {
6293 NoFieldsSet = 0,
6294 HeadersSet = 1 << 0,
6295 AllFieldsSet = (HeadersSet)
6296 };
6297
6298 template<int STATE>
6299 class Builder {
6300 private:
6301 RefPtr<JSON::Object> m_result;
6302
6303 template<int STEP> Builder<STATE | STEP>& castState()
6304 {
6305 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
6306 }
6307
6308 Builder(Ref</*WebSocketRequest*/JSON::Object>&& object)
6309 : m_result(WTFMove(object))
6310 {
6311 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
6312 }
6313 friend class WebSocketRequest;
6314 public:
6315
6316 Builder<STATE | HeadersSet>& setHeaders(RefPtr<JSON::Object> value)
6317 {
6318 COMPILE_ASSERT(!(STATE & HeadersSet), property_headers_already_set);
6319 m_result->setObject("headers"_s, value);
6320 return castState<HeadersSet>();
6321 }
6322
6323 Ref<WebSocketRequest> release()
6324 {
6325 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
6326 COMPILE_ASSERT(sizeof(WebSocketRequest) == sizeof(JSON::Object), cannot_cast);
6327
6328 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
6329 auto result = WTFMove(*reinterpret_cast<Ref<WebSocketRequest>*>(&jsonResult));
6330 return result;
6331 }
6332 };
6333
6334 /*
6335 * Synthetic constructor:
6336 * Ref<WebSocketRequest> result = WebSocketRequest::create()
6337 * .setHeaders(...)
6338 * .release();
6339 */
6340 static Builder<NoFieldsSet> create()
6341 {
6342 return Builder<NoFieldsSet>(JSON::Object::create());
6343 }
6344};
6345
6346/* WebSocket response data. */
6347class WebSocketResponse : public JSON::ObjectBase {
6348public:
6349 enum {
6350 NoFieldsSet = 0,
6351 StatusSet = 1 << 0,
6352 StatusTextSet = 1 << 1,
6353 HeadersSet = 1 << 2,
6354 AllFieldsSet = (StatusSet | StatusTextSet | HeadersSet)
6355 };
6356
6357 template<int STATE>
6358 class Builder {
6359 private:
6360 RefPtr<JSON::Object> m_result;
6361
6362 template<int STEP> Builder<STATE | STEP>& castState()
6363 {
6364 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
6365 }
6366
6367 Builder(Ref</*WebSocketResponse*/JSON::Object>&& object)
6368 : m_result(WTFMove(object))
6369 {
6370 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
6371 }
6372 friend class WebSocketResponse;
6373 public:
6374
6375 Builder<STATE | StatusSet>& setStatus(int value)
6376 {
6377 COMPILE_ASSERT(!(STATE & StatusSet), property_status_already_set);
6378 m_result->setInteger("status"_s, value);
6379 return castState<StatusSet>();
6380 }
6381
6382 Builder<STATE | StatusTextSet>& setStatusText(const String& value)
6383 {
6384 COMPILE_ASSERT(!(STATE & StatusTextSet), property_statusText_already_set);
6385 m_result->setString("statusText"_s, value);
6386 return castState<StatusTextSet>();
6387 }
6388
6389 Builder<STATE | HeadersSet>& setHeaders(RefPtr<JSON::Object> value)
6390 {
6391 COMPILE_ASSERT(!(STATE & HeadersSet), property_headers_already_set);
6392 m_result->setObject("headers"_s, value);
6393 return castState<HeadersSet>();
6394 }
6395
6396 Ref<WebSocketResponse> release()
6397 {
6398 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
6399 COMPILE_ASSERT(sizeof(WebSocketResponse) == sizeof(JSON::Object), cannot_cast);
6400
6401 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
6402 auto result = WTFMove(*reinterpret_cast<Ref<WebSocketResponse>*>(&jsonResult));
6403 return result;
6404 }
6405 };
6406
6407 /*
6408 * Synthetic constructor:
6409 * Ref<WebSocketResponse> result = WebSocketResponse::create()
6410 * .setStatus(...)
6411 * .setStatusText(...)
6412 * .setHeaders(...)
6413 * .release();
6414 */
6415 static Builder<NoFieldsSet> create()
6416 {
6417 return Builder<NoFieldsSet>(JSON::Object::create());
6418 }
6419};
6420
6421/* WebSocket frame data. */
6422class WebSocketFrame : public JSON::ObjectBase {
6423public:
6424 enum {
6425 NoFieldsSet = 0,
6426 OpcodeSet = 1 << 0,
6427 MaskSet = 1 << 1,
6428 PayloadDataSet = 1 << 2,
6429 PayloadLengthSet = 1 << 3,
6430 AllFieldsSet = (OpcodeSet | MaskSet | PayloadDataSet | PayloadLengthSet)
6431 };
6432
6433 template<int STATE>
6434 class Builder {
6435 private:
6436 RefPtr<JSON::Object> m_result;
6437
6438 template<int STEP> Builder<STATE | STEP>& castState()
6439 {
6440 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
6441 }
6442
6443 Builder(Ref</*WebSocketFrame*/JSON::Object>&& object)
6444 : m_result(WTFMove(object))
6445 {
6446 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
6447 }
6448 friend class WebSocketFrame;
6449 public:
6450
6451 Builder<STATE | OpcodeSet>& setOpcode(double value)
6452 {
6453 COMPILE_ASSERT(!(STATE & OpcodeSet), property_opcode_already_set);
6454 m_result->setDouble("opcode"_s, value);
6455 return castState<OpcodeSet>();
6456 }
6457
6458 Builder<STATE | MaskSet>& setMask(bool value)
6459 {
6460 COMPILE_ASSERT(!(STATE & MaskSet), property_mask_already_set);
6461 m_result->setBoolean("mask"_s, value);
6462 return castState<MaskSet>();
6463 }
6464
6465 Builder<STATE | PayloadDataSet>& setPayloadData(const String& value)
6466 {
6467 COMPILE_ASSERT(!(STATE & PayloadDataSet), property_payloadData_already_set);
6468 m_result->setString("payloadData"_s, value);
6469 return castState<PayloadDataSet>();
6470 }
6471
6472 Builder<STATE | PayloadLengthSet>& setPayloadLength(double value)
6473 {
6474 COMPILE_ASSERT(!(STATE & PayloadLengthSet), property_payloadLength_already_set);
6475 m_result->setDouble("payloadLength"_s, value);
6476 return castState<PayloadLengthSet>();
6477 }
6478
6479 Ref<WebSocketFrame> release()
6480 {
6481 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
6482 COMPILE_ASSERT(sizeof(WebSocketFrame) == sizeof(JSON::Object), cannot_cast);
6483
6484 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
6485 auto result = WTFMove(*reinterpret_cast<Ref<WebSocketFrame>*>(&jsonResult));
6486 return result;
6487 }
6488 };
6489
6490 /*
6491 * Synthetic constructor:
6492 * Ref<WebSocketFrame> result = WebSocketFrame::create()
6493 * .setOpcode(...)
6494 * .setMask(...)
6495 * .setPayloadData(...)
6496 * .setPayloadLength(...)
6497 * .release();
6498 */
6499 static Builder<NoFieldsSet> create()
6500 {
6501 return Builder<NoFieldsSet>(JSON::Object::create());
6502 }
6503};
6504
6505/* Information about the cached resource. */
6506class CachedResource : public JSON::ObjectBase {
6507public:
6508 enum {
6509 NoFieldsSet = 0,
6510 UrlSet = 1 << 0,
6511 TypeSet = 1 << 1,
6512 BodySizeSet = 1 << 2,
6513 AllFieldsSet = (UrlSet | TypeSet | BodySizeSet)
6514 };
6515
6516 template<int STATE>
6517 class Builder {
6518 private:
6519 RefPtr<JSON::Object> m_result;
6520
6521 template<int STEP> Builder<STATE | STEP>& castState()
6522 {
6523 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
6524 }
6525
6526 Builder(Ref</*CachedResource*/JSON::Object>&& object)
6527 : m_result(WTFMove(object))
6528 {
6529 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
6530 }
6531 friend class CachedResource;
6532 public:
6533
6534 Builder<STATE | UrlSet>& setUrl(const String& value)
6535 {
6536 COMPILE_ASSERT(!(STATE & UrlSet), property_url_already_set);
6537 m_result->setString("url"_s, value);
6538 return castState<UrlSet>();
6539 }
6540
6541 Builder<STATE | TypeSet>& setType(Inspector::Protocol::Page::ResourceType value)
6542 {
6543 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
6544 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
6545 return castState<TypeSet>();
6546 }
6547
6548 Builder<STATE | BodySizeSet>& setBodySize(double value)
6549 {
6550 COMPILE_ASSERT(!(STATE & BodySizeSet), property_bodySize_already_set);
6551 m_result->setDouble("bodySize"_s, value);
6552 return castState<BodySizeSet>();
6553 }
6554
6555 Ref<CachedResource> release()
6556 {
6557 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
6558 COMPILE_ASSERT(sizeof(CachedResource) == sizeof(JSON::Object), cannot_cast);
6559
6560 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
6561 auto result = WTFMove(*reinterpret_cast<Ref<CachedResource>*>(&jsonResult));
6562 return result;
6563 }
6564 };
6565
6566 /*
6567 * Synthetic constructor:
6568 * Ref<CachedResource> result = CachedResource::create()
6569 * .setUrl(...)
6570 * .setType(...)
6571 * .setBodySize(...)
6572 * .release();
6573 */
6574 static Builder<NoFieldsSet> create()
6575 {
6576 return Builder<NoFieldsSet>(JSON::Object::create());
6577 }
6578
6579 void setResponse(RefPtr<Inspector::Protocol::Network::Response> value)
6580 {
6581 JSON::ObjectBase::setObject("response"_s, WTFMove(value));
6582 }
6583
6584 void setSourceMapURL(const String& value)
6585 {
6586 JSON::ObjectBase::setString("sourceMapURL"_s, value);
6587 }
6588};
6589
6590/* Information about the request initiator. */
6591class Initiator : public JSON::ObjectBase {
6592public:
6593 // Named after property name 'type' while generating Initiator.
6594 enum class Type {
6595 Parser = 133,
6596 Script = 134,
6597 Other = 47,
6598 }; // enum class Type
6599 enum {
6600 NoFieldsSet = 0,
6601 TypeSet = 1 << 0,
6602 AllFieldsSet = (TypeSet)
6603 };
6604
6605 template<int STATE>
6606 class Builder {
6607 private:
6608 RefPtr<JSON::Object> m_result;
6609
6610 template<int STEP> Builder<STATE | STEP>& castState()
6611 {
6612 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
6613 }
6614
6615 Builder(Ref</*Initiator*/JSON::Object>&& object)
6616 : m_result(WTFMove(object))
6617 {
6618 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
6619 }
6620 friend class Initiator;
6621 public:
6622
6623 Builder<STATE | TypeSet>& setType(Type value)
6624 {
6625 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
6626 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
6627 return castState<TypeSet>();
6628 }
6629
6630 Ref<Initiator> release()
6631 {
6632 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
6633 COMPILE_ASSERT(sizeof(Initiator) == sizeof(JSON::Object), cannot_cast);
6634
6635 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
6636 auto result = WTFMove(*reinterpret_cast<Ref<Initiator>*>(&jsonResult));
6637 return result;
6638 }
6639 };
6640
6641 /*
6642 * Synthetic constructor:
6643 * Ref<Initiator> result = Initiator::create()
6644 * .setType(...)
6645 * .release();
6646 */
6647 static Builder<NoFieldsSet> create()
6648 {
6649 return Builder<NoFieldsSet>(JSON::Object::create());
6650 }
6651
6652 void setStackTrace(RefPtr<JSON::ArrayOf<Inspector::Protocol::Console::CallFrame>> value)
6653 {
6654 JSON::ObjectBase::setArray("stackTrace"_s, WTFMove(value));
6655 }
6656
6657 void setUrl(const String& value)
6658 {
6659 JSON::ObjectBase::setString("url"_s, value);
6660 }
6661
6662 void setLineNumber(double value)
6663 {
6664 JSON::ObjectBase::setDouble("lineNumber"_s, value);
6665 }
6666
6667 void setNodeId(int value)
6668 {
6669 JSON::ObjectBase::setInteger("nodeId"_s, value);
6670 }
6671};
6672
6673} // Network
6674
6675namespace Page {
6676/* List of settings able to be overridden by WebInspector. Keep this in sync with FOR_EACH_INSPECTOR_OVERRIDE_SETTING. */
6677enum class Setting {
6678 AuthorAndUserStylesEnabled = 135,
6679 ICECandidateFilteringEnabled = 136,
6680 ImagesEnabled = 137,
6681 MediaCaptureRequiresSecureConnection = 138,
6682 MockCaptureDevicesEnabled = 139,
6683 NeedsSiteSpecificQuirks = 140,
6684 ScriptEnabled = 141,
6685 WebSecurityEnabled = 142,
6686}; // enum class Setting
6687/* Resource type as it was perceived by the rendering engine. */
6688enum class ResourceType {
6689 Document = 122,
6690 Stylesheet = 123,
6691 Image = 124,
6692 Font = 125,
6693 Script = 126,
6694 XHR = 127,
6695 Fetch = 128,
6696 Ping = 129,
6697 Beacon = 130,
6698 WebSocket = 131,
6699 Other = 132,
6700}; // enum class ResourceType
6701/* Coordinate system used by supplied coordinates. */
6702enum class CoordinateSystem {
6703 Viewport = 143,
6704 Page = 144,
6705}; // enum class CoordinateSystem
6706/* Same-Site policy of a cookie. */
6707enum class CookieSameSitePolicy {
6708 None = 145,
6709 Lax = 146,
6710 Strict = 147,
6711}; // enum class CookieSameSitePolicy
6712/* Page appearance name. */
6713enum class Appearance {
6714 Light = 148,
6715 Dark = 149,
6716}; // enum class Appearance
6717/* Information about the Frame on the page. */
6718class Frame : public JSON::ObjectBase {
6719public:
6720 enum {
6721 NoFieldsSet = 0,
6722 IdSet = 1 << 0,
6723 LoaderIdSet = 1 << 1,
6724 UrlSet = 1 << 2,
6725 SecurityOriginSet = 1 << 3,
6726 MimeTypeSet = 1 << 4,
6727 AllFieldsSet = (IdSet | LoaderIdSet | UrlSet | SecurityOriginSet | MimeTypeSet)
6728 };
6729
6730 template<int STATE>
6731 class Builder {
6732 private:
6733 RefPtr<JSON::Object> m_result;
6734
6735 template<int STEP> Builder<STATE | STEP>& castState()
6736 {
6737 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
6738 }
6739
6740 Builder(Ref</*Frame*/JSON::Object>&& object)
6741 : m_result(WTFMove(object))
6742 {
6743 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
6744 }
6745 friend class Frame;
6746 public:
6747
6748 Builder<STATE | IdSet>& setId(const String& value)
6749 {
6750 COMPILE_ASSERT(!(STATE & IdSet), property_id_already_set);
6751 m_result->setString("id"_s, value);
6752 return castState<IdSet>();
6753 }
6754
6755 Builder<STATE | LoaderIdSet>& setLoaderId(const String& value)
6756 {
6757 COMPILE_ASSERT(!(STATE & LoaderIdSet), property_loaderId_already_set);
6758 m_result->setString("loaderId"_s, value);
6759 return castState<LoaderIdSet>();
6760 }
6761
6762 Builder<STATE | UrlSet>& setUrl(const String& value)
6763 {
6764 COMPILE_ASSERT(!(STATE & UrlSet), property_url_already_set);
6765 m_result->setString("url"_s, value);
6766 return castState<UrlSet>();
6767 }
6768
6769 Builder<STATE | SecurityOriginSet>& setSecurityOrigin(const String& value)
6770 {
6771 COMPILE_ASSERT(!(STATE & SecurityOriginSet), property_securityOrigin_already_set);
6772 m_result->setString("securityOrigin"_s, value);
6773 return castState<SecurityOriginSet>();
6774 }
6775
6776 Builder<STATE | MimeTypeSet>& setMimeType(const String& value)
6777 {
6778 COMPILE_ASSERT(!(STATE & MimeTypeSet), property_mimeType_already_set);
6779 m_result->setString("mimeType"_s, value);
6780 return castState<MimeTypeSet>();
6781 }
6782
6783 Ref<Frame> release()
6784 {
6785 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
6786 COMPILE_ASSERT(sizeof(Frame) == sizeof(JSON::Object), cannot_cast);
6787
6788 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
6789 auto result = WTFMove(*reinterpret_cast<Ref<Frame>*>(&jsonResult));
6790 return result;
6791 }
6792 };
6793
6794 /*
6795 * Synthetic constructor:
6796 * Ref<Frame> result = Frame::create()
6797 * .setId(...)
6798 * .setLoaderId(...)
6799 * .setUrl(...)
6800 * .setSecurityOrigin(...)
6801 * .setMimeType(...)
6802 * .release();
6803 */
6804 static Builder<NoFieldsSet> create()
6805 {
6806 return Builder<NoFieldsSet>(JSON::Object::create());
6807 }
6808
6809 void setParentId(const String& value)
6810 {
6811 JSON::ObjectBase::setString("parentId"_s, value);
6812 }
6813
6814 void setName(const String& value)
6815 {
6816 JSON::ObjectBase::setString("name"_s, value);
6817 }
6818};
6819
6820class FrameResource : public JSON::ObjectBase {
6821public:
6822 enum {
6823 NoFieldsSet = 0,
6824 UrlSet = 1 << 0,
6825 TypeSet = 1 << 1,
6826 MimeTypeSet = 1 << 2,
6827 AllFieldsSet = (UrlSet | TypeSet | MimeTypeSet)
6828 };
6829
6830 template<int STATE>
6831 class Builder {
6832 private:
6833 RefPtr<JSON::Object> m_result;
6834
6835 template<int STEP> Builder<STATE | STEP>& castState()
6836 {
6837 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
6838 }
6839
6840 Builder(Ref</*FrameResource*/JSON::Object>&& object)
6841 : m_result(WTFMove(object))
6842 {
6843 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
6844 }
6845 friend class FrameResource;
6846 public:
6847
6848 Builder<STATE | UrlSet>& setUrl(const String& value)
6849 {
6850 COMPILE_ASSERT(!(STATE & UrlSet), property_url_already_set);
6851 m_result->setString("url"_s, value);
6852 return castState<UrlSet>();
6853 }
6854
6855 Builder<STATE | TypeSet>& setType(Inspector::Protocol::Page::ResourceType value)
6856 {
6857 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
6858 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
6859 return castState<TypeSet>();
6860 }
6861
6862 Builder<STATE | MimeTypeSet>& setMimeType(const String& value)
6863 {
6864 COMPILE_ASSERT(!(STATE & MimeTypeSet), property_mimeType_already_set);
6865 m_result->setString("mimeType"_s, value);
6866 return castState<MimeTypeSet>();
6867 }
6868
6869 Ref<FrameResource> release()
6870 {
6871 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
6872 COMPILE_ASSERT(sizeof(FrameResource) == sizeof(JSON::Object), cannot_cast);
6873
6874 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
6875 auto result = WTFMove(*reinterpret_cast<Ref<FrameResource>*>(&jsonResult));
6876 return result;
6877 }
6878 };
6879
6880 /*
6881 * Synthetic constructor:
6882 * Ref<FrameResource> result = FrameResource::create()
6883 * .setUrl(...)
6884 * .setType(...)
6885 * .setMimeType(...)
6886 * .release();
6887 */
6888 static Builder<NoFieldsSet> create()
6889 {
6890 return Builder<NoFieldsSet>(JSON::Object::create());
6891 }
6892
6893 void setFailed(bool value)
6894 {
6895 JSON::ObjectBase::setBoolean("failed"_s, value);
6896 }
6897
6898 void setCanceled(bool value)
6899 {
6900 JSON::ObjectBase::setBoolean("canceled"_s, value);
6901 }
6902
6903 void setSourceMapURL(const String& value)
6904 {
6905 JSON::ObjectBase::setString("sourceMapURL"_s, value);
6906 }
6907
6908 void setTargetId(const String& value)
6909 {
6910 JSON::ObjectBase::setString("targetId"_s, value);
6911 }
6912};
6913
6914/* Information about the Frame hierarchy along with their cached resources. */
6915class FrameResourceTree : public JSON::ObjectBase {
6916public:
6917 enum {
6918 NoFieldsSet = 0,
6919 FrameSet = 1 << 0,
6920 ResourcesSet = 1 << 1,
6921 AllFieldsSet = (FrameSet | ResourcesSet)
6922 };
6923
6924 template<int STATE>
6925 class Builder {
6926 private:
6927 RefPtr<JSON::Object> m_result;
6928
6929 template<int STEP> Builder<STATE | STEP>& castState()
6930 {
6931 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
6932 }
6933
6934 Builder(Ref</*FrameResourceTree*/JSON::Object>&& object)
6935 : m_result(WTFMove(object))
6936 {
6937 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
6938 }
6939 friend class FrameResourceTree;
6940 public:
6941
6942 Builder<STATE | FrameSet>& setFrame(RefPtr<Inspector::Protocol::Page::Frame> value)
6943 {
6944 COMPILE_ASSERT(!(STATE & FrameSet), property_frame_already_set);
6945 m_result->setObject("frame"_s, value);
6946 return castState<FrameSet>();
6947 }
6948
6949 Builder<STATE | ResourcesSet>& setResources(RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::FrameResource>> value)
6950 {
6951 COMPILE_ASSERT(!(STATE & ResourcesSet), property_resources_already_set);
6952 m_result->setArray("resources"_s, value);
6953 return castState<ResourcesSet>();
6954 }
6955
6956 Ref<FrameResourceTree> release()
6957 {
6958 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
6959 COMPILE_ASSERT(sizeof(FrameResourceTree) == sizeof(JSON::Object), cannot_cast);
6960
6961 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
6962 auto result = WTFMove(*reinterpret_cast<Ref<FrameResourceTree>*>(&jsonResult));
6963 return result;
6964 }
6965 };
6966
6967 /*
6968 * Synthetic constructor:
6969 * Ref<FrameResourceTree> result = FrameResourceTree::create()
6970 * .setFrame(...)
6971 * .setResources(...)
6972 * .release();
6973 */
6974 static Builder<NoFieldsSet> create()
6975 {
6976 return Builder<NoFieldsSet>(JSON::Object::create());
6977 }
6978
6979 void setChildFrames(RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::FrameResourceTree>> value)
6980 {
6981 JSON::ObjectBase::setArray("childFrames"_s, WTFMove(value));
6982 }
6983};
6984
6985/* Search result for resource. */
6986class SearchResult : public JSON::ObjectBase {
6987public:
6988 enum {
6989 NoFieldsSet = 0,
6990 UrlSet = 1 << 0,
6991 FrameIdSet = 1 << 1,
6992 MatchesCountSet = 1 << 2,
6993 AllFieldsSet = (UrlSet | FrameIdSet | MatchesCountSet)
6994 };
6995
6996 template<int STATE>
6997 class Builder {
6998 private:
6999 RefPtr<JSON::Object> m_result;
7000
7001 template<int STEP> Builder<STATE | STEP>& castState()
7002 {
7003 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
7004 }
7005
7006 Builder(Ref</*SearchResult*/JSON::Object>&& object)
7007 : m_result(WTFMove(object))
7008 {
7009 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
7010 }
7011 friend class SearchResult;
7012 public:
7013
7014 Builder<STATE | UrlSet>& setUrl(const String& value)
7015 {
7016 COMPILE_ASSERT(!(STATE & UrlSet), property_url_already_set);
7017 m_result->setString("url"_s, value);
7018 return castState<UrlSet>();
7019 }
7020
7021 Builder<STATE | FrameIdSet>& setFrameId(const String& value)
7022 {
7023 COMPILE_ASSERT(!(STATE & FrameIdSet), property_frameId_already_set);
7024 m_result->setString("frameId"_s, value);
7025 return castState<FrameIdSet>();
7026 }
7027
7028 Builder<STATE | MatchesCountSet>& setMatchesCount(double value)
7029 {
7030 COMPILE_ASSERT(!(STATE & MatchesCountSet), property_matchesCount_already_set);
7031 m_result->setDouble("matchesCount"_s, value);
7032 return castState<MatchesCountSet>();
7033 }
7034
7035 Ref<SearchResult> release()
7036 {
7037 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
7038 COMPILE_ASSERT(sizeof(SearchResult) == sizeof(JSON::Object), cannot_cast);
7039
7040 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
7041 auto result = WTFMove(*reinterpret_cast<Ref<SearchResult>*>(&jsonResult));
7042 return result;
7043 }
7044 };
7045
7046 /*
7047 * Synthetic constructor:
7048 * Ref<SearchResult> result = SearchResult::create()
7049 * .setUrl(...)
7050 * .setFrameId(...)
7051 * .setMatchesCount(...)
7052 * .release();
7053 */
7054 static Builder<NoFieldsSet> create()
7055 {
7056 return Builder<NoFieldsSet>(JSON::Object::create());
7057 }
7058
7059 void setRequestId(const String& value)
7060 {
7061 JSON::ObjectBase::setString("requestId"_s, value);
7062 }
7063};
7064
7065/* Cookie object */
7066class Cookie : public JSON::ObjectBase {
7067public:
7068 enum {
7069 NoFieldsSet = 0,
7070 NameSet = 1 << 0,
7071 ValueSet = 1 << 1,
7072 DomainSet = 1 << 2,
7073 PathSet = 1 << 3,
7074 ExpiresSet = 1 << 4,
7075 SizeSet = 1 << 5,
7076 HttpOnlySet = 1 << 6,
7077 SecureSet = 1 << 7,
7078 SessionSet = 1 << 8,
7079 SameSiteSet = 1 << 9,
7080 AllFieldsSet = (NameSet | ValueSet | DomainSet | PathSet | ExpiresSet | SizeSet | HttpOnlySet | SecureSet | SessionSet | SameSiteSet)
7081 };
7082
7083 template<int STATE>
7084 class Builder {
7085 private:
7086 RefPtr<JSON::Object> m_result;
7087
7088 template<int STEP> Builder<STATE | STEP>& castState()
7089 {
7090 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
7091 }
7092
7093 Builder(Ref</*Cookie*/JSON::Object>&& object)
7094 : m_result(WTFMove(object))
7095 {
7096 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
7097 }
7098 friend class Cookie;
7099 public:
7100
7101 Builder<STATE | NameSet>& setName(const String& value)
7102 {
7103 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
7104 m_result->setString("name"_s, value);
7105 return castState<NameSet>();
7106 }
7107
7108 Builder<STATE | ValueSet>& setValue(const String& value)
7109 {
7110 COMPILE_ASSERT(!(STATE & ValueSet), property_value_already_set);
7111 m_result->setString("value"_s, value);
7112 return castState<ValueSet>();
7113 }
7114
7115 Builder<STATE | DomainSet>& setDomain(const String& value)
7116 {
7117 COMPILE_ASSERT(!(STATE & DomainSet), property_domain_already_set);
7118 m_result->setString("domain"_s, value);
7119 return castState<DomainSet>();
7120 }
7121
7122 Builder<STATE | PathSet>& setPath(const String& value)
7123 {
7124 COMPILE_ASSERT(!(STATE & PathSet), property_path_already_set);
7125 m_result->setString("path"_s, value);
7126 return castState<PathSet>();
7127 }
7128
7129 Builder<STATE | ExpiresSet>& setExpires(double value)
7130 {
7131 COMPILE_ASSERT(!(STATE & ExpiresSet), property_expires_already_set);
7132 m_result->setDouble("expires"_s, value);
7133 return castState<ExpiresSet>();
7134 }
7135
7136 Builder<STATE | SizeSet>& setSize(int value)
7137 {
7138 COMPILE_ASSERT(!(STATE & SizeSet), property_size_already_set);
7139 m_result->setInteger("size"_s, value);
7140 return castState<SizeSet>();
7141 }
7142
7143 Builder<STATE | HttpOnlySet>& setHttpOnly(bool value)
7144 {
7145 COMPILE_ASSERT(!(STATE & HttpOnlySet), property_httpOnly_already_set);
7146 m_result->setBoolean("httpOnly"_s, value);
7147 return castState<HttpOnlySet>();
7148 }
7149
7150 Builder<STATE | SecureSet>& setSecure(bool value)
7151 {
7152 COMPILE_ASSERT(!(STATE & SecureSet), property_secure_already_set);
7153 m_result->setBoolean("secure"_s, value);
7154 return castState<SecureSet>();
7155 }
7156
7157 Builder<STATE | SessionSet>& setSession(bool value)
7158 {
7159 COMPILE_ASSERT(!(STATE & SessionSet), property_session_already_set);
7160 m_result->setBoolean("session"_s, value);
7161 return castState<SessionSet>();
7162 }
7163
7164 Builder<STATE | SameSiteSet>& setSameSite(Inspector::Protocol::Page::CookieSameSitePolicy value)
7165 {
7166 COMPILE_ASSERT(!(STATE & SameSiteSet), property_sameSite_already_set);
7167 m_result->setString("sameSite"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
7168 return castState<SameSiteSet>();
7169 }
7170
7171 Ref<Cookie> release()
7172 {
7173 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
7174 COMPILE_ASSERT(sizeof(Cookie) == sizeof(JSON::Object), cannot_cast);
7175
7176 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
7177 auto result = WTFMove(*reinterpret_cast<Ref<Cookie>*>(&jsonResult));
7178 return result;
7179 }
7180 };
7181
7182 /*
7183 * Synthetic constructor:
7184 * Ref<Cookie> result = Cookie::create()
7185 * .setName(...)
7186 * .setValue(...)
7187 * .setDomain(...)
7188 * .setPath(...)
7189 * .setExpires(...)
7190 * .setSize(...)
7191 * .setHttpOnly(...)
7192 * .setSecure(...)
7193 * .setSession(...)
7194 * .setSameSite(...)
7195 * .release();
7196 */
7197 static Builder<NoFieldsSet> create()
7198 {
7199 return Builder<NoFieldsSet>(JSON::Object::create());
7200 }
7201};
7202
7203} // Page
7204
7205namespace Recording {
7206/* The type of the recording. */
7207enum class Type {
7208 Canvas2D = 27,
7209 CanvasBitmapRenderer = 150,
7210 CanvasWebGL = 151,
7211 CanvasWebGL2 = 152,
7212}; // enum class Type
7213/* */
7214enum class Initiator {
7215 Frontend = 153,
7216 Console = 154,
7217 AutoCapture = 155,
7218}; // enum class Initiator
7219/* Information about the initial state of the recorded object. */
7220class InitialState : public JSON::ObjectBase {
7221public:
7222 enum {
7223 NoFieldsSet = 0,
7224 AllFieldsSet = 0
7225 };
7226
7227 template<int STATE>
7228 class Builder {
7229 private:
7230 RefPtr<JSON::Object> m_result;
7231
7232 template<int STEP> Builder<STATE | STEP>& castState()
7233 {
7234 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
7235 }
7236
7237 Builder(Ref</*InitialState*/JSON::Object>&& object)
7238 : m_result(WTFMove(object))
7239 {
7240 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
7241 }
7242 friend class InitialState;
7243 public:
7244
7245 Ref<InitialState> release()
7246 {
7247 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
7248 COMPILE_ASSERT(sizeof(InitialState) == sizeof(JSON::Object), cannot_cast);
7249
7250 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
7251 auto result = WTFMove(*reinterpret_cast<Ref<InitialState>*>(&jsonResult));
7252 return result;
7253 }
7254 };
7255
7256 /*
7257 * Synthetic constructor:
7258 * Ref<InitialState> result = InitialState::create()
7259 * .release();
7260 */
7261 static Builder<NoFieldsSet> create()
7262 {
7263 return Builder<NoFieldsSet>(JSON::Object::create());
7264 }
7265
7266 void setAttributes(RefPtr<JSON::Object> value)
7267 {
7268 JSON::ObjectBase::setObject("attributes"_s, WTFMove(value));
7269 }
7270
7271 void setStates(RefPtr<JSON::ArrayOf<JSON::Object>> value)
7272 {
7273 JSON::ObjectBase::setArray("states"_s, WTFMove(value));
7274 }
7275
7276 void setParameters(RefPtr<JSON::ArrayOf<JSON::Value>> value)
7277 {
7278 JSON::ObjectBase::setArray("parameters"_s, WTFMove(value));
7279 }
7280
7281 void setContent(const String& value)
7282 {
7283 JSON::ObjectBase::setString("content"_s, value);
7284 }
7285};
7286
7287/* Container object for a single frame of the recording. */
7288class Frame : public JSON::ObjectBase {
7289public:
7290 enum {
7291 NoFieldsSet = 0,
7292 ActionsSet = 1 << 0,
7293 AllFieldsSet = (ActionsSet)
7294 };
7295
7296 template<int STATE>
7297 class Builder {
7298 private:
7299 RefPtr<JSON::Object> m_result;
7300
7301 template<int STEP> Builder<STATE | STEP>& castState()
7302 {
7303 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
7304 }
7305
7306 Builder(Ref</*Frame*/JSON::Object>&& object)
7307 : m_result(WTFMove(object))
7308 {
7309 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
7310 }
7311 friend class Frame;
7312 public:
7313
7314 Builder<STATE | ActionsSet>& setActions(RefPtr<JSON::ArrayOf<JSON::Value>> value)
7315 {
7316 COMPILE_ASSERT(!(STATE & ActionsSet), property_actions_already_set);
7317 m_result->setArray("actions"_s, value);
7318 return castState<ActionsSet>();
7319 }
7320
7321 Ref<Frame> release()
7322 {
7323 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
7324 COMPILE_ASSERT(sizeof(Frame) == sizeof(JSON::Object), cannot_cast);
7325
7326 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
7327 auto result = WTFMove(*reinterpret_cast<Ref<Frame>*>(&jsonResult));
7328 return result;
7329 }
7330 };
7331
7332 /*
7333 * Synthetic constructor:
7334 * Ref<Frame> result = Frame::create()
7335 * .setActions(...)
7336 * .release();
7337 */
7338 static Builder<NoFieldsSet> create()
7339 {
7340 return Builder<NoFieldsSet>(JSON::Object::create());
7341 }
7342
7343 void setDuration(double value)
7344 {
7345 JSON::ObjectBase::setDouble("duration"_s, value);
7346 }
7347
7348 void setIncomplete(bool value)
7349 {
7350 JSON::ObjectBase::setBoolean("incomplete"_s, value);
7351 }
7352};
7353
7354class Recording : public JSON::ObjectBase {
7355public:
7356 enum {
7357 NoFieldsSet = 0,
7358 VersionSet = 1 << 0,
7359 TypeSet = 1 << 1,
7360 InitialStateSet = 1 << 2,
7361 DataSet = 1 << 3,
7362 AllFieldsSet = (VersionSet | TypeSet | InitialStateSet | DataSet)
7363 };
7364
7365 template<int STATE>
7366 class Builder {
7367 private:
7368 RefPtr<JSON::Object> m_result;
7369
7370 template<int STEP> Builder<STATE | STEP>& castState()
7371 {
7372 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
7373 }
7374
7375 Builder(Ref</*Recording*/JSON::Object>&& object)
7376 : m_result(WTFMove(object))
7377 {
7378 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
7379 }
7380 friend class Recording;
7381 public:
7382
7383 Builder<STATE | VersionSet>& setVersion(int value)
7384 {
7385 COMPILE_ASSERT(!(STATE & VersionSet), property_version_already_set);
7386 m_result->setInteger("version"_s, value);
7387 return castState<VersionSet>();
7388 }
7389
7390 Builder<STATE | TypeSet>& setType(Inspector::Protocol::Recording::Type value)
7391 {
7392 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
7393 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
7394 return castState<TypeSet>();
7395 }
7396
7397 Builder<STATE | InitialStateSet>& setInitialState(RefPtr<Inspector::Protocol::Recording::InitialState> value)
7398 {
7399 COMPILE_ASSERT(!(STATE & InitialStateSet), property_initialState_already_set);
7400 m_result->setObject("initialState"_s, value);
7401 return castState<InitialStateSet>();
7402 }
7403
7404 Builder<STATE | DataSet>& setData(RefPtr<JSON::ArrayOf<JSON::Value>> value)
7405 {
7406 COMPILE_ASSERT(!(STATE & DataSet), property_data_already_set);
7407 m_result->setArray("data"_s, value);
7408 return castState<DataSet>();
7409 }
7410
7411 Ref<Recording> release()
7412 {
7413 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
7414 COMPILE_ASSERT(sizeof(Recording) == sizeof(JSON::Object), cannot_cast);
7415
7416 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
7417 auto result = WTFMove(*reinterpret_cast<Ref<Recording>*>(&jsonResult));
7418 return result;
7419 }
7420 };
7421
7422 /*
7423 * Synthetic constructor:
7424 * Ref<Recording> result = Recording::create()
7425 * .setVersion(...)
7426 * .setType(...)
7427 * .setInitialState(...)
7428 * .setData(...)
7429 * .release();
7430 */
7431 static Builder<NoFieldsSet> create()
7432 {
7433 return Builder<NoFieldsSet>(JSON::Object::create());
7434 }
7435
7436 void setName(const String& value)
7437 {
7438 JSON::ObjectBase::setString("name"_s, value);
7439 }
7440};
7441
7442} // Recording
7443
7444namespace Runtime {
7445/* Mirror object referencing original JavaScript object. */
7446class RemoteObject : public JSON::ObjectBase {
7447public:
7448 // Named after property name 'type' while generating RemoteObject.
7449 enum class Type {
7450 Object = 156,
7451 Function = 157,
7452 Undefined = 158,
7453 String = 109,
7454 Number = 108,
7455 Boolean = 159,
7456 Symbol = 160,
7457 }; // enum class Type
7458 // Named after property name 'subtype' while generating RemoteObject.
7459 enum class Subtype {
7460 Array = 110,
7461 Null = 111,
7462 Node = 161,
7463 Regexp = 162,
7464 Date = 84,
7465 Error = 54,
7466 Map = 163,
7467 Set = 164,
7468 Weakmap = 165,
7469 Weakset = 166,
7470 Iterator = 167,
7471 Class = 168,
7472 Proxy = 169,
7473 }; // enum class Subtype
7474 enum {
7475 NoFieldsSet = 0,
7476 TypeSet = 1 << 0,
7477 AllFieldsSet = (TypeSet)
7478 };
7479
7480 template<int STATE>
7481 class Builder {
7482 private:
7483 RefPtr<JSON::Object> m_result;
7484
7485 template<int STEP> Builder<STATE | STEP>& castState()
7486 {
7487 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
7488 }
7489
7490 Builder(Ref</*RemoteObject*/JSON::Object>&& object)
7491 : m_result(WTFMove(object))
7492 {
7493 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
7494 }
7495 friend class RemoteObject;
7496 public:
7497
7498 Builder<STATE | TypeSet>& setType(Type value)
7499 {
7500 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
7501 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
7502 return castState<TypeSet>();
7503 }
7504
7505 Ref<RemoteObject> release()
7506 {
7507 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
7508 COMPILE_ASSERT(sizeof(RemoteObject) == sizeof(JSON::Object), cannot_cast);
7509
7510 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
7511 auto result = WTFMove(*reinterpret_cast<Ref<RemoteObject>*>(&jsonResult));
7512 return result;
7513 }
7514 };
7515
7516 /*
7517 * Synthetic constructor:
7518 * Ref<RemoteObject> result = RemoteObject::create()
7519 * .setType(...)
7520 * .release();
7521 */
7522 static Builder<NoFieldsSet> create()
7523 {
7524 return Builder<NoFieldsSet>(JSON::Object::create());
7525 }
7526
7527 void setSubtype(Subtype value)
7528 {
7529 JSON::ObjectBase::setString("subtype"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
7530 }
7531
7532 void setClassName(const String& value)
7533 {
7534 JSON::ObjectBase::setString("className"_s, value);
7535 }
7536
7537 void setValue(RefPtr<JSON::Value> value)
7538 {
7539 JSON::ObjectBase::setValue("value"_s, WTFMove(value));
7540 }
7541
7542 void setDescription(const String& value)
7543 {
7544 JSON::ObjectBase::setString("description"_s, value);
7545 }
7546
7547 void setObjectId(const String& value)
7548 {
7549 JSON::ObjectBase::setString("objectId"_s, value);
7550 }
7551
7552 void setSize(int value)
7553 {
7554 JSON::ObjectBase::setInteger("size"_s, value);
7555 }
7556
7557 void setClassPrototype(RefPtr<Inspector::Protocol::Runtime::RemoteObject> value)
7558 {
7559 JSON::ObjectBase::setObject("classPrototype"_s, WTFMove(value));
7560 }
7561
7562 void setPreview(RefPtr<Inspector::Protocol::Runtime::ObjectPreview> value)
7563 {
7564 JSON::ObjectBase::setObject("preview"_s, WTFMove(value));
7565 }
7566};
7567
7568/* Object containing abbreviated remote object value. */
7569class ObjectPreview : public JSON::ObjectBase {
7570public:
7571 // Named after property name 'type' while generating ObjectPreview.
7572 enum class Type {
7573 Object = 156,
7574 Function = 157,
7575 Undefined = 158,
7576 String = 109,
7577 Number = 108,
7578 Boolean = 159,
7579 Symbol = 160,
7580 }; // enum class Type
7581 // Named after property name 'subtype' while generating ObjectPreview.
7582 enum class Subtype {
7583 Array = 110,
7584 Null = 111,
7585 Node = 161,
7586 Regexp = 162,
7587 Date = 84,
7588 Error = 54,
7589 Map = 163,
7590 Set = 164,
7591 Weakmap = 165,
7592 Weakset = 166,
7593 Iterator = 167,
7594 Class = 168,
7595 Proxy = 169,
7596 }; // enum class Subtype
7597 enum {
7598 NoFieldsSet = 0,
7599 TypeSet = 1 << 0,
7600 LosslessSet = 1 << 1,
7601 AllFieldsSet = (TypeSet | LosslessSet)
7602 };
7603
7604 template<int STATE>
7605 class Builder {
7606 private:
7607 RefPtr<JSON::Object> m_result;
7608
7609 template<int STEP> Builder<STATE | STEP>& castState()
7610 {
7611 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
7612 }
7613
7614 Builder(Ref</*ObjectPreview*/JSON::Object>&& object)
7615 : m_result(WTFMove(object))
7616 {
7617 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
7618 }
7619 friend class ObjectPreview;
7620 public:
7621
7622 Builder<STATE | TypeSet>& setType(Type value)
7623 {
7624 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
7625 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
7626 return castState<TypeSet>();
7627 }
7628
7629 Builder<STATE | LosslessSet>& setLossless(bool value)
7630 {
7631 COMPILE_ASSERT(!(STATE & LosslessSet), property_lossless_already_set);
7632 m_result->setBoolean("lossless"_s, value);
7633 return castState<LosslessSet>();
7634 }
7635
7636 Ref<ObjectPreview> release()
7637 {
7638 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
7639 COMPILE_ASSERT(sizeof(ObjectPreview) == sizeof(JSON::Object), cannot_cast);
7640
7641 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
7642 auto result = WTFMove(*reinterpret_cast<Ref<ObjectPreview>*>(&jsonResult));
7643 return result;
7644 }
7645 };
7646
7647 /*
7648 * Synthetic constructor:
7649 * Ref<ObjectPreview> result = ObjectPreview::create()
7650 * .setType(...)
7651 * .setLossless(...)
7652 * .release();
7653 */
7654 static Builder<NoFieldsSet> create()
7655 {
7656 return Builder<NoFieldsSet>(JSON::Object::create());
7657 }
7658
7659 void setSubtype(Subtype value)
7660 {
7661 JSON::ObjectBase::setString("subtype"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
7662 }
7663
7664 void setDescription(const String& value)
7665 {
7666 JSON::ObjectBase::setString("description"_s, value);
7667 }
7668
7669 void setOverflow(bool value)
7670 {
7671 JSON::ObjectBase::setBoolean("overflow"_s, value);
7672 }
7673
7674 void setProperties(RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyPreview>> value)
7675 {
7676 JSON::ObjectBase::setArray("properties"_s, WTFMove(value));
7677 }
7678
7679 void setEntries(RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::EntryPreview>> value)
7680 {
7681 JSON::ObjectBase::setArray("entries"_s, WTFMove(value));
7682 }
7683
7684 void setSize(int value)
7685 {
7686 JSON::ObjectBase::setInteger("size"_s, value);
7687 }
7688};
7689
7690class PropertyPreview : public JSON::ObjectBase {
7691public:
7692 // Named after property name 'type' while generating PropertyPreview.
7693 enum class Type {
7694 Object = 156,
7695 Function = 157,
7696 Undefined = 158,
7697 String = 109,
7698 Number = 108,
7699 Boolean = 159,
7700 Symbol = 160,
7701 Accessor = 170,
7702 }; // enum class Type
7703 // Named after property name 'subtype' while generating PropertyPreview.
7704 enum class Subtype {
7705 Array = 110,
7706 Null = 111,
7707 Node = 161,
7708 Regexp = 162,
7709 Date = 84,
7710 Error = 54,
7711 Map = 163,
7712 Set = 164,
7713 Weakmap = 165,
7714 Weakset = 166,
7715 Iterator = 167,
7716 Class = 168,
7717 Proxy = 169,
7718 }; // enum class Subtype
7719 enum {
7720 NoFieldsSet = 0,
7721 NameSet = 1 << 0,
7722 TypeSet = 1 << 1,
7723 AllFieldsSet = (NameSet | TypeSet)
7724 };
7725
7726 template<int STATE>
7727 class Builder {
7728 private:
7729 RefPtr<JSON::Object> m_result;
7730
7731 template<int STEP> Builder<STATE | STEP>& castState()
7732 {
7733 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
7734 }
7735
7736 Builder(Ref</*PropertyPreview*/JSON::Object>&& object)
7737 : m_result(WTFMove(object))
7738 {
7739 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
7740 }
7741 friend class PropertyPreview;
7742 public:
7743
7744 Builder<STATE | NameSet>& setName(const String& value)
7745 {
7746 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
7747 m_result->setString("name"_s, value);
7748 return castState<NameSet>();
7749 }
7750
7751 Builder<STATE | TypeSet>& setType(Type value)
7752 {
7753 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
7754 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
7755 return castState<TypeSet>();
7756 }
7757
7758 Ref<PropertyPreview> release()
7759 {
7760 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
7761 COMPILE_ASSERT(sizeof(PropertyPreview) == sizeof(JSON::Object), cannot_cast);
7762
7763 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
7764 auto result = WTFMove(*reinterpret_cast<Ref<PropertyPreview>*>(&jsonResult));
7765 return result;
7766 }
7767 };
7768
7769 /*
7770 * Synthetic constructor:
7771 * Ref<PropertyPreview> result = PropertyPreview::create()
7772 * .setName(...)
7773 * .setType(...)
7774 * .release();
7775 */
7776 static Builder<NoFieldsSet> create()
7777 {
7778 return Builder<NoFieldsSet>(JSON::Object::create());
7779 }
7780
7781 void setSubtype(Subtype value)
7782 {
7783 JSON::ObjectBase::setString("subtype"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
7784 }
7785
7786 void setValue(const String& value)
7787 {
7788 JSON::ObjectBase::setString("value"_s, value);
7789 }
7790
7791 void setValuePreview(RefPtr<Inspector::Protocol::Runtime::ObjectPreview> value)
7792 {
7793 JSON::ObjectBase::setObject("valuePreview"_s, WTFMove(value));
7794 }
7795
7796 void setInternal(bool value)
7797 {
7798 JSON::ObjectBase::setBoolean("internal"_s, value);
7799 }
7800};
7801
7802class EntryPreview : public JSON::ObjectBase {
7803public:
7804 enum {
7805 NoFieldsSet = 0,
7806 ValueSet = 1 << 0,
7807 AllFieldsSet = (ValueSet)
7808 };
7809
7810 template<int STATE>
7811 class Builder {
7812 private:
7813 RefPtr<JSON::Object> m_result;
7814
7815 template<int STEP> Builder<STATE | STEP>& castState()
7816 {
7817 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
7818 }
7819
7820 Builder(Ref</*EntryPreview*/JSON::Object>&& object)
7821 : m_result(WTFMove(object))
7822 {
7823 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
7824 }
7825 friend class EntryPreview;
7826 public:
7827
7828 Builder<STATE | ValueSet>& setValue(RefPtr<Inspector::Protocol::Runtime::ObjectPreview> value)
7829 {
7830 COMPILE_ASSERT(!(STATE & ValueSet), property_value_already_set);
7831 m_result->setObject("value"_s, value);
7832 return castState<ValueSet>();
7833 }
7834
7835 Ref<EntryPreview> release()
7836 {
7837 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
7838 COMPILE_ASSERT(sizeof(EntryPreview) == sizeof(JSON::Object), cannot_cast);
7839
7840 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
7841 auto result = WTFMove(*reinterpret_cast<Ref<EntryPreview>*>(&jsonResult));
7842 return result;
7843 }
7844 };
7845
7846 /*
7847 * Synthetic constructor:
7848 * Ref<EntryPreview> result = EntryPreview::create()
7849 * .setValue(...)
7850 * .release();
7851 */
7852 static Builder<NoFieldsSet> create()
7853 {
7854 return Builder<NoFieldsSet>(JSON::Object::create());
7855 }
7856
7857 void setKey(RefPtr<Inspector::Protocol::Runtime::ObjectPreview> value)
7858 {
7859 JSON::ObjectBase::setObject("key"_s, WTFMove(value));
7860 }
7861};
7862
7863class CollectionEntry : public JSON::ObjectBase {
7864public:
7865 enum {
7866 NoFieldsSet = 0,
7867 ValueSet = 1 << 0,
7868 AllFieldsSet = (ValueSet)
7869 };
7870
7871 template<int STATE>
7872 class Builder {
7873 private:
7874 RefPtr<JSON::Object> m_result;
7875
7876 template<int STEP> Builder<STATE | STEP>& castState()
7877 {
7878 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
7879 }
7880
7881 Builder(Ref</*CollectionEntry*/JSON::Object>&& object)
7882 : m_result(WTFMove(object))
7883 {
7884 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
7885 }
7886 friend class CollectionEntry;
7887 public:
7888
7889 Builder<STATE | ValueSet>& setValue(RefPtr<Inspector::Protocol::Runtime::RemoteObject> value)
7890 {
7891 COMPILE_ASSERT(!(STATE & ValueSet), property_value_already_set);
7892 m_result->setObject("value"_s, value);
7893 return castState<ValueSet>();
7894 }
7895
7896 Ref<CollectionEntry> release()
7897 {
7898 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
7899 COMPILE_ASSERT(sizeof(CollectionEntry) == sizeof(JSON::Object), cannot_cast);
7900
7901 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
7902 auto result = WTFMove(*reinterpret_cast<Ref<CollectionEntry>*>(&jsonResult));
7903 return result;
7904 }
7905 };
7906
7907 /*
7908 * Synthetic constructor:
7909 * Ref<CollectionEntry> result = CollectionEntry::create()
7910 * .setValue(...)
7911 * .release();
7912 */
7913 static Builder<NoFieldsSet> create()
7914 {
7915 return Builder<NoFieldsSet>(JSON::Object::create());
7916 }
7917
7918 void setKey(RefPtr<Inspector::Protocol::Runtime::RemoteObject> value)
7919 {
7920 JSON::ObjectBase::setObject("key"_s, WTFMove(value));
7921 }
7922};
7923
7924/* Object property descriptor. */
7925class PropertyDescriptor : public JSON::ObjectBase {
7926public:
7927 enum {
7928 NoFieldsSet = 0,
7929 NameSet = 1 << 0,
7930 ConfigurableSet = 1 << 1,
7931 EnumerableSet = 1 << 2,
7932 AllFieldsSet = (NameSet | ConfigurableSet | EnumerableSet)
7933 };
7934
7935 template<int STATE>
7936 class Builder {
7937 private:
7938 RefPtr<JSON::Object> m_result;
7939
7940 template<int STEP> Builder<STATE | STEP>& castState()
7941 {
7942 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
7943 }
7944
7945 Builder(Ref</*PropertyDescriptor*/JSON::Object>&& object)
7946 : m_result(WTFMove(object))
7947 {
7948 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
7949 }
7950 friend class PropertyDescriptor;
7951 public:
7952
7953 Builder<STATE | NameSet>& setName(const String& value)
7954 {
7955 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
7956 m_result->setString("name"_s, value);
7957 return castState<NameSet>();
7958 }
7959
7960 Builder<STATE | ConfigurableSet>& setConfigurable(bool value)
7961 {
7962 COMPILE_ASSERT(!(STATE & ConfigurableSet), property_configurable_already_set);
7963 m_result->setBoolean("configurable"_s, value);
7964 return castState<ConfigurableSet>();
7965 }
7966
7967 Builder<STATE | EnumerableSet>& setEnumerable(bool value)
7968 {
7969 COMPILE_ASSERT(!(STATE & EnumerableSet), property_enumerable_already_set);
7970 m_result->setBoolean("enumerable"_s, value);
7971 return castState<EnumerableSet>();
7972 }
7973
7974 Ref<PropertyDescriptor> release()
7975 {
7976 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
7977 COMPILE_ASSERT(sizeof(PropertyDescriptor) == sizeof(JSON::Object), cannot_cast);
7978
7979 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
7980 auto result = WTFMove(*reinterpret_cast<Ref<PropertyDescriptor>*>(&jsonResult));
7981 return result;
7982 }
7983 };
7984
7985 /*
7986 * Synthetic constructor:
7987 * Ref<PropertyDescriptor> result = PropertyDescriptor::create()
7988 * .setName(...)
7989 * .setConfigurable(...)
7990 * .setEnumerable(...)
7991 * .release();
7992 */
7993 static Builder<NoFieldsSet> create()
7994 {
7995 return Builder<NoFieldsSet>(JSON::Object::create());
7996 }
7997
7998 void setValue(RefPtr<Inspector::Protocol::Runtime::RemoteObject> value)
7999 {
8000 JSON::ObjectBase::setObject("value"_s, WTFMove(value));
8001 }
8002
8003 void setWritable(bool value)
8004 {
8005 JSON::ObjectBase::setBoolean("writable"_s, value);
8006 }
8007
8008 void setGet(RefPtr<Inspector::Protocol::Runtime::RemoteObject> value)
8009 {
8010 JSON::ObjectBase::setObject("get"_s, WTFMove(value));
8011 }
8012
8013 void setSet(RefPtr<Inspector::Protocol::Runtime::RemoteObject> value)
8014 {
8015 JSON::ObjectBase::setObject("set"_s, WTFMove(value));
8016 }
8017
8018 void setWasThrown(bool value)
8019 {
8020 JSON::ObjectBase::setBoolean("wasThrown"_s, value);
8021 }
8022
8023 void setIsOwn(bool value)
8024 {
8025 JSON::ObjectBase::setBoolean("isOwn"_s, value);
8026 }
8027
8028 void setSymbol(RefPtr<Inspector::Protocol::Runtime::RemoteObject> value)
8029 {
8030 JSON::ObjectBase::setObject("symbol"_s, WTFMove(value));
8031 }
8032
8033 void setNativeGetter(bool value)
8034 {
8035 JSON::ObjectBase::setBoolean("nativeGetter"_s, value);
8036 }
8037};
8038
8039/* Object internal property descriptor. This property isn't normally visible in JavaScript code. */
8040class InternalPropertyDescriptor : public JSON::ObjectBase {
8041public:
8042 enum {
8043 NoFieldsSet = 0,
8044 NameSet = 1 << 0,
8045 AllFieldsSet = (NameSet)
8046 };
8047
8048 template<int STATE>
8049 class Builder {
8050 private:
8051 RefPtr<JSON::Object> m_result;
8052
8053 template<int STEP> Builder<STATE | STEP>& castState()
8054 {
8055 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
8056 }
8057
8058 Builder(Ref</*InternalPropertyDescriptor*/JSON::Object>&& object)
8059 : m_result(WTFMove(object))
8060 {
8061 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
8062 }
8063 friend class InternalPropertyDescriptor;
8064 public:
8065
8066 Builder<STATE | NameSet>& setName(const String& value)
8067 {
8068 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
8069 m_result->setString("name"_s, value);
8070 return castState<NameSet>();
8071 }
8072
8073 Ref<InternalPropertyDescriptor> release()
8074 {
8075 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
8076 COMPILE_ASSERT(sizeof(InternalPropertyDescriptor) == sizeof(JSON::Object), cannot_cast);
8077
8078 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
8079 auto result = WTFMove(*reinterpret_cast<Ref<InternalPropertyDescriptor>*>(&jsonResult));
8080 return result;
8081 }
8082 };
8083
8084 /*
8085 * Synthetic constructor:
8086 * Ref<InternalPropertyDescriptor> result = InternalPropertyDescriptor::create()
8087 * .setName(...)
8088 * .release();
8089 */
8090 static Builder<NoFieldsSet> create()
8091 {
8092 return Builder<NoFieldsSet>(JSON::Object::create());
8093 }
8094
8095 void setValue(RefPtr<Inspector::Protocol::Runtime::RemoteObject> value)
8096 {
8097 JSON::ObjectBase::setObject("value"_s, WTFMove(value));
8098 }
8099};
8100
8101/* Represents function call argument. Either remote object id <code>objectId</code> or primitive <code>value</code> or neither of (for undefined) them should be specified. */
8102class CallArgument : public JSON::ObjectBase {
8103public:
8104 enum {
8105 NoFieldsSet = 0,
8106 AllFieldsSet = 0
8107 };
8108
8109 template<int STATE>
8110 class Builder {
8111 private:
8112 RefPtr<JSON::Object> m_result;
8113
8114 template<int STEP> Builder<STATE | STEP>& castState()
8115 {
8116 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
8117 }
8118
8119 Builder(Ref</*CallArgument*/JSON::Object>&& object)
8120 : m_result(WTFMove(object))
8121 {
8122 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
8123 }
8124 friend class CallArgument;
8125 public:
8126
8127 Ref<CallArgument> release()
8128 {
8129 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
8130 COMPILE_ASSERT(sizeof(CallArgument) == sizeof(JSON::Object), cannot_cast);
8131
8132 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
8133 auto result = WTFMove(*reinterpret_cast<Ref<CallArgument>*>(&jsonResult));
8134 return result;
8135 }
8136 };
8137
8138 /*
8139 * Synthetic constructor:
8140 * Ref<CallArgument> result = CallArgument::create()
8141 * .release();
8142 */
8143 static Builder<NoFieldsSet> create()
8144 {
8145 return Builder<NoFieldsSet>(JSON::Object::create());
8146 }
8147
8148 void setValue(RefPtr<JSON::Value> value)
8149 {
8150 JSON::ObjectBase::setValue("value"_s, WTFMove(value));
8151 }
8152
8153 void setObjectId(const String& value)
8154 {
8155 JSON::ObjectBase::setString("objectId"_s, value);
8156 }
8157};
8158
8159/* Description of an isolated world. */
8160class ExecutionContextDescription : public JSON::ObjectBase {
8161public:
8162 enum {
8163 NoFieldsSet = 0,
8164 IdSet = 1 << 0,
8165 IsPageContextSet = 1 << 1,
8166 NameSet = 1 << 2,
8167 FrameIdSet = 1 << 3,
8168 AllFieldsSet = (IdSet | IsPageContextSet | NameSet | FrameIdSet)
8169 };
8170
8171 template<int STATE>
8172 class Builder {
8173 private:
8174 RefPtr<JSON::Object> m_result;
8175
8176 template<int STEP> Builder<STATE | STEP>& castState()
8177 {
8178 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
8179 }
8180
8181 Builder(Ref</*ExecutionContextDescription*/JSON::Object>&& object)
8182 : m_result(WTFMove(object))
8183 {
8184 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
8185 }
8186 friend class ExecutionContextDescription;
8187 public:
8188
8189 Builder<STATE | IdSet>& setId(int value)
8190 {
8191 COMPILE_ASSERT(!(STATE & IdSet), property_id_already_set);
8192 m_result->setInteger("id"_s, value);
8193 return castState<IdSet>();
8194 }
8195
8196 Builder<STATE | IsPageContextSet>& setIsPageContext(bool value)
8197 {
8198 COMPILE_ASSERT(!(STATE & IsPageContextSet), property_isPageContext_already_set);
8199 m_result->setBoolean("isPageContext"_s, value);
8200 return castState<IsPageContextSet>();
8201 }
8202
8203 Builder<STATE | NameSet>& setName(const String& value)
8204 {
8205 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
8206 m_result->setString("name"_s, value);
8207 return castState<NameSet>();
8208 }
8209
8210 Builder<STATE | FrameIdSet>& setFrameId(const String& value)
8211 {
8212 COMPILE_ASSERT(!(STATE & FrameIdSet), property_frameId_already_set);
8213 m_result->setString("frameId"_s, value);
8214 return castState<FrameIdSet>();
8215 }
8216
8217 Ref<ExecutionContextDescription> release()
8218 {
8219 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
8220 COMPILE_ASSERT(sizeof(ExecutionContextDescription) == sizeof(JSON::Object), cannot_cast);
8221
8222 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
8223 auto result = WTFMove(*reinterpret_cast<Ref<ExecutionContextDescription>*>(&jsonResult));
8224 return result;
8225 }
8226 };
8227
8228 /*
8229 * Synthetic constructor:
8230 * Ref<ExecutionContextDescription> result = ExecutionContextDescription::create()
8231 * .setId(...)
8232 * .setIsPageContext(...)
8233 * .setName(...)
8234 * .setFrameId(...)
8235 * .release();
8236 */
8237 static Builder<NoFieldsSet> create()
8238 {
8239 return Builder<NoFieldsSet>(JSON::Object::create());
8240 }
8241};
8242
8243/* Syntax error type: "none" for no error, "irrecoverable" for unrecoverable errors, "unterminated-literal" for when there is an unterminated literal, "recoverable" for when the expression is unfinished but valid so far. */
8244enum class SyntaxErrorType {
8245 None = 171,
8246 Irrecoverable = 172,
8247 UnterminatedLiteral = 173,
8248 Recoverable = 174,
8249}; // enum class SyntaxErrorType
8250/* Range of an error in source code. */
8251class ErrorRange : public JSON::ObjectBase {
8252public:
8253 enum {
8254 NoFieldsSet = 0,
8255 StartOffsetSet = 1 << 0,
8256 EndOffsetSet = 1 << 1,
8257 AllFieldsSet = (StartOffsetSet | EndOffsetSet)
8258 };
8259
8260 template<int STATE>
8261 class Builder {
8262 private:
8263 RefPtr<JSON::Object> m_result;
8264
8265 template<int STEP> Builder<STATE | STEP>& castState()
8266 {
8267 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
8268 }
8269
8270 Builder(Ref</*ErrorRange*/JSON::Object>&& object)
8271 : m_result(WTFMove(object))
8272 {
8273 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
8274 }
8275 friend class ErrorRange;
8276 public:
8277
8278 Builder<STATE | StartOffsetSet>& setStartOffset(int value)
8279 {
8280 COMPILE_ASSERT(!(STATE & StartOffsetSet), property_startOffset_already_set);
8281 m_result->setInteger("startOffset"_s, value);
8282 return castState<StartOffsetSet>();
8283 }
8284
8285 Builder<STATE | EndOffsetSet>& setEndOffset(int value)
8286 {
8287 COMPILE_ASSERT(!(STATE & EndOffsetSet), property_endOffset_already_set);
8288 m_result->setInteger("endOffset"_s, value);
8289 return castState<EndOffsetSet>();
8290 }
8291
8292 Ref<ErrorRange> release()
8293 {
8294 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
8295 COMPILE_ASSERT(sizeof(ErrorRange) == sizeof(JSON::Object), cannot_cast);
8296
8297 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
8298 auto result = WTFMove(*reinterpret_cast<Ref<ErrorRange>*>(&jsonResult));
8299 return result;
8300 }
8301 };
8302
8303 /*
8304 * Synthetic constructor:
8305 * Ref<ErrorRange> result = ErrorRange::create()
8306 * .setStartOffset(...)
8307 * .setEndOffset(...)
8308 * .release();
8309 */
8310 static Builder<NoFieldsSet> create()
8311 {
8312 return Builder<NoFieldsSet>(JSON::Object::create());
8313 }
8314};
8315
8316class StructureDescription : public JSON::ObjectBase {
8317public:
8318 enum {
8319 NoFieldsSet = 0,
8320 AllFieldsSet = 0
8321 };
8322
8323 template<int STATE>
8324 class Builder {
8325 private:
8326 RefPtr<JSON::Object> m_result;
8327
8328 template<int STEP> Builder<STATE | STEP>& castState()
8329 {
8330 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
8331 }
8332
8333 Builder(Ref</*StructureDescription*/JSON::Object>&& object)
8334 : m_result(WTFMove(object))
8335 {
8336 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
8337 }
8338 friend class StructureDescription;
8339 public:
8340
8341 Ref<StructureDescription> release()
8342 {
8343 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
8344 COMPILE_ASSERT(sizeof(StructureDescription) == sizeof(JSON::Object), cannot_cast);
8345
8346 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
8347 auto result = WTFMove(*reinterpret_cast<Ref<StructureDescription>*>(&jsonResult));
8348 return result;
8349 }
8350 };
8351
8352 /*
8353 * Synthetic constructor:
8354 * Ref<StructureDescription> result = StructureDescription::create()
8355 * .release();
8356 */
8357 static Builder<NoFieldsSet> create()
8358 {
8359 return Builder<NoFieldsSet>(JSON::Object::create());
8360 }
8361
8362 void setFields(RefPtr<JSON::ArrayOf<String>> value)
8363 {
8364 JSON::ObjectBase::setArray("fields"_s, WTFMove(value));
8365 }
8366
8367 void setOptionalFields(RefPtr<JSON::ArrayOf<String>> value)
8368 {
8369 JSON::ObjectBase::setArray("optionalFields"_s, WTFMove(value));
8370 }
8371
8372 void setConstructorName(const String& value)
8373 {
8374 JSON::ObjectBase::setString("constructorName"_s, value);
8375 }
8376
8377 void setPrototypeStructure(RefPtr<Inspector::Protocol::Runtime::StructureDescription> value)
8378 {
8379 JSON::ObjectBase::setObject("prototypeStructure"_s, WTFMove(value));
8380 }
8381
8382 void setIsImprecise(bool value)
8383 {
8384 JSON::ObjectBase::setBoolean("isImprecise"_s, value);
8385 }
8386};
8387
8388class TypeSet : public JSON::ObjectBase {
8389public:
8390 enum {
8391 NoFieldsSet = 0,
8392 IsFunctionSet = 1 << 0,
8393 IsUndefinedSet = 1 << 1,
8394 IsNullSet = 1 << 2,
8395 IsBooleanSet = 1 << 3,
8396 IsIntegerSet = 1 << 4,
8397 IsNumberSet = 1 << 5,
8398 IsStringSet = 1 << 6,
8399 IsObjectSet = 1 << 7,
8400 IsSymbolSet = 1 << 8,
8401 AllFieldsSet = (IsFunctionSet | IsUndefinedSet | IsNullSet | IsBooleanSet | IsIntegerSet | IsNumberSet | IsStringSet | IsObjectSet | IsSymbolSet)
8402 };
8403
8404 template<int STATE>
8405 class Builder {
8406 private:
8407 RefPtr<JSON::Object> m_result;
8408
8409 template<int STEP> Builder<STATE | STEP>& castState()
8410 {
8411 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
8412 }
8413
8414 Builder(Ref</*TypeSet*/JSON::Object>&& object)
8415 : m_result(WTFMove(object))
8416 {
8417 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
8418 }
8419 friend class TypeSet;
8420 public:
8421
8422 Builder<STATE | IsFunctionSet>& setIsFunction(bool value)
8423 {
8424 COMPILE_ASSERT(!(STATE & IsFunctionSet), property_isFunction_already_set);
8425 m_result->setBoolean("isFunction"_s, value);
8426 return castState<IsFunctionSet>();
8427 }
8428
8429 Builder<STATE | IsUndefinedSet>& setIsUndefined(bool value)
8430 {
8431 COMPILE_ASSERT(!(STATE & IsUndefinedSet), property_isUndefined_already_set);
8432 m_result->setBoolean("isUndefined"_s, value);
8433 return castState<IsUndefinedSet>();
8434 }
8435
8436 Builder<STATE | IsNullSet>& setIsNull(bool value)
8437 {
8438 COMPILE_ASSERT(!(STATE & IsNullSet), property_isNull_already_set);
8439 m_result->setBoolean("isNull"_s, value);
8440 return castState<IsNullSet>();
8441 }
8442
8443 Builder<STATE | IsBooleanSet>& setIsBoolean(bool value)
8444 {
8445 COMPILE_ASSERT(!(STATE & IsBooleanSet), property_isBoolean_already_set);
8446 m_result->setBoolean("isBoolean"_s, value);
8447 return castState<IsBooleanSet>();
8448 }
8449
8450 Builder<STATE | IsIntegerSet>& setIsInteger(bool value)
8451 {
8452 COMPILE_ASSERT(!(STATE & IsIntegerSet), property_isInteger_already_set);
8453 m_result->setBoolean("isInteger"_s, value);
8454 return castState<IsIntegerSet>();
8455 }
8456
8457 Builder<STATE | IsNumberSet>& setIsNumber(bool value)
8458 {
8459 COMPILE_ASSERT(!(STATE & IsNumberSet), property_isNumber_already_set);
8460 m_result->setBoolean("isNumber"_s, value);
8461 return castState<IsNumberSet>();
8462 }
8463
8464 Builder<STATE | IsStringSet>& setIsString(bool value)
8465 {
8466 COMPILE_ASSERT(!(STATE & IsStringSet), property_isString_already_set);
8467 m_result->setBoolean("isString"_s, value);
8468 return castState<IsStringSet>();
8469 }
8470
8471 Builder<STATE | IsObjectSet>& setIsObject(bool value)
8472 {
8473 COMPILE_ASSERT(!(STATE & IsObjectSet), property_isObject_already_set);
8474 m_result->setBoolean("isObject"_s, value);
8475 return castState<IsObjectSet>();
8476 }
8477
8478 Builder<STATE | IsSymbolSet>& setIsSymbol(bool value)
8479 {
8480 COMPILE_ASSERT(!(STATE & IsSymbolSet), property_isSymbol_already_set);
8481 m_result->setBoolean("isSymbol"_s, value);
8482 return castState<IsSymbolSet>();
8483 }
8484
8485 Ref<TypeSet> release()
8486 {
8487 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
8488 COMPILE_ASSERT(sizeof(TypeSet) == sizeof(JSON::Object), cannot_cast);
8489
8490 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
8491 auto result = WTFMove(*reinterpret_cast<Ref<TypeSet>*>(&jsonResult));
8492 return result;
8493 }
8494 };
8495
8496 /*
8497 * Synthetic constructor:
8498 * Ref<TypeSet> result = TypeSet::create()
8499 * .setIsFunction(...)
8500 * .setIsUndefined(...)
8501 * .setIsNull(...)
8502 * .setIsBoolean(...)
8503 * .setIsInteger(...)
8504 * .setIsNumber(...)
8505 * .setIsString(...)
8506 * .setIsObject(...)
8507 * .setIsSymbol(...)
8508 * .release();
8509 */
8510 static Builder<NoFieldsSet> create()
8511 {
8512 return Builder<NoFieldsSet>(JSON::Object::create());
8513 }
8514};
8515
8516/* Container for type information that has been gathered. */
8517class TypeDescription : public JSON::ObjectBase {
8518public:
8519 enum {
8520 NoFieldsSet = 0,
8521 IsValidSet = 1 << 0,
8522 AllFieldsSet = (IsValidSet)
8523 };
8524
8525 template<int STATE>
8526 class Builder {
8527 private:
8528 RefPtr<JSON::Object> m_result;
8529
8530 template<int STEP> Builder<STATE | STEP>& castState()
8531 {
8532 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
8533 }
8534
8535 Builder(Ref</*TypeDescription*/JSON::Object>&& object)
8536 : m_result(WTFMove(object))
8537 {
8538 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
8539 }
8540 friend class TypeDescription;
8541 public:
8542
8543 Builder<STATE | IsValidSet>& setIsValid(bool value)
8544 {
8545 COMPILE_ASSERT(!(STATE & IsValidSet), property_isValid_already_set);
8546 m_result->setBoolean("isValid"_s, value);
8547 return castState<IsValidSet>();
8548 }
8549
8550 Ref<TypeDescription> release()
8551 {
8552 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
8553 COMPILE_ASSERT(sizeof(TypeDescription) == sizeof(JSON::Object), cannot_cast);
8554
8555 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
8556 auto result = WTFMove(*reinterpret_cast<Ref<TypeDescription>*>(&jsonResult));
8557 return result;
8558 }
8559 };
8560
8561 /*
8562 * Synthetic constructor:
8563 * Ref<TypeDescription> result = TypeDescription::create()
8564 * .setIsValid(...)
8565 * .release();
8566 */
8567 static Builder<NoFieldsSet> create()
8568 {
8569 return Builder<NoFieldsSet>(JSON::Object::create());
8570 }
8571
8572 void setLeastCommonAncestor(const String& value)
8573 {
8574 JSON::ObjectBase::setString("leastCommonAncestor"_s, value);
8575 }
8576
8577 void setTypeSet(RefPtr<Inspector::Protocol::Runtime::TypeSet> value)
8578 {
8579 JSON::ObjectBase::setObject("typeSet"_s, WTFMove(value));
8580 }
8581
8582 void setStructures(RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::StructureDescription>> value)
8583 {
8584 JSON::ObjectBase::setArray("structures"_s, WTFMove(value));
8585 }
8586
8587 void setIsTruncated(bool value)
8588 {
8589 JSON::ObjectBase::setBoolean("isTruncated"_s, value);
8590 }
8591};
8592
8593/* Describes the location of an expression we want type information for. */
8594class TypeLocation : public JSON::ObjectBase {
8595public:
8596 enum {
8597 NoFieldsSet = 0,
8598 TypeInformationDescriptorSet = 1 << 0,
8599 SourceIDSet = 1 << 1,
8600 DivotSet = 1 << 2,
8601 AllFieldsSet = (TypeInformationDescriptorSet | SourceIDSet | DivotSet)
8602 };
8603
8604 template<int STATE>
8605 class Builder {
8606 private:
8607 RefPtr<JSON::Object> m_result;
8608
8609 template<int STEP> Builder<STATE | STEP>& castState()
8610 {
8611 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
8612 }
8613
8614 Builder(Ref</*TypeLocation*/JSON::Object>&& object)
8615 : m_result(WTFMove(object))
8616 {
8617 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
8618 }
8619 friend class TypeLocation;
8620 public:
8621
8622 Builder<STATE | TypeInformationDescriptorSet>& setTypeInformationDescriptor(int value)
8623 {
8624 COMPILE_ASSERT(!(STATE & TypeInformationDescriptorSet), property_typeInformationDescriptor_already_set);
8625 m_result->setInteger("typeInformationDescriptor"_s, value);
8626 return castState<TypeInformationDescriptorSet>();
8627 }
8628
8629 Builder<STATE | SourceIDSet>& setSourceID(const String& value)
8630 {
8631 COMPILE_ASSERT(!(STATE & SourceIDSet), property_sourceID_already_set);
8632 m_result->setString("sourceID"_s, value);
8633 return castState<SourceIDSet>();
8634 }
8635
8636 Builder<STATE | DivotSet>& setDivot(int value)
8637 {
8638 COMPILE_ASSERT(!(STATE & DivotSet), property_divot_already_set);
8639 m_result->setInteger("divot"_s, value);
8640 return castState<DivotSet>();
8641 }
8642
8643 Ref<TypeLocation> release()
8644 {
8645 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
8646 COMPILE_ASSERT(sizeof(TypeLocation) == sizeof(JSON::Object), cannot_cast);
8647
8648 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
8649 auto result = WTFMove(*reinterpret_cast<Ref<TypeLocation>*>(&jsonResult));
8650 return result;
8651 }
8652 };
8653
8654 /*
8655 * Synthetic constructor:
8656 * Ref<TypeLocation> result = TypeLocation::create()
8657 * .setTypeInformationDescriptor(...)
8658 * .setSourceID(...)
8659 * .setDivot(...)
8660 * .release();
8661 */
8662 static Builder<NoFieldsSet> create()
8663 {
8664 return Builder<NoFieldsSet>(JSON::Object::create());
8665 }
8666};
8667
8668/* From Wikipedia: a basic block is a portion of the code within a program with only one entry point and only one exit point. This type gives the location of a basic block and if that basic block has executed. */
8669class BasicBlock : public JSON::ObjectBase {
8670public:
8671 enum {
8672 NoFieldsSet = 0,
8673 StartOffsetSet = 1 << 0,
8674 EndOffsetSet = 1 << 1,
8675 HasExecutedSet = 1 << 2,
8676 ExecutionCountSet = 1 << 3,
8677 AllFieldsSet = (StartOffsetSet | EndOffsetSet | HasExecutedSet | ExecutionCountSet)
8678 };
8679
8680 template<int STATE>
8681 class Builder {
8682 private:
8683 RefPtr<JSON::Object> m_result;
8684
8685 template<int STEP> Builder<STATE | STEP>& castState()
8686 {
8687 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
8688 }
8689
8690 Builder(Ref</*BasicBlock*/JSON::Object>&& object)
8691 : m_result(WTFMove(object))
8692 {
8693 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
8694 }
8695 friend class BasicBlock;
8696 public:
8697
8698 Builder<STATE | StartOffsetSet>& setStartOffset(int value)
8699 {
8700 COMPILE_ASSERT(!(STATE & StartOffsetSet), property_startOffset_already_set);
8701 m_result->setInteger("startOffset"_s, value);
8702 return castState<StartOffsetSet>();
8703 }
8704
8705 Builder<STATE | EndOffsetSet>& setEndOffset(int value)
8706 {
8707 COMPILE_ASSERT(!(STATE & EndOffsetSet), property_endOffset_already_set);
8708 m_result->setInteger("endOffset"_s, value);
8709 return castState<EndOffsetSet>();
8710 }
8711
8712 Builder<STATE | HasExecutedSet>& setHasExecuted(bool value)
8713 {
8714 COMPILE_ASSERT(!(STATE & HasExecutedSet), property_hasExecuted_already_set);
8715 m_result->setBoolean("hasExecuted"_s, value);
8716 return castState<HasExecutedSet>();
8717 }
8718
8719 Builder<STATE | ExecutionCountSet>& setExecutionCount(int value)
8720 {
8721 COMPILE_ASSERT(!(STATE & ExecutionCountSet), property_executionCount_already_set);
8722 m_result->setInteger("executionCount"_s, value);
8723 return castState<ExecutionCountSet>();
8724 }
8725
8726 Ref<BasicBlock> release()
8727 {
8728 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
8729 COMPILE_ASSERT(sizeof(BasicBlock) == sizeof(JSON::Object), cannot_cast);
8730
8731 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
8732 auto result = WTFMove(*reinterpret_cast<Ref<BasicBlock>*>(&jsonResult));
8733 return result;
8734 }
8735 };
8736
8737 /*
8738 * Synthetic constructor:
8739 * Ref<BasicBlock> result = BasicBlock::create()
8740 * .setStartOffset(...)
8741 * .setEndOffset(...)
8742 * .setHasExecuted(...)
8743 * .setExecutionCount(...)
8744 * .release();
8745 */
8746 static Builder<NoFieldsSet> create()
8747 {
8748 return Builder<NoFieldsSet>(JSON::Object::create());
8749 }
8750};
8751
8752} // Runtime
8753
8754namespace ScriptProfiler {
8755/* */
8756enum class EventType {
8757 API = 175,
8758 Microtask = 176,
8759 Other = 132,
8760}; // enum class EventType
8761class Event : public JSON::ObjectBase {
8762public:
8763 enum {
8764 NoFieldsSet = 0,
8765 StartTimeSet = 1 << 0,
8766 EndTimeSet = 1 << 1,
8767 TypeSet = 1 << 2,
8768 AllFieldsSet = (StartTimeSet | EndTimeSet | TypeSet)
8769 };
8770
8771 template<int STATE>
8772 class Builder {
8773 private:
8774 RefPtr<JSON::Object> m_result;
8775
8776 template<int STEP> Builder<STATE | STEP>& castState()
8777 {
8778 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
8779 }
8780
8781 Builder(Ref</*Event*/JSON::Object>&& object)
8782 : m_result(WTFMove(object))
8783 {
8784 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
8785 }
8786 friend class Event;
8787 public:
8788
8789 Builder<STATE | StartTimeSet>& setStartTime(double value)
8790 {
8791 COMPILE_ASSERT(!(STATE & StartTimeSet), property_startTime_already_set);
8792 m_result->setDouble("startTime"_s, value);
8793 return castState<StartTimeSet>();
8794 }
8795
8796 Builder<STATE | EndTimeSet>& setEndTime(double value)
8797 {
8798 COMPILE_ASSERT(!(STATE & EndTimeSet), property_endTime_already_set);
8799 m_result->setDouble("endTime"_s, value);
8800 return castState<EndTimeSet>();
8801 }
8802
8803 Builder<STATE | TypeSet>& setType(Inspector::Protocol::ScriptProfiler::EventType value)
8804 {
8805 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
8806 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
8807 return castState<TypeSet>();
8808 }
8809
8810 Ref<Event> release()
8811 {
8812 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
8813 COMPILE_ASSERT(sizeof(Event) == sizeof(JSON::Object), cannot_cast);
8814
8815 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
8816 auto result = WTFMove(*reinterpret_cast<Ref<Event>*>(&jsonResult));
8817 return result;
8818 }
8819 };
8820
8821 /*
8822 * Synthetic constructor:
8823 * Ref<Event> result = Event::create()
8824 * .setStartTime(...)
8825 * .setEndTime(...)
8826 * .setType(...)
8827 * .release();
8828 */
8829 static Builder<NoFieldsSet> create()
8830 {
8831 return Builder<NoFieldsSet>(JSON::Object::create());
8832 }
8833};
8834
8835class ExpressionLocation : public JSON::ObjectBase {
8836public:
8837 enum {
8838 NoFieldsSet = 0,
8839 LineSet = 1 << 0,
8840 ColumnSet = 1 << 1,
8841 AllFieldsSet = (LineSet | ColumnSet)
8842 };
8843
8844 template<int STATE>
8845 class Builder {
8846 private:
8847 RefPtr<JSON::Object> m_result;
8848
8849 template<int STEP> Builder<STATE | STEP>& castState()
8850 {
8851 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
8852 }
8853
8854 Builder(Ref</*ExpressionLocation*/JSON::Object>&& object)
8855 : m_result(WTFMove(object))
8856 {
8857 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
8858 }
8859 friend class ExpressionLocation;
8860 public:
8861
8862 Builder<STATE | LineSet>& setLine(int value)
8863 {
8864 COMPILE_ASSERT(!(STATE & LineSet), property_line_already_set);
8865 m_result->setInteger("line"_s, value);
8866 return castState<LineSet>();
8867 }
8868
8869 Builder<STATE | ColumnSet>& setColumn(int value)
8870 {
8871 COMPILE_ASSERT(!(STATE & ColumnSet), property_column_already_set);
8872 m_result->setInteger("column"_s, value);
8873 return castState<ColumnSet>();
8874 }
8875
8876 Ref<ExpressionLocation> release()
8877 {
8878 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
8879 COMPILE_ASSERT(sizeof(ExpressionLocation) == sizeof(JSON::Object), cannot_cast);
8880
8881 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
8882 auto result = WTFMove(*reinterpret_cast<Ref<ExpressionLocation>*>(&jsonResult));
8883 return result;
8884 }
8885 };
8886
8887 /*
8888 * Synthetic constructor:
8889 * Ref<ExpressionLocation> result = ExpressionLocation::create()
8890 * .setLine(...)
8891 * .setColumn(...)
8892 * .release();
8893 */
8894 static Builder<NoFieldsSet> create()
8895 {
8896 return Builder<NoFieldsSet>(JSON::Object::create());
8897 }
8898};
8899
8900class StackFrame : public JSON::ObjectBase {
8901public:
8902 enum {
8903 NoFieldsSet = 0,
8904 SourceIDSet = 1 << 0,
8905 NameSet = 1 << 1,
8906 LineSet = 1 << 2,
8907 ColumnSet = 1 << 3,
8908 UrlSet = 1 << 4,
8909 AllFieldsSet = (SourceIDSet | NameSet | LineSet | ColumnSet | UrlSet)
8910 };
8911
8912 template<int STATE>
8913 class Builder {
8914 private:
8915 RefPtr<JSON::Object> m_result;
8916
8917 template<int STEP> Builder<STATE | STEP>& castState()
8918 {
8919 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
8920 }
8921
8922 Builder(Ref</*StackFrame*/JSON::Object>&& object)
8923 : m_result(WTFMove(object))
8924 {
8925 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
8926 }
8927 friend class StackFrame;
8928 public:
8929
8930 Builder<STATE | SourceIDSet>& setSourceID(const String& value)
8931 {
8932 COMPILE_ASSERT(!(STATE & SourceIDSet), property_sourceID_already_set);
8933 m_result->setString("sourceID"_s, value);
8934 return castState<SourceIDSet>();
8935 }
8936
8937 Builder<STATE | NameSet>& setName(const String& value)
8938 {
8939 COMPILE_ASSERT(!(STATE & NameSet), property_name_already_set);
8940 m_result->setString("name"_s, value);
8941 return castState<NameSet>();
8942 }
8943
8944 Builder<STATE | LineSet>& setLine(int value)
8945 {
8946 COMPILE_ASSERT(!(STATE & LineSet), property_line_already_set);
8947 m_result->setInteger("line"_s, value);
8948 return castState<LineSet>();
8949 }
8950
8951 Builder<STATE | ColumnSet>& setColumn(int value)
8952 {
8953 COMPILE_ASSERT(!(STATE & ColumnSet), property_column_already_set);
8954 m_result->setInteger("column"_s, value);
8955 return castState<ColumnSet>();
8956 }
8957
8958 Builder<STATE | UrlSet>& setUrl(const String& value)
8959 {
8960 COMPILE_ASSERT(!(STATE & UrlSet), property_url_already_set);
8961 m_result->setString("url"_s, value);
8962 return castState<UrlSet>();
8963 }
8964
8965 Ref<StackFrame> release()
8966 {
8967 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
8968 COMPILE_ASSERT(sizeof(StackFrame) == sizeof(JSON::Object), cannot_cast);
8969
8970 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
8971 auto result = WTFMove(*reinterpret_cast<Ref<StackFrame>*>(&jsonResult));
8972 return result;
8973 }
8974 };
8975
8976 /*
8977 * Synthetic constructor:
8978 * Ref<StackFrame> result = StackFrame::create()
8979 * .setSourceID(...)
8980 * .setName(...)
8981 * .setLine(...)
8982 * .setColumn(...)
8983 * .setUrl(...)
8984 * .release();
8985 */
8986 static Builder<NoFieldsSet> create()
8987 {
8988 return Builder<NoFieldsSet>(JSON::Object::create());
8989 }
8990
8991 void setExpressionLocation(RefPtr<Inspector::Protocol::ScriptProfiler::ExpressionLocation> value)
8992 {
8993 JSON::ObjectBase::setObject("expressionLocation"_s, WTFMove(value));
8994 }
8995};
8996
8997class StackTrace : public JSON::ObjectBase {
8998public:
8999 enum {
9000 NoFieldsSet = 0,
9001 TimestampSet = 1 << 0,
9002 StackFramesSet = 1 << 1,
9003 AllFieldsSet = (TimestampSet | StackFramesSet)
9004 };
9005
9006 template<int STATE>
9007 class Builder {
9008 private:
9009 RefPtr<JSON::Object> m_result;
9010
9011 template<int STEP> Builder<STATE | STEP>& castState()
9012 {
9013 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
9014 }
9015
9016 Builder(Ref</*StackTrace*/JSON::Object>&& object)
9017 : m_result(WTFMove(object))
9018 {
9019 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
9020 }
9021 friend class StackTrace;
9022 public:
9023
9024 Builder<STATE | TimestampSet>& setTimestamp(double value)
9025 {
9026 COMPILE_ASSERT(!(STATE & TimestampSet), property_timestamp_already_set);
9027 m_result->setDouble("timestamp"_s, value);
9028 return castState<TimestampSet>();
9029 }
9030
9031 Builder<STATE | StackFramesSet>& setStackFrames(RefPtr<JSON::ArrayOf<Inspector::Protocol::ScriptProfiler::StackFrame>> value)
9032 {
9033 COMPILE_ASSERT(!(STATE & StackFramesSet), property_stackFrames_already_set);
9034 m_result->setArray("stackFrames"_s, value);
9035 return castState<StackFramesSet>();
9036 }
9037
9038 Ref<StackTrace> release()
9039 {
9040 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
9041 COMPILE_ASSERT(sizeof(StackTrace) == sizeof(JSON::Object), cannot_cast);
9042
9043 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
9044 auto result = WTFMove(*reinterpret_cast<Ref<StackTrace>*>(&jsonResult));
9045 return result;
9046 }
9047 };
9048
9049 /*
9050 * Synthetic constructor:
9051 * Ref<StackTrace> result = StackTrace::create()
9052 * .setTimestamp(...)
9053 * .setStackFrames(...)
9054 * .release();
9055 */
9056 static Builder<NoFieldsSet> create()
9057 {
9058 return Builder<NoFieldsSet>(JSON::Object::create());
9059 }
9060};
9061
9062class Samples : public JSON::ObjectBase {
9063public:
9064 enum {
9065 NoFieldsSet = 0,
9066 StackTracesSet = 1 << 0,
9067 AllFieldsSet = (StackTracesSet)
9068 };
9069
9070 template<int STATE>
9071 class Builder {
9072 private:
9073 RefPtr<JSON::Object> m_result;
9074
9075 template<int STEP> Builder<STATE | STEP>& castState()
9076 {
9077 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
9078 }
9079
9080 Builder(Ref</*Samples*/JSON::Object>&& object)
9081 : m_result(WTFMove(object))
9082 {
9083 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
9084 }
9085 friend class Samples;
9086 public:
9087
9088 Builder<STATE | StackTracesSet>& setStackTraces(RefPtr<JSON::ArrayOf<Inspector::Protocol::ScriptProfiler::StackTrace>> value)
9089 {
9090 COMPILE_ASSERT(!(STATE & StackTracesSet), property_stackTraces_already_set);
9091 m_result->setArray("stackTraces"_s, value);
9092 return castState<StackTracesSet>();
9093 }
9094
9095 Ref<Samples> release()
9096 {
9097 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
9098 COMPILE_ASSERT(sizeof(Samples) == sizeof(JSON::Object), cannot_cast);
9099
9100 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
9101 auto result = WTFMove(*reinterpret_cast<Ref<Samples>*>(&jsonResult));
9102 return result;
9103 }
9104 };
9105
9106 /*
9107 * Synthetic constructor:
9108 * Ref<Samples> result = Samples::create()
9109 * .setStackTraces(...)
9110 * .release();
9111 */
9112 static Builder<NoFieldsSet> create()
9113 {
9114 return Builder<NoFieldsSet>(JSON::Object::create());
9115 }
9116};
9117
9118} // ScriptProfiler
9119
9120namespace Security {
9121/* Information about a SSL connection to display in the frontend. */
9122class Connection : public JSON::ObjectBase {
9123public:
9124 enum {
9125 NoFieldsSet = 0,
9126 AllFieldsSet = 0
9127 };
9128
9129 template<int STATE>
9130 class Builder {
9131 private:
9132 RefPtr<JSON::Object> m_result;
9133
9134 template<int STEP> Builder<STATE | STEP>& castState()
9135 {
9136 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
9137 }
9138
9139 Builder(Ref</*Connection*/JSON::Object>&& object)
9140 : m_result(WTFMove(object))
9141 {
9142 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
9143 }
9144 friend class Connection;
9145 public:
9146
9147 Ref<Connection> release()
9148 {
9149 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
9150 COMPILE_ASSERT(sizeof(Connection) == sizeof(JSON::Object), cannot_cast);
9151
9152 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
9153 auto result = WTFMove(*reinterpret_cast<Ref<Connection>*>(&jsonResult));
9154 return result;
9155 }
9156 };
9157
9158 /*
9159 * Synthetic constructor:
9160 * Ref<Connection> result = Connection::create()
9161 * .release();
9162 */
9163 static Builder<NoFieldsSet> create()
9164 {
9165 return Builder<NoFieldsSet>(JSON::Object::create());
9166 }
9167
9168 void setProtocol(const String& value)
9169 {
9170 JSON::ObjectBase::setString("protocol"_s, value);
9171 }
9172
9173 void setCipher(const String& value)
9174 {
9175 JSON::ObjectBase::setString("cipher"_s, value);
9176 }
9177};
9178
9179/* Information about a SSL certificate to display in the frontend. */
9180class Certificate : public JSON::ObjectBase {
9181public:
9182 enum {
9183 NoFieldsSet = 0,
9184 AllFieldsSet = 0
9185 };
9186
9187 template<int STATE>
9188 class Builder {
9189 private:
9190 RefPtr<JSON::Object> m_result;
9191
9192 template<int STEP> Builder<STATE | STEP>& castState()
9193 {
9194 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
9195 }
9196
9197 Builder(Ref</*Certificate*/JSON::Object>&& object)
9198 : m_result(WTFMove(object))
9199 {
9200 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
9201 }
9202 friend class Certificate;
9203 public:
9204
9205 Ref<Certificate> release()
9206 {
9207 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
9208 COMPILE_ASSERT(sizeof(Certificate) == sizeof(JSON::Object), cannot_cast);
9209
9210 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
9211 auto result = WTFMove(*reinterpret_cast<Ref<Certificate>*>(&jsonResult));
9212 return result;
9213 }
9214 };
9215
9216 /*
9217 * Synthetic constructor:
9218 * Ref<Certificate> result = Certificate::create()
9219 * .release();
9220 */
9221 static Builder<NoFieldsSet> create()
9222 {
9223 return Builder<NoFieldsSet>(JSON::Object::create());
9224 }
9225
9226 void setSubject(const String& value)
9227 {
9228 JSON::ObjectBase::setString("subject"_s, value);
9229 }
9230
9231 void setValidFrom(double value)
9232 {
9233 JSON::ObjectBase::setDouble("validFrom"_s, value);
9234 }
9235
9236 void setValidUntil(double value)
9237 {
9238 JSON::ObjectBase::setDouble("validUntil"_s, value);
9239 }
9240
9241 void setDnsNames(RefPtr<JSON::ArrayOf<String>> value)
9242 {
9243 JSON::ObjectBase::setArray("dnsNames"_s, WTFMove(value));
9244 }
9245
9246 void setIpAddresses(RefPtr<JSON::ArrayOf<String>> value)
9247 {
9248 JSON::ObjectBase::setArray("ipAddresses"_s, WTFMove(value));
9249 }
9250};
9251
9252/* Security information for a given Network.Response. */
9253class Security : public JSON::ObjectBase {
9254public:
9255 enum {
9256 NoFieldsSet = 0,
9257 AllFieldsSet = 0
9258 };
9259
9260 template<int STATE>
9261 class Builder {
9262 private:
9263 RefPtr<JSON::Object> m_result;
9264
9265 template<int STEP> Builder<STATE | STEP>& castState()
9266 {
9267 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
9268 }
9269
9270 Builder(Ref</*Security*/JSON::Object>&& object)
9271 : m_result(WTFMove(object))
9272 {
9273 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
9274 }
9275 friend class Security;
9276 public:
9277
9278 Ref<Security> release()
9279 {
9280 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
9281 COMPILE_ASSERT(sizeof(Security) == sizeof(JSON::Object), cannot_cast);
9282
9283 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
9284 auto result = WTFMove(*reinterpret_cast<Ref<Security>*>(&jsonResult));
9285 return result;
9286 }
9287 };
9288
9289 /*
9290 * Synthetic constructor:
9291 * Ref<Security> result = Security::create()
9292 * .release();
9293 */
9294 static Builder<NoFieldsSet> create()
9295 {
9296 return Builder<NoFieldsSet>(JSON::Object::create());
9297 }
9298
9299 void setConnection(RefPtr<Inspector::Protocol::Security::Connection> value)
9300 {
9301 JSON::ObjectBase::setObject("connection"_s, WTFMove(value));
9302 }
9303
9304 void setCertificate(RefPtr<Inspector::Protocol::Security::Certificate> value)
9305 {
9306 JSON::ObjectBase::setObject("certificate"_s, WTFMove(value));
9307 }
9308};
9309
9310} // Security
9311
9312namespace Target {
9313/* Description of a target. */
9314class TargetInfo : public JSON::ObjectBase {
9315public:
9316 // Named after property name 'type' while generating TargetInfo.
9317 enum class Type {
9318 JavaScript = 35,
9319 Page = 81,
9320 Worker = 177,
9321 ServiceWorker = 178,
9322 }; // enum class Type
9323 enum {
9324 NoFieldsSet = 0,
9325 TargetIdSet = 1 << 0,
9326 TypeSet = 1 << 1,
9327 AllFieldsSet = (TargetIdSet | TypeSet)
9328 };
9329
9330 template<int STATE>
9331 class Builder {
9332 private:
9333 RefPtr<JSON::Object> m_result;
9334
9335 template<int STEP> Builder<STATE | STEP>& castState()
9336 {
9337 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
9338 }
9339
9340 Builder(Ref</*TargetInfo*/JSON::Object>&& object)
9341 : m_result(WTFMove(object))
9342 {
9343 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
9344 }
9345 friend class TargetInfo;
9346 public:
9347
9348 Builder<STATE | TargetIdSet>& setTargetId(const String& value)
9349 {
9350 COMPILE_ASSERT(!(STATE & TargetIdSet), property_targetId_already_set);
9351 m_result->setString("targetId"_s, value);
9352 return castState<TargetIdSet>();
9353 }
9354
9355 Builder<STATE | TypeSet>& setType(Type value)
9356 {
9357 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
9358 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
9359 return castState<TypeSet>();
9360 }
9361
9362 Ref<TargetInfo> release()
9363 {
9364 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
9365 COMPILE_ASSERT(sizeof(TargetInfo) == sizeof(JSON::Object), cannot_cast);
9366
9367 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
9368 auto result = WTFMove(*reinterpret_cast<Ref<TargetInfo>*>(&jsonResult));
9369 return result;
9370 }
9371 };
9372
9373 /*
9374 * Synthetic constructor:
9375 * Ref<TargetInfo> result = TargetInfo::create()
9376 * .setTargetId(...)
9377 * .setType(...)
9378 * .release();
9379 */
9380 static Builder<NoFieldsSet> create()
9381 {
9382 return Builder<NoFieldsSet>(JSON::Object::create());
9383 }
9384};
9385
9386} // Target
9387
9388namespace Timeline {
9389/* Timeline record type. */
9390enum class EventType {
9391 EventDispatch = 179,
9392 ScheduleStyleRecalculation = 180,
9393 RecalculateStyles = 181,
9394 InvalidateLayout = 182,
9395 Layout = 183,
9396 Paint = 184,
9397 Composite = 185,
9398 RenderingFrame = 186,
9399 TimerInstall = 187,
9400 TimerRemove = 188,
9401 TimerFire = 189,
9402 EvaluateScript = 190,
9403 TimeStamp = 191,
9404 Time = 192,
9405 TimeEnd = 193,
9406 FunctionCall = 194,
9407 ProbeSample = 195,
9408 ConsoleProfile = 196,
9409 RequestAnimationFrame = 197,
9410 CancelAnimationFrame = 198,
9411 FireAnimationFrame = 199,
9412 ObserverCallback = 200,
9413}; // enum class EventType
9414/* Instrument types. */
9415enum class Instrument {
9416 ScriptProfiler = 201,
9417 Timeline = 202,
9418 CPU = 203,
9419 Memory = 204,
9420 Heap = 205,
9421}; // enum class Instrument
9422/* Timeline record contains information about the recorded activity. */
9423class TimelineEvent : public JSON::Object {
9424public:
9425 enum {
9426 NoFieldsSet = 0,
9427 TypeSet = 1 << 0,
9428 DataSet = 1 << 1,
9429 AllFieldsSet = (TypeSet | DataSet)
9430 };
9431
9432 template<int STATE>
9433 class Builder {
9434 private:
9435 RefPtr<JSON::Object> m_result;
9436
9437 template<int STEP> Builder<STATE | STEP>& castState()
9438 {
9439 return *reinterpret_cast<Builder<STATE | STEP>*>(this);
9440 }
9441
9442 Builder(Ref</*TimelineEvent*/JSON::Object>&& object)
9443 : m_result(WTFMove(object))
9444 {
9445 COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
9446 }
9447 friend class TimelineEvent;
9448 public:
9449
9450 Builder<STATE | TypeSet>& setType(Inspector::Protocol::Timeline::EventType value)
9451 {
9452 COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
9453 m_result->setString("type"_s, Inspector::Protocol::InspectorHelpers::getEnumConstantValue(value));
9454 return castState<TypeSet>();
9455 }
9456
9457 Builder<STATE | DataSet>& setData(RefPtr<JSON::Object> value)
9458 {
9459 COMPILE_ASSERT(!(STATE & DataSet), property_data_already_set);
9460 m_result->setObject("data"_s, value);
9461 return castState<DataSet>();
9462 }
9463
9464 Ref<TimelineEvent> release()
9465 {
9466 COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
9467 COMPILE_ASSERT(sizeof(TimelineEvent) == sizeof(JSON::Object), cannot_cast);
9468
9469 Ref<JSON::Object> jsonResult = m_result.releaseNonNull();
9470 auto result = WTFMove(*reinterpret_cast<Ref<TimelineEvent>*>(&jsonResult));
9471 return result;
9472 }
9473 };
9474
9475 /*
9476 * Synthetic constructor:
9477 * Ref<TimelineEvent> result = TimelineEvent::create()
9478 * .setType(...)
9479 * .setData(...)
9480 * .release();
9481 */
9482 static Builder<NoFieldsSet> create()
9483 {
9484 return Builder<NoFieldsSet>(JSON::Object::create());
9485 }
9486
9487 void setChildren(RefPtr<JSON::ArrayOf<Inspector::Protocol::Timeline::TimelineEvent>> value)
9488 {
9489 JSON::ObjectBase::setArray("children"_s, WTFMove(value));
9490 }
9491
9492 // Property names for type generated as open.
9493 JS_EXPORT_PRIVATE static const char* Type;
9494 JS_EXPORT_PRIVATE static const char* Data;
9495 JS_EXPORT_PRIVATE static const char* Children;
9496};
9497
9498} // Timeline
9499
9500template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Debugger::Location> {
9501static void assertValueHasExpectedType(JSON::Value*);
9502};
9503template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Debugger::FunctionDetails> {
9504static RefPtr<Inspector::Protocol::Debugger::FunctionDetails> runtimeCast(RefPtr<JSON::Value>&& value);
9505static void assertValueHasExpectedType(JSON::Value*);
9506};
9507template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Debugger::CallFrame> {
9508static RefPtr<Inspector::Protocol::Debugger::CallFrame> runtimeCast(RefPtr<JSON::Value>&& value);
9509static void assertValueHasExpectedType(JSON::Value*);
9510};
9511template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Debugger::Scope::Type> {
9512static void assertValueHasExpectedType(JSON::Value*);
9513};
9514template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Debugger::Scope> {
9515static void assertValueHasExpectedType(JSON::Value*);
9516};
9517template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Runtime::RemoteObject::Type> {
9518static void assertValueHasExpectedType(JSON::Value*);
9519};
9520template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Runtime::RemoteObject::Subtype> {
9521static void assertValueHasExpectedType(JSON::Value*);
9522};
9523template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Runtime::RemoteObject> {
9524static RefPtr<Inspector::Protocol::Runtime::RemoteObject> runtimeCast(RefPtr<JSON::Value>&& value);
9525static void assertValueHasExpectedType(JSON::Value*);
9526};
9527template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Runtime::ObjectPreview::Type> {
9528static void assertValueHasExpectedType(JSON::Value*);
9529};
9530template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Runtime::ObjectPreview::Subtype> {
9531static void assertValueHasExpectedType(JSON::Value*);
9532};
9533template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Runtime::ObjectPreview> {
9534static RefPtr<Inspector::Protocol::Runtime::ObjectPreview> runtimeCast(RefPtr<JSON::Value>&& value);
9535static void assertValueHasExpectedType(JSON::Value*);
9536};
9537template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Runtime::PropertyPreview::Type> {
9538static void assertValueHasExpectedType(JSON::Value*);
9539};
9540template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Runtime::PropertyPreview::Subtype> {
9541static void assertValueHasExpectedType(JSON::Value*);
9542};
9543template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Runtime::PropertyPreview> {
9544static void assertValueHasExpectedType(JSON::Value*);
9545};
9546template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Runtime::EntryPreview> {
9547static void assertValueHasExpectedType(JSON::Value*);
9548};
9549template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Runtime::CollectionEntry> {
9550static RefPtr<Inspector::Protocol::Runtime::CollectionEntry> runtimeCast(RefPtr<JSON::Value>&& value);
9551static void assertValueHasExpectedType(JSON::Value*);
9552};
9553template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Runtime::PropertyDescriptor> {
9554static RefPtr<Inspector::Protocol::Runtime::PropertyDescriptor> runtimeCast(RefPtr<JSON::Value>&& value);
9555static void assertValueHasExpectedType(JSON::Value*);
9556};
9557template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Runtime::InternalPropertyDescriptor> {
9558static RefPtr<Inspector::Protocol::Runtime::InternalPropertyDescriptor> runtimeCast(RefPtr<JSON::Value>&& value);
9559static void assertValueHasExpectedType(JSON::Value*);
9560};
9561template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Timeline::EventType> {
9562static void assertValueHasExpectedType(JSON::Value*);
9563};
9564template<> struct JS_EXPORT_PRIVATE BindingTraits<Inspector::Protocol::Timeline::TimelineEvent> {
9565static RefPtr<Inspector::Protocol::Timeline::TimelineEvent> runtimeCast(RefPtr<JSON::Value>&& value);
9566static void assertValueHasExpectedType(JSON::Value*);
9567};
9568
9569namespace InspectorHelpers {
9570
9571template<typename ProtocolEnumType>
9572Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
9573
9574#if ENABLE(RESOURCE_USAGE)
9575// Enums in the 'CPUProfiler' Domain
9576template<>
9577JS_EXPORT_PRIVATE Optional<Inspector::Protocol::CPUProfiler::ThreadInfo::Type> parseEnumValueFromString<Inspector::Protocol::CPUProfiler::ThreadInfo::Type>(const String&);
9578#endif // ENABLE(RESOURCE_USAGE)
9579
9580// Enums in the 'CSS' Domain
9581template<>
9582JS_EXPORT_PRIVATE Optional<Inspector::Protocol::CSS::StyleSheetOrigin> parseEnumValueFromString<Inspector::Protocol::CSS::StyleSheetOrigin>(const String&);
9583template<>
9584JS_EXPORT_PRIVATE Optional<Inspector::Protocol::CSS::PseudoId> parseEnumValueFromString<Inspector::Protocol::CSS::PseudoId>(const String&);
9585template<>
9586JS_EXPORT_PRIVATE Optional<Inspector::Protocol::CSS::CSSPropertyStatus> parseEnumValueFromString<Inspector::Protocol::CSS::CSSPropertyStatus>(const String&);
9587template<>
9588JS_EXPORT_PRIVATE Optional<Inspector::Protocol::CSS::CSSMedia::Source> parseEnumValueFromString<Inspector::Protocol::CSS::CSSMedia::Source>(const String&);
9589
9590// Enums in the 'Canvas' Domain
9591template<>
9592JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Canvas::ContextType> parseEnumValueFromString<Inspector::Protocol::Canvas::ContextType>(const String&);
9593template<>
9594JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Canvas::ShaderType> parseEnumValueFromString<Inspector::Protocol::Canvas::ShaderType>(const String&);
9595
9596// Enums in the 'Console' Domain
9597template<>
9598JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Console::ChannelSource> parseEnumValueFromString<Inspector::Protocol::Console::ChannelSource>(const String&);
9599template<>
9600JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Console::ChannelLevel> parseEnumValueFromString<Inspector::Protocol::Console::ChannelLevel>(const String&);
9601template<>
9602JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Console::ConsoleMessage::Level> parseEnumValueFromString<Inspector::Protocol::Console::ConsoleMessage::Level>(const String&);
9603template<>
9604JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Console::ConsoleMessage::Type> parseEnumValueFromString<Inspector::Protocol::Console::ConsoleMessage::Type>(const String&);
9605
9606// Enums in the 'DOM' Domain
9607template<>
9608JS_EXPORT_PRIVATE Optional<Inspector::Protocol::DOM::PseudoType> parseEnumValueFromString<Inspector::Protocol::DOM::PseudoType>(const String&);
9609template<>
9610JS_EXPORT_PRIVATE Optional<Inspector::Protocol::DOM::ShadowRootType> parseEnumValueFromString<Inspector::Protocol::DOM::ShadowRootType>(const String&);
9611template<>
9612JS_EXPORT_PRIVATE Optional<Inspector::Protocol::DOM::CustomElementState> parseEnumValueFromString<Inspector::Protocol::DOM::CustomElementState>(const String&);
9613template<>
9614JS_EXPORT_PRIVATE Optional<Inspector::Protocol::DOM::LiveRegionRelevant> parseEnumValueFromString<Inspector::Protocol::DOM::LiveRegionRelevant>(const String&);
9615template<>
9616JS_EXPORT_PRIVATE Optional<Inspector::Protocol::DOM::AccessibilityProperties::Checked> parseEnumValueFromString<Inspector::Protocol::DOM::AccessibilityProperties::Checked>(const String&);
9617template<>
9618JS_EXPORT_PRIVATE Optional<Inspector::Protocol::DOM::AccessibilityProperties::Current> parseEnumValueFromString<Inspector::Protocol::DOM::AccessibilityProperties::Current>(const String&);
9619template<>
9620JS_EXPORT_PRIVATE Optional<Inspector::Protocol::DOM::AccessibilityProperties::Invalid> parseEnumValueFromString<Inspector::Protocol::DOM::AccessibilityProperties::Invalid>(const String&);
9621template<>
9622JS_EXPORT_PRIVATE Optional<Inspector::Protocol::DOM::AccessibilityProperties::LiveRegionStatus> parseEnumValueFromString<Inspector::Protocol::DOM::AccessibilityProperties::LiveRegionStatus>(const String&);
9623
9624// Enums in the 'DOMDebugger' Domain
9625template<>
9626JS_EXPORT_PRIVATE Optional<Inspector::Protocol::DOMDebugger::DOMBreakpointType> parseEnumValueFromString<Inspector::Protocol::DOMDebugger::DOMBreakpointType>(const String&);
9627template<>
9628JS_EXPORT_PRIVATE Optional<Inspector::Protocol::DOMDebugger::EventBreakpointType> parseEnumValueFromString<Inspector::Protocol::DOMDebugger::EventBreakpointType>(const String&);
9629
9630// Enums in the 'Debugger' Domain
9631template<>
9632JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Debugger::BreakpointAction::Type> parseEnumValueFromString<Inspector::Protocol::Debugger::BreakpointAction::Type>(const String&);
9633template<>
9634JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Debugger::Scope::Type> parseEnumValueFromString<Inspector::Protocol::Debugger::Scope::Type>(const String&);
9635
9636// Enums in the 'Heap' Domain
9637template<>
9638JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Heap::GarbageCollection::Type> parseEnumValueFromString<Inspector::Protocol::Heap::GarbageCollection::Type>(const String&);
9639
9640#if ENABLE(INDEXED_DATABASE)
9641// Enums in the 'IndexedDB' Domain
9642template<>
9643JS_EXPORT_PRIVATE Optional<Inspector::Protocol::IndexedDB::Key::Type> parseEnumValueFromString<Inspector::Protocol::IndexedDB::Key::Type>(const String&);
9644template<>
9645JS_EXPORT_PRIVATE Optional<Inspector::Protocol::IndexedDB::KeyPath::Type> parseEnumValueFromString<Inspector::Protocol::IndexedDB::KeyPath::Type>(const String&);
9646#endif // ENABLE(INDEXED_DATABASE)
9647
9648#if ENABLE(RESOURCE_USAGE)
9649// Enums in the 'Memory' Domain
9650template<>
9651JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Memory::CategoryData::Type> parseEnumValueFromString<Inspector::Protocol::Memory::CategoryData::Type>(const String&);
9652#endif // ENABLE(RESOURCE_USAGE)
9653
9654// Enums in the 'Network' Domain
9655template<>
9656JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Network::Response::Source> parseEnumValueFromString<Inspector::Protocol::Network::Response::Source>(const String&);
9657template<>
9658JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Network::Metrics::Priority> parseEnumValueFromString<Inspector::Protocol::Network::Metrics::Priority>(const String&);
9659template<>
9660JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Network::Initiator::Type> parseEnumValueFromString<Inspector::Protocol::Network::Initiator::Type>(const String&);
9661
9662// Enums in the 'Page' Domain
9663template<>
9664JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Page::Setting> parseEnumValueFromString<Inspector::Protocol::Page::Setting>(const String&);
9665template<>
9666JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Page::ResourceType> parseEnumValueFromString<Inspector::Protocol::Page::ResourceType>(const String&);
9667template<>
9668JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Page::CoordinateSystem> parseEnumValueFromString<Inspector::Protocol::Page::CoordinateSystem>(const String&);
9669template<>
9670JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Page::CookieSameSitePolicy> parseEnumValueFromString<Inspector::Protocol::Page::CookieSameSitePolicy>(const String&);
9671template<>
9672JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Page::Appearance> parseEnumValueFromString<Inspector::Protocol::Page::Appearance>(const String&);
9673
9674// Enums in the 'Recording' Domain
9675template<>
9676JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Recording::Type> parseEnumValueFromString<Inspector::Protocol::Recording::Type>(const String&);
9677template<>
9678JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Recording::Initiator> parseEnumValueFromString<Inspector::Protocol::Recording::Initiator>(const String&);
9679
9680// Enums in the 'Runtime' Domain
9681template<>
9682JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Runtime::SyntaxErrorType> parseEnumValueFromString<Inspector::Protocol::Runtime::SyntaxErrorType>(const String&);
9683template<>
9684JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Runtime::RemoteObject::Type> parseEnumValueFromString<Inspector::Protocol::Runtime::RemoteObject::Type>(const String&);
9685template<>
9686JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Runtime::RemoteObject::Subtype> parseEnumValueFromString<Inspector::Protocol::Runtime::RemoteObject::Subtype>(const String&);
9687template<>
9688JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Runtime::ObjectPreview::Type> parseEnumValueFromString<Inspector::Protocol::Runtime::ObjectPreview::Type>(const String&);
9689template<>
9690JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Runtime::ObjectPreview::Subtype> parseEnumValueFromString<Inspector::Protocol::Runtime::ObjectPreview::Subtype>(const String&);
9691template<>
9692JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Runtime::PropertyPreview::Type> parseEnumValueFromString<Inspector::Protocol::Runtime::PropertyPreview::Type>(const String&);
9693template<>
9694JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Runtime::PropertyPreview::Subtype> parseEnumValueFromString<Inspector::Protocol::Runtime::PropertyPreview::Subtype>(const String&);
9695
9696// Enums in the 'ScriptProfiler' Domain
9697template<>
9698JS_EXPORT_PRIVATE Optional<Inspector::Protocol::ScriptProfiler::EventType> parseEnumValueFromString<Inspector::Protocol::ScriptProfiler::EventType>(const String&);
9699
9700// Enums in the 'Target' Domain
9701template<>
9702JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Target::TargetInfo::Type> parseEnumValueFromString<Inspector::Protocol::Target::TargetInfo::Type>(const String&);
9703
9704// Enums in the 'Timeline' Domain
9705template<>
9706JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Timeline::EventType> parseEnumValueFromString<Inspector::Protocol::Timeline::EventType>(const String&);
9707template<>
9708JS_EXPORT_PRIVATE Optional<Inspector::Protocol::Timeline::Instrument> parseEnumValueFromString<Inspector::Protocol::Timeline::Instrument>(const String&);
9709
9710} // namespace InspectorHelpers
9711
9712} // namespace Protocol
9713
9714} // namespace Inspector
9715
9716namespace WTF {
9717
9718template<typename T> struct DefaultHash;
9719
9720// Hash declarations in the 'CSS' Domain
9721template<>
9722struct DefaultHash<Inspector::Protocol::CSS::StyleSheetOrigin> {
9723 typedef IntHash<Inspector::Protocol::CSS::StyleSheetOrigin> Hash;
9724};
9725template<>
9726struct DefaultHash<Inspector::Protocol::CSS::PseudoId> {
9727 typedef IntHash<Inspector::Protocol::CSS::PseudoId> Hash;
9728};
9729template<>
9730struct DefaultHash<Inspector::Protocol::CSS::CSSPropertyStatus> {
9731 typedef IntHash<Inspector::Protocol::CSS::CSSPropertyStatus> Hash;
9732};
9733
9734// Hash declarations in the 'Canvas' Domain
9735template<>
9736struct DefaultHash<Inspector::Protocol::Canvas::ContextType> {
9737 typedef IntHash<Inspector::Protocol::Canvas::ContextType> Hash;
9738};
9739template<>
9740struct DefaultHash<Inspector::Protocol::Canvas::ShaderType> {
9741 typedef IntHash<Inspector::Protocol::Canvas::ShaderType> Hash;
9742};
9743
9744// Hash declarations in the 'Console' Domain
9745template<>
9746struct DefaultHash<Inspector::Protocol::Console::ChannelSource> {
9747 typedef IntHash<Inspector::Protocol::Console::ChannelSource> Hash;
9748};
9749template<>
9750struct DefaultHash<Inspector::Protocol::Console::ChannelLevel> {
9751 typedef IntHash<Inspector::Protocol::Console::ChannelLevel> Hash;
9752};
9753
9754// Hash declarations in the 'DOM' Domain
9755template<>
9756struct DefaultHash<Inspector::Protocol::DOM::PseudoType> {
9757 typedef IntHash<Inspector::Protocol::DOM::PseudoType> Hash;
9758};
9759template<>
9760struct DefaultHash<Inspector::Protocol::DOM::ShadowRootType> {
9761 typedef IntHash<Inspector::Protocol::DOM::ShadowRootType> Hash;
9762};
9763template<>
9764struct DefaultHash<Inspector::Protocol::DOM::CustomElementState> {
9765 typedef IntHash<Inspector::Protocol::DOM::CustomElementState> Hash;
9766};
9767template<>
9768struct DefaultHash<Inspector::Protocol::DOM::LiveRegionRelevant> {
9769 typedef IntHash<Inspector::Protocol::DOM::LiveRegionRelevant> Hash;
9770};
9771
9772// Hash declarations in the 'DOMDebugger' Domain
9773template<>
9774struct DefaultHash<Inspector::Protocol::DOMDebugger::DOMBreakpointType> {
9775 typedef IntHash<Inspector::Protocol::DOMDebugger::DOMBreakpointType> Hash;
9776};
9777template<>
9778struct DefaultHash<Inspector::Protocol::DOMDebugger::EventBreakpointType> {
9779 typedef IntHash<Inspector::Protocol::DOMDebugger::EventBreakpointType> Hash;
9780};
9781
9782// Hash declarations in the 'Page' Domain
9783template<>
9784struct DefaultHash<Inspector::Protocol::Page::Setting> {
9785 typedef IntHash<Inspector::Protocol::Page::Setting> Hash;
9786};
9787template<>
9788struct DefaultHash<Inspector::Protocol::Page::ResourceType> {
9789 typedef IntHash<Inspector::Protocol::Page::ResourceType> Hash;
9790};
9791template<>
9792struct DefaultHash<Inspector::Protocol::Page::CoordinateSystem> {
9793 typedef IntHash<Inspector::Protocol::Page::CoordinateSystem> Hash;
9794};
9795template<>
9796struct DefaultHash<Inspector::Protocol::Page::CookieSameSitePolicy> {
9797 typedef IntHash<Inspector::Protocol::Page::CookieSameSitePolicy> Hash;
9798};
9799template<>
9800struct DefaultHash<Inspector::Protocol::Page::Appearance> {
9801 typedef IntHash<Inspector::Protocol::Page::Appearance> Hash;
9802};
9803
9804// Hash declarations in the 'Recording' Domain
9805template<>
9806struct DefaultHash<Inspector::Protocol::Recording::Type> {
9807 typedef IntHash<Inspector::Protocol::Recording::Type> Hash;
9808};
9809template<>
9810struct DefaultHash<Inspector::Protocol::Recording::Initiator> {
9811 typedef IntHash<Inspector::Protocol::Recording::Initiator> Hash;
9812};
9813
9814// Hash declarations in the 'Runtime' Domain
9815template<>
9816struct DefaultHash<Inspector::Protocol::Runtime::SyntaxErrorType> {
9817 typedef IntHash<Inspector::Protocol::Runtime::SyntaxErrorType> Hash;
9818};
9819
9820// Hash declarations in the 'ScriptProfiler' Domain
9821template<>
9822struct DefaultHash<Inspector::Protocol::ScriptProfiler::EventType> {
9823 typedef IntHash<Inspector::Protocol::ScriptProfiler::EventType> Hash;
9824};
9825
9826// Hash declarations in the 'Timeline' Domain
9827template<>
9828struct DefaultHash<Inspector::Protocol::Timeline::EventType> {
9829 typedef IntHash<Inspector::Protocol::Timeline::EventType> Hash;
9830};
9831template<>
9832struct DefaultHash<Inspector::Protocol::Timeline::Instrument> {
9833 typedef IntHash<Inspector::Protocol::Timeline::Instrument> Hash;
9834};
9835
9836} // namespace WTF
9837