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#include "config.h"
32#include "InspectorProtocolObjects.h"
33
34#include <wtf/Optional.h>
35#include <wtf/text/CString.h>
36
37namespace Inspector {
38
39namespace Protocol {
40
41namespace InspectorHelpers {
42
43static const char* const enum_constant_values[] = {
44 "main",
45 "webkit",
46 "user",
47 "user-agent",
48 "inspector",
49 "regular",
50 "first-line",
51 "first-letter",
52 "marker",
53 "before",
54 "after",
55 "selection",
56 "scrollbar",
57 "scrollbar-thumb",
58 "scrollbar-button",
59 "scrollbar-track",
60 "scrollbar-track-piece",
61 "scrollbar-corner",
62 "resizer",
63 "active",
64 "inactive",
65 "disabled",
66 "style",
67 "mediaRule",
68 "importRule",
69 "linkedSheet",
70 "inlineSheet",
71 "canvas-2d",
72 "bitmaprenderer",
73 "webgl",
74 "webgl2",
75 "webgpu",
76 "fragment",
77 "vertex",
78 "xml",
79 "javascript",
80 "network",
81 "console-api",
82 "storage",
83 "appcache",
84 "rendering",
85 "css",
86 "security",
87 "content-blocker",
88 "media",
89 "mediasource",
90 "webrtc",
91 "other",
92 "off",
93 "basic",
94 "verbose",
95 "log",
96 "info",
97 "warning",
98 "error",
99 "debug",
100 "dir",
101 "dirxml",
102 "table",
103 "trace",
104 "clear",
105 "startGroup",
106 "startGroupCollapsed",
107 "endGroup",
108 "assert",
109 "timing",
110 "profile",
111 "profileEnd",
112 "image",
113 "open",
114 "closed",
115 "builtin",
116 "custom",
117 "waiting",
118 "failed",
119 "additions",
120 "removals",
121 "text",
122 "true",
123 "false",
124 "mixed",
125 "page",
126 "step",
127 "location",
128 "date",
129 "time",
130 "grammar",
131 "spelling",
132 "assertive",
133 "polite",
134 "subtree-modified",
135 "attribute-modified",
136 "node-removed",
137 "animation-frame",
138 "listener",
139 "timer",
140 "evaluate",
141 "sound",
142 "probe",
143 "global",
144 "with",
145 "closure",
146 "catch",
147 "functionName",
148 "globalLexicalEnvironment",
149 "nestedLexical",
150 "full",
151 "partial",
152 "number",
153 "string",
154 "array",
155 "null",
156 "jit",
157 "images",
158 "layers",
159 "unknown",
160 "memory-cache",
161 "disk-cache",
162 "service-worker",
163 "low",
164 "medium",
165 "high",
166 "Document",
167 "Stylesheet",
168 "Image",
169 "Font",
170 "Script",
171 "XHR",
172 "Fetch",
173 "Ping",
174 "Beacon",
175 "WebSocket",
176 "Other",
177 "parser",
178 "script",
179 "AuthorAndUserStylesEnabled",
180 "ICECandidateFilteringEnabled",
181 "ImagesEnabled",
182 "MediaCaptureRequiresSecureConnection",
183 "MockCaptureDevicesEnabled",
184 "NeedsSiteSpecificQuirks",
185 "ScriptEnabled",
186 "WebSecurityEnabled",
187 "Viewport",
188 "Page",
189 "None",
190 "Lax",
191 "Strict",
192 "Light",
193 "Dark",
194 "canvas-bitmaprenderer",
195 "canvas-webgl",
196 "canvas-webgl2",
197 "frontend",
198 "console",
199 "auto-capture",
200 "object",
201 "function",
202 "undefined",
203 "boolean",
204 "symbol",
205 "node",
206 "regexp",
207 "map",
208 "set",
209 "weakmap",
210 "weakset",
211 "iterator",
212 "class",
213 "proxy",
214 "accessor",
215 "none",
216 "irrecoverable",
217 "unterminated-literal",
218 "recoverable",
219 "API",
220 "Microtask",
221 "worker",
222 "serviceworker",
223 "EventDispatch",
224 "ScheduleStyleRecalculation",
225 "RecalculateStyles",
226 "InvalidateLayout",
227 "Layout",
228 "Paint",
229 "Composite",
230 "RenderingFrame",
231 "TimerInstall",
232 "TimerRemove",
233 "TimerFire",
234 "EvaluateScript",
235 "TimeStamp",
236 "Time",
237 "TimeEnd",
238 "FunctionCall",
239 "ProbeSample",
240 "ConsoleProfile",
241 "RequestAnimationFrame",
242 "CancelAnimationFrame",
243 "FireAnimationFrame",
244 "ObserverCallback",
245 "ScriptProfiler",
246 "Timeline",
247 "CPU",
248 "Memory",
249 "Heap",
250 "DOM",
251 "AnimationFrame",
252 "EventListener",
253 "Timer",
254 "exception",
255 "CSPViolation",
256 "DebuggerStatement",
257 "Breakpoint",
258 "PauseOnNextStatement",
259 "critical",
260 "non-critical",
261 "uncaught",
262 "all",
263};
264
265String getEnumConstantValue(int code) {
266 return enum_constant_values[code];
267}
268
269#if ENABLE(RESOURCE_USAGE)
270// Enums in the 'CPUProfiler' Domain
271template<>
272Optional<Inspector::Protocol::CPUProfiler::ThreadInfo::Type> parseEnumValueFromString<Inspector::Protocol::CPUProfiler::ThreadInfo::Type>(const String& protocolString)
273{
274 static const size_t constantValues[] = {
275 (size_t)Inspector::Protocol::CPUProfiler::ThreadInfo::Type::Main,
276 (size_t)Inspector::Protocol::CPUProfiler::ThreadInfo::Type::WebKit,
277 };
278 for (size_t i = 0; i < 2; ++i)
279 if (protocolString == enum_constant_values[constantValues[i]])
280 return (Inspector::Protocol::CPUProfiler::ThreadInfo::Type)constantValues[i];
281
282 return WTF::nullopt;
283}
284
285#endif // ENABLE(RESOURCE_USAGE)
286
287// Enums in the 'CSS' Domain
288template<>
289Optional<Inspector::Protocol::CSS::StyleSheetOrigin> parseEnumValueFromString<Inspector::Protocol::CSS::StyleSheetOrigin>(const String& protocolString)
290{
291 static const size_t constantValues[] = {
292 (size_t)Inspector::Protocol::CSS::StyleSheetOrigin::User,
293 (size_t)Inspector::Protocol::CSS::StyleSheetOrigin::UserAgent,
294 (size_t)Inspector::Protocol::CSS::StyleSheetOrigin::Inspector,
295 (size_t)Inspector::Protocol::CSS::StyleSheetOrigin::Regular,
296 };
297 for (size_t i = 0; i < 4; ++i)
298 if (protocolString == enum_constant_values[constantValues[i]])
299 return (Inspector::Protocol::CSS::StyleSheetOrigin)constantValues[i];
300
301 return WTF::nullopt;
302}
303
304template<>
305Optional<Inspector::Protocol::CSS::PseudoId> parseEnumValueFromString<Inspector::Protocol::CSS::PseudoId>(const String& protocolString)
306{
307 static const size_t constantValues[] = {
308 (size_t)Inspector::Protocol::CSS::PseudoId::FirstLine,
309 (size_t)Inspector::Protocol::CSS::PseudoId::FirstLetter,
310 (size_t)Inspector::Protocol::CSS::PseudoId::Marker,
311 (size_t)Inspector::Protocol::CSS::PseudoId::Before,
312 (size_t)Inspector::Protocol::CSS::PseudoId::After,
313 (size_t)Inspector::Protocol::CSS::PseudoId::Selection,
314 (size_t)Inspector::Protocol::CSS::PseudoId::Scrollbar,
315 (size_t)Inspector::Protocol::CSS::PseudoId::ScrollbarThumb,
316 (size_t)Inspector::Protocol::CSS::PseudoId::ScrollbarButton,
317 (size_t)Inspector::Protocol::CSS::PseudoId::ScrollbarTrack,
318 (size_t)Inspector::Protocol::CSS::PseudoId::ScrollbarTrackPiece,
319 (size_t)Inspector::Protocol::CSS::PseudoId::ScrollbarCorner,
320 (size_t)Inspector::Protocol::CSS::PseudoId::Resizer,
321 };
322 for (size_t i = 0; i < 13; ++i)
323 if (protocolString == enum_constant_values[constantValues[i]])
324 return (Inspector::Protocol::CSS::PseudoId)constantValues[i];
325
326 return WTF::nullopt;
327}
328
329template<>
330Optional<Inspector::Protocol::CSS::CSSPropertyStatus> parseEnumValueFromString<Inspector::Protocol::CSS::CSSPropertyStatus>(const String& protocolString)
331{
332 static const size_t constantValues[] = {
333 (size_t)Inspector::Protocol::CSS::CSSPropertyStatus::Active,
334 (size_t)Inspector::Protocol::CSS::CSSPropertyStatus::Inactive,
335 (size_t)Inspector::Protocol::CSS::CSSPropertyStatus::Disabled,
336 (size_t)Inspector::Protocol::CSS::CSSPropertyStatus::Style,
337 };
338 for (size_t i = 0; i < 4; ++i)
339 if (protocolString == enum_constant_values[constantValues[i]])
340 return (Inspector::Protocol::CSS::CSSPropertyStatus)constantValues[i];
341
342 return WTF::nullopt;
343}
344
345template<>
346Optional<Inspector::Protocol::CSS::CSSMedia::Source> parseEnumValueFromString<Inspector::Protocol::CSS::CSSMedia::Source>(const String& protocolString)
347{
348 static const size_t constantValues[] = {
349 (size_t)Inspector::Protocol::CSS::CSSMedia::Source::MediaRule,
350 (size_t)Inspector::Protocol::CSS::CSSMedia::Source::ImportRule,
351 (size_t)Inspector::Protocol::CSS::CSSMedia::Source::LinkedSheet,
352 (size_t)Inspector::Protocol::CSS::CSSMedia::Source::InlineSheet,
353 };
354 for (size_t i = 0; i < 4; ++i)
355 if (protocolString == enum_constant_values[constantValues[i]])
356 return (Inspector::Protocol::CSS::CSSMedia::Source)constantValues[i];
357
358 return WTF::nullopt;
359}
360
361
362// Enums in the 'Canvas' Domain
363template<>
364Optional<Inspector::Protocol::Canvas::ContextType> parseEnumValueFromString<Inspector::Protocol::Canvas::ContextType>(const String& protocolString)
365{
366 static const size_t constantValues[] = {
367 (size_t)Inspector::Protocol::Canvas::ContextType::Canvas2D,
368 (size_t)Inspector::Protocol::Canvas::ContextType::BitmapRenderer,
369 (size_t)Inspector::Protocol::Canvas::ContextType::WebGL,
370 (size_t)Inspector::Protocol::Canvas::ContextType::WebGL2,
371 (size_t)Inspector::Protocol::Canvas::ContextType::WebGPU,
372 };
373 for (size_t i = 0; i < 5; ++i)
374 if (protocolString == enum_constant_values[constantValues[i]])
375 return (Inspector::Protocol::Canvas::ContextType)constantValues[i];
376
377 return WTF::nullopt;
378}
379
380template<>
381Optional<Inspector::Protocol::Canvas::ShaderType> parseEnumValueFromString<Inspector::Protocol::Canvas::ShaderType>(const String& protocolString)
382{
383 static const size_t constantValues[] = {
384 (size_t)Inspector::Protocol::Canvas::ShaderType::Fragment,
385 (size_t)Inspector::Protocol::Canvas::ShaderType::Vertex,
386 };
387 for (size_t i = 0; i < 2; ++i)
388 if (protocolString == enum_constant_values[constantValues[i]])
389 return (Inspector::Protocol::Canvas::ShaderType)constantValues[i];
390
391 return WTF::nullopt;
392}
393
394
395// Enums in the 'Console' Domain
396template<>
397Optional<Inspector::Protocol::Console::ChannelSource> parseEnumValueFromString<Inspector::Protocol::Console::ChannelSource>(const String& protocolString)
398{
399 static const size_t constantValues[] = {
400 (size_t)Inspector::Protocol::Console::ChannelSource::XML,
401 (size_t)Inspector::Protocol::Console::ChannelSource::JavaScript,
402 (size_t)Inspector::Protocol::Console::ChannelSource::Network,
403 (size_t)Inspector::Protocol::Console::ChannelSource::ConsoleAPI,
404 (size_t)Inspector::Protocol::Console::ChannelSource::Storage,
405 (size_t)Inspector::Protocol::Console::ChannelSource::Appcache,
406 (size_t)Inspector::Protocol::Console::ChannelSource::Rendering,
407 (size_t)Inspector::Protocol::Console::ChannelSource::CSS,
408 (size_t)Inspector::Protocol::Console::ChannelSource::Security,
409 (size_t)Inspector::Protocol::Console::ChannelSource::ContentBlocker,
410 (size_t)Inspector::Protocol::Console::ChannelSource::Media,
411 (size_t)Inspector::Protocol::Console::ChannelSource::MediaSource,
412 (size_t)Inspector::Protocol::Console::ChannelSource::WebRTC,
413 (size_t)Inspector::Protocol::Console::ChannelSource::Other,
414 };
415 for (size_t i = 0; i < 14; ++i)
416 if (protocolString == enum_constant_values[constantValues[i]])
417 return (Inspector::Protocol::Console::ChannelSource)constantValues[i];
418
419 return WTF::nullopt;
420}
421
422template<>
423Optional<Inspector::Protocol::Console::ChannelLevel> parseEnumValueFromString<Inspector::Protocol::Console::ChannelLevel>(const String& protocolString)
424{
425 static const size_t constantValues[] = {
426 (size_t)Inspector::Protocol::Console::ChannelLevel::Off,
427 (size_t)Inspector::Protocol::Console::ChannelLevel::Basic,
428 (size_t)Inspector::Protocol::Console::ChannelLevel::Verbose,
429 };
430 for (size_t i = 0; i < 3; ++i)
431 if (protocolString == enum_constant_values[constantValues[i]])
432 return (Inspector::Protocol::Console::ChannelLevel)constantValues[i];
433
434 return WTF::nullopt;
435}
436
437template<>
438Optional<Inspector::Protocol::Console::ConsoleMessage::Level> parseEnumValueFromString<Inspector::Protocol::Console::ConsoleMessage::Level>(const String& protocolString)
439{
440 static const size_t constantValues[] = {
441 (size_t)Inspector::Protocol::Console::ConsoleMessage::Level::Log,
442 (size_t)Inspector::Protocol::Console::ConsoleMessage::Level::Info,
443 (size_t)Inspector::Protocol::Console::ConsoleMessage::Level::Warning,
444 (size_t)Inspector::Protocol::Console::ConsoleMessage::Level::Error,
445 (size_t)Inspector::Protocol::Console::ConsoleMessage::Level::Debug,
446 };
447 for (size_t i = 0; i < 5; ++i)
448 if (protocolString == enum_constant_values[constantValues[i]])
449 return (Inspector::Protocol::Console::ConsoleMessage::Level)constantValues[i];
450
451 return WTF::nullopt;
452}
453
454template<>
455Optional<Inspector::Protocol::Console::ConsoleMessage::Type> parseEnumValueFromString<Inspector::Protocol::Console::ConsoleMessage::Type>(const String& protocolString)
456{
457 static const size_t constantValues[] = {
458 (size_t)Inspector::Protocol::Console::ConsoleMessage::Type::Log,
459 (size_t)Inspector::Protocol::Console::ConsoleMessage::Type::Dir,
460 (size_t)Inspector::Protocol::Console::ConsoleMessage::Type::DirXML,
461 (size_t)Inspector::Protocol::Console::ConsoleMessage::Type::Table,
462 (size_t)Inspector::Protocol::Console::ConsoleMessage::Type::Trace,
463 (size_t)Inspector::Protocol::Console::ConsoleMessage::Type::Clear,
464 (size_t)Inspector::Protocol::Console::ConsoleMessage::Type::StartGroup,
465 (size_t)Inspector::Protocol::Console::ConsoleMessage::Type::StartGroupCollapsed,
466 (size_t)Inspector::Protocol::Console::ConsoleMessage::Type::EndGroup,
467 (size_t)Inspector::Protocol::Console::ConsoleMessage::Type::Assert,
468 (size_t)Inspector::Protocol::Console::ConsoleMessage::Type::Timing,
469 (size_t)Inspector::Protocol::Console::ConsoleMessage::Type::Profile,
470 (size_t)Inspector::Protocol::Console::ConsoleMessage::Type::ProfileEnd,
471 (size_t)Inspector::Protocol::Console::ConsoleMessage::Type::Image,
472 };
473 for (size_t i = 0; i < 14; ++i)
474 if (protocolString == enum_constant_values[constantValues[i]])
475 return (Inspector::Protocol::Console::ConsoleMessage::Type)constantValues[i];
476
477 return WTF::nullopt;
478}
479
480
481// Enums in the 'DOM' Domain
482template<>
483Optional<Inspector::Protocol::DOM::PseudoType> parseEnumValueFromString<Inspector::Protocol::DOM::PseudoType>(const String& protocolString)
484{
485 static const size_t constantValues[] = {
486 (size_t)Inspector::Protocol::DOM::PseudoType::Before,
487 (size_t)Inspector::Protocol::DOM::PseudoType::After,
488 };
489 for (size_t i = 0; i < 2; ++i)
490 if (protocolString == enum_constant_values[constantValues[i]])
491 return (Inspector::Protocol::DOM::PseudoType)constantValues[i];
492
493 return WTF::nullopt;
494}
495
496template<>
497Optional<Inspector::Protocol::DOM::ShadowRootType> parseEnumValueFromString<Inspector::Protocol::DOM::ShadowRootType>(const String& protocolString)
498{
499 static const size_t constantValues[] = {
500 (size_t)Inspector::Protocol::DOM::ShadowRootType::UserAgent,
501 (size_t)Inspector::Protocol::DOM::ShadowRootType::Open,
502 (size_t)Inspector::Protocol::DOM::ShadowRootType::Closed,
503 };
504 for (size_t i = 0; i < 3; ++i)
505 if (protocolString == enum_constant_values[constantValues[i]])
506 return (Inspector::Protocol::DOM::ShadowRootType)constantValues[i];
507
508 return WTF::nullopt;
509}
510
511template<>
512Optional<Inspector::Protocol::DOM::CustomElementState> parseEnumValueFromString<Inspector::Protocol::DOM::CustomElementState>(const String& protocolString)
513{
514 static const size_t constantValues[] = {
515 (size_t)Inspector::Protocol::DOM::CustomElementState::Builtin,
516 (size_t)Inspector::Protocol::DOM::CustomElementState::Custom,
517 (size_t)Inspector::Protocol::DOM::CustomElementState::Waiting,
518 (size_t)Inspector::Protocol::DOM::CustomElementState::Failed,
519 };
520 for (size_t i = 0; i < 4; ++i)
521 if (protocolString == enum_constant_values[constantValues[i]])
522 return (Inspector::Protocol::DOM::CustomElementState)constantValues[i];
523
524 return WTF::nullopt;
525}
526
527template<>
528Optional<Inspector::Protocol::DOM::LiveRegionRelevant> parseEnumValueFromString<Inspector::Protocol::DOM::LiveRegionRelevant>(const String& protocolString)
529{
530 static const size_t constantValues[] = {
531 (size_t)Inspector::Protocol::DOM::LiveRegionRelevant::Additions,
532 (size_t)Inspector::Protocol::DOM::LiveRegionRelevant::Removals,
533 (size_t)Inspector::Protocol::DOM::LiveRegionRelevant::Text,
534 };
535 for (size_t i = 0; i < 3; ++i)
536 if (protocolString == enum_constant_values[constantValues[i]])
537 return (Inspector::Protocol::DOM::LiveRegionRelevant)constantValues[i];
538
539 return WTF::nullopt;
540}
541
542template<>
543Optional<Inspector::Protocol::DOM::AccessibilityProperties::Checked> parseEnumValueFromString<Inspector::Protocol::DOM::AccessibilityProperties::Checked>(const String& protocolString)
544{
545 static const size_t constantValues[] = {
546 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::Checked::True,
547 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::Checked::False,
548 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::Checked::Mixed,
549 };
550 for (size_t i = 0; i < 3; ++i)
551 if (protocolString == enum_constant_values[constantValues[i]])
552 return (Inspector::Protocol::DOM::AccessibilityProperties::Checked)constantValues[i];
553
554 return WTF::nullopt;
555}
556
557template<>
558Optional<Inspector::Protocol::DOM::AccessibilityProperties::Current> parseEnumValueFromString<Inspector::Protocol::DOM::AccessibilityProperties::Current>(const String& protocolString)
559{
560 static const size_t constantValues[] = {
561 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::Current::True,
562 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::Current::False,
563 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::Current::Page,
564 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::Current::Step,
565 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::Current::Location,
566 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::Current::Date,
567 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::Current::Time,
568 };
569 for (size_t i = 0; i < 7; ++i)
570 if (protocolString == enum_constant_values[constantValues[i]])
571 return (Inspector::Protocol::DOM::AccessibilityProperties::Current)constantValues[i];
572
573 return WTF::nullopt;
574}
575
576template<>
577Optional<Inspector::Protocol::DOM::AccessibilityProperties::Invalid> parseEnumValueFromString<Inspector::Protocol::DOM::AccessibilityProperties::Invalid>(const String& protocolString)
578{
579 static const size_t constantValues[] = {
580 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::Invalid::True,
581 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::Invalid::False,
582 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::Invalid::Grammar,
583 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::Invalid::Spelling,
584 };
585 for (size_t i = 0; i < 4; ++i)
586 if (protocolString == enum_constant_values[constantValues[i]])
587 return (Inspector::Protocol::DOM::AccessibilityProperties::Invalid)constantValues[i];
588
589 return WTF::nullopt;
590}
591
592template<>
593Optional<Inspector::Protocol::DOM::AccessibilityProperties::LiveRegionStatus> parseEnumValueFromString<Inspector::Protocol::DOM::AccessibilityProperties::LiveRegionStatus>(const String& protocolString)
594{
595 static const size_t constantValues[] = {
596 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::LiveRegionStatus::Assertive,
597 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::LiveRegionStatus::Polite,
598 (size_t)Inspector::Protocol::DOM::AccessibilityProperties::LiveRegionStatus::Off,
599 };
600 for (size_t i = 0; i < 3; ++i)
601 if (protocolString == enum_constant_values[constantValues[i]])
602 return (Inspector::Protocol::DOM::AccessibilityProperties::LiveRegionStatus)constantValues[i];
603
604 return WTF::nullopt;
605}
606
607
608// Enums in the 'DOMDebugger' Domain
609template<>
610Optional<Inspector::Protocol::DOMDebugger::DOMBreakpointType> parseEnumValueFromString<Inspector::Protocol::DOMDebugger::DOMBreakpointType>(const String& protocolString)
611{
612 static const size_t constantValues[] = {
613 (size_t)Inspector::Protocol::DOMDebugger::DOMBreakpointType::SubtreeModified,
614 (size_t)Inspector::Protocol::DOMDebugger::DOMBreakpointType::AttributeModified,
615 (size_t)Inspector::Protocol::DOMDebugger::DOMBreakpointType::NodeRemoved,
616 };
617 for (size_t i = 0; i < 3; ++i)
618 if (protocolString == enum_constant_values[constantValues[i]])
619 return (Inspector::Protocol::DOMDebugger::DOMBreakpointType)constantValues[i];
620
621 return WTF::nullopt;
622}
623
624template<>
625Optional<Inspector::Protocol::DOMDebugger::EventBreakpointType> parseEnumValueFromString<Inspector::Protocol::DOMDebugger::EventBreakpointType>(const String& protocolString)
626{
627 static const size_t constantValues[] = {
628 (size_t)Inspector::Protocol::DOMDebugger::EventBreakpointType::AnimationFrame,
629 (size_t)Inspector::Protocol::DOMDebugger::EventBreakpointType::Listener,
630 (size_t)Inspector::Protocol::DOMDebugger::EventBreakpointType::Timer,
631 };
632 for (size_t i = 0; i < 3; ++i)
633 if (protocolString == enum_constant_values[constantValues[i]])
634 return (Inspector::Protocol::DOMDebugger::EventBreakpointType)constantValues[i];
635
636 return WTF::nullopt;
637}
638
639
640// Enums in the 'Debugger' Domain
641template<>
642Optional<Inspector::Protocol::Debugger::BreakpointAction::Type> parseEnumValueFromString<Inspector::Protocol::Debugger::BreakpointAction::Type>(const String& protocolString)
643{
644 static const size_t constantValues[] = {
645 (size_t)Inspector::Protocol::Debugger::BreakpointAction::Type::Log,
646 (size_t)Inspector::Protocol::Debugger::BreakpointAction::Type::Evaluate,
647 (size_t)Inspector::Protocol::Debugger::BreakpointAction::Type::Sound,
648 (size_t)Inspector::Protocol::Debugger::BreakpointAction::Type::Probe,
649 };
650 for (size_t i = 0; i < 4; ++i)
651 if (protocolString == enum_constant_values[constantValues[i]])
652 return (Inspector::Protocol::Debugger::BreakpointAction::Type)constantValues[i];
653
654 return WTF::nullopt;
655}
656
657template<>
658Optional<Inspector::Protocol::Debugger::Scope::Type> parseEnumValueFromString<Inspector::Protocol::Debugger::Scope::Type>(const String& protocolString)
659{
660 static const size_t constantValues[] = {
661 (size_t)Inspector::Protocol::Debugger::Scope::Type::Global,
662 (size_t)Inspector::Protocol::Debugger::Scope::Type::With,
663 (size_t)Inspector::Protocol::Debugger::Scope::Type::Closure,
664 (size_t)Inspector::Protocol::Debugger::Scope::Type::Catch,
665 (size_t)Inspector::Protocol::Debugger::Scope::Type::FunctionName,
666 (size_t)Inspector::Protocol::Debugger::Scope::Type::GlobalLexicalEnvironment,
667 (size_t)Inspector::Protocol::Debugger::Scope::Type::NestedLexical,
668 };
669 for (size_t i = 0; i < 7; ++i)
670 if (protocolString == enum_constant_values[constantValues[i]])
671 return (Inspector::Protocol::Debugger::Scope::Type)constantValues[i];
672
673 return WTF::nullopt;
674}
675
676
677// Enums in the 'Heap' Domain
678template<>
679Optional<Inspector::Protocol::Heap::GarbageCollection::Type> parseEnumValueFromString<Inspector::Protocol::Heap::GarbageCollection::Type>(const String& protocolString)
680{
681 static const size_t constantValues[] = {
682 (size_t)Inspector::Protocol::Heap::GarbageCollection::Type::Full,
683 (size_t)Inspector::Protocol::Heap::GarbageCollection::Type::Partial,
684 };
685 for (size_t i = 0; i < 2; ++i)
686 if (protocolString == enum_constant_values[constantValues[i]])
687 return (Inspector::Protocol::Heap::GarbageCollection::Type)constantValues[i];
688
689 return WTF::nullopt;
690}
691
692
693#if ENABLE(INDEXED_DATABASE)
694// Enums in the 'IndexedDB' Domain
695template<>
696Optional<Inspector::Protocol::IndexedDB::Key::Type> parseEnumValueFromString<Inspector::Protocol::IndexedDB::Key::Type>(const String& protocolString)
697{
698 static const size_t constantValues[] = {
699 (size_t)Inspector::Protocol::IndexedDB::Key::Type::Number,
700 (size_t)Inspector::Protocol::IndexedDB::Key::Type::String,
701 (size_t)Inspector::Protocol::IndexedDB::Key::Type::Date,
702 (size_t)Inspector::Protocol::IndexedDB::Key::Type::Array,
703 };
704 for (size_t i = 0; i < 4; ++i)
705 if (protocolString == enum_constant_values[constantValues[i]])
706 return (Inspector::Protocol::IndexedDB::Key::Type)constantValues[i];
707
708 return WTF::nullopt;
709}
710
711template<>
712Optional<Inspector::Protocol::IndexedDB::KeyPath::Type> parseEnumValueFromString<Inspector::Protocol::IndexedDB::KeyPath::Type>(const String& protocolString)
713{
714 static const size_t constantValues[] = {
715 (size_t)Inspector::Protocol::IndexedDB::KeyPath::Type::Null,
716 (size_t)Inspector::Protocol::IndexedDB::KeyPath::Type::String,
717 (size_t)Inspector::Protocol::IndexedDB::KeyPath::Type::Array,
718 };
719 for (size_t i = 0; i < 3; ++i)
720 if (protocolString == enum_constant_values[constantValues[i]])
721 return (Inspector::Protocol::IndexedDB::KeyPath::Type)constantValues[i];
722
723 return WTF::nullopt;
724}
725
726#endif // ENABLE(INDEXED_DATABASE)
727
728#if ENABLE(RESOURCE_USAGE)
729// Enums in the 'Memory' Domain
730template<>
731Optional<Inspector::Protocol::Memory::CategoryData::Type> parseEnumValueFromString<Inspector::Protocol::Memory::CategoryData::Type>(const String& protocolString)
732{
733 static const size_t constantValues[] = {
734 (size_t)Inspector::Protocol::Memory::CategoryData::Type::JavaScript,
735 (size_t)Inspector::Protocol::Memory::CategoryData::Type::JIT,
736 (size_t)Inspector::Protocol::Memory::CategoryData::Type::Images,
737 (size_t)Inspector::Protocol::Memory::CategoryData::Type::Layers,
738 (size_t)Inspector::Protocol::Memory::CategoryData::Type::Page,
739 (size_t)Inspector::Protocol::Memory::CategoryData::Type::Other,
740 };
741 for (size_t i = 0; i < 6; ++i)
742 if (protocolString == enum_constant_values[constantValues[i]])
743 return (Inspector::Protocol::Memory::CategoryData::Type)constantValues[i];
744
745 return WTF::nullopt;
746}
747
748#endif // ENABLE(RESOURCE_USAGE)
749
750// Enums in the 'Network' Domain
751template<>
752Optional<Inspector::Protocol::Network::Response::Source> parseEnumValueFromString<Inspector::Protocol::Network::Response::Source>(const String& protocolString)
753{
754 static const size_t constantValues[] = {
755 (size_t)Inspector::Protocol::Network::Response::Source::Unknown,
756 (size_t)Inspector::Protocol::Network::Response::Source::Network,
757 (size_t)Inspector::Protocol::Network::Response::Source::MemoryCache,
758 (size_t)Inspector::Protocol::Network::Response::Source::DiskCache,
759 (size_t)Inspector::Protocol::Network::Response::Source::ServiceWorker,
760 };
761 for (size_t i = 0; i < 5; ++i)
762 if (protocolString == enum_constant_values[constantValues[i]])
763 return (Inspector::Protocol::Network::Response::Source)constantValues[i];
764
765 return WTF::nullopt;
766}
767
768template<>
769Optional<Inspector::Protocol::Network::Metrics::Priority> parseEnumValueFromString<Inspector::Protocol::Network::Metrics::Priority>(const String& protocolString)
770{
771 static const size_t constantValues[] = {
772 (size_t)Inspector::Protocol::Network::Metrics::Priority::Low,
773 (size_t)Inspector::Protocol::Network::Metrics::Priority::Medium,
774 (size_t)Inspector::Protocol::Network::Metrics::Priority::High,
775 };
776 for (size_t i = 0; i < 3; ++i)
777 if (protocolString == enum_constant_values[constantValues[i]])
778 return (Inspector::Protocol::Network::Metrics::Priority)constantValues[i];
779
780 return WTF::nullopt;
781}
782
783template<>
784Optional<Inspector::Protocol::Network::Initiator::Type> parseEnumValueFromString<Inspector::Protocol::Network::Initiator::Type>(const String& protocolString)
785{
786 static const size_t constantValues[] = {
787 (size_t)Inspector::Protocol::Network::Initiator::Type::Parser,
788 (size_t)Inspector::Protocol::Network::Initiator::Type::Script,
789 (size_t)Inspector::Protocol::Network::Initiator::Type::Other,
790 };
791 for (size_t i = 0; i < 3; ++i)
792 if (protocolString == enum_constant_values[constantValues[i]])
793 return (Inspector::Protocol::Network::Initiator::Type)constantValues[i];
794
795 return WTF::nullopt;
796}
797
798
799// Enums in the 'Page' Domain
800template<>
801Optional<Inspector::Protocol::Page::Setting> parseEnumValueFromString<Inspector::Protocol::Page::Setting>(const String& protocolString)
802{
803 static const size_t constantValues[] = {
804 (size_t)Inspector::Protocol::Page::Setting::AuthorAndUserStylesEnabled,
805 (size_t)Inspector::Protocol::Page::Setting::ICECandidateFilteringEnabled,
806 (size_t)Inspector::Protocol::Page::Setting::ImagesEnabled,
807 (size_t)Inspector::Protocol::Page::Setting::MediaCaptureRequiresSecureConnection,
808 (size_t)Inspector::Protocol::Page::Setting::MockCaptureDevicesEnabled,
809 (size_t)Inspector::Protocol::Page::Setting::NeedsSiteSpecificQuirks,
810 (size_t)Inspector::Protocol::Page::Setting::ScriptEnabled,
811 (size_t)Inspector::Protocol::Page::Setting::WebSecurityEnabled,
812 };
813 for (size_t i = 0; i < 8; ++i)
814 if (protocolString == enum_constant_values[constantValues[i]])
815 return (Inspector::Protocol::Page::Setting)constantValues[i];
816
817 return WTF::nullopt;
818}
819
820template<>
821Optional<Inspector::Protocol::Page::ResourceType> parseEnumValueFromString<Inspector::Protocol::Page::ResourceType>(const String& protocolString)
822{
823 static const size_t constantValues[] = {
824 (size_t)Inspector::Protocol::Page::ResourceType::Document,
825 (size_t)Inspector::Protocol::Page::ResourceType::Stylesheet,
826 (size_t)Inspector::Protocol::Page::ResourceType::Image,
827 (size_t)Inspector::Protocol::Page::ResourceType::Font,
828 (size_t)Inspector::Protocol::Page::ResourceType::Script,
829 (size_t)Inspector::Protocol::Page::ResourceType::XHR,
830 (size_t)Inspector::Protocol::Page::ResourceType::Fetch,
831 (size_t)Inspector::Protocol::Page::ResourceType::Ping,
832 (size_t)Inspector::Protocol::Page::ResourceType::Beacon,
833 (size_t)Inspector::Protocol::Page::ResourceType::WebSocket,
834 (size_t)Inspector::Protocol::Page::ResourceType::Other,
835 };
836 for (size_t i = 0; i < 11; ++i)
837 if (protocolString == enum_constant_values[constantValues[i]])
838 return (Inspector::Protocol::Page::ResourceType)constantValues[i];
839
840 return WTF::nullopt;
841}
842
843template<>
844Optional<Inspector::Protocol::Page::CoordinateSystem> parseEnumValueFromString<Inspector::Protocol::Page::CoordinateSystem>(const String& protocolString)
845{
846 static const size_t constantValues[] = {
847 (size_t)Inspector::Protocol::Page::CoordinateSystem::Viewport,
848 (size_t)Inspector::Protocol::Page::CoordinateSystem::Page,
849 };
850 for (size_t i = 0; i < 2; ++i)
851 if (protocolString == enum_constant_values[constantValues[i]])
852 return (Inspector::Protocol::Page::CoordinateSystem)constantValues[i];
853
854 return WTF::nullopt;
855}
856
857template<>
858Optional<Inspector::Protocol::Page::CookieSameSitePolicy> parseEnumValueFromString<Inspector::Protocol::Page::CookieSameSitePolicy>(const String& protocolString)
859{
860 static const size_t constantValues[] = {
861 (size_t)Inspector::Protocol::Page::CookieSameSitePolicy::None,
862 (size_t)Inspector::Protocol::Page::CookieSameSitePolicy::Lax,
863 (size_t)Inspector::Protocol::Page::CookieSameSitePolicy::Strict,
864 };
865 for (size_t i = 0; i < 3; ++i)
866 if (protocolString == enum_constant_values[constantValues[i]])
867 return (Inspector::Protocol::Page::CookieSameSitePolicy)constantValues[i];
868
869 return WTF::nullopt;
870}
871
872template<>
873Optional<Inspector::Protocol::Page::Appearance> parseEnumValueFromString<Inspector::Protocol::Page::Appearance>(const String& protocolString)
874{
875 static const size_t constantValues[] = {
876 (size_t)Inspector::Protocol::Page::Appearance::Light,
877 (size_t)Inspector::Protocol::Page::Appearance::Dark,
878 };
879 for (size_t i = 0; i < 2; ++i)
880 if (protocolString == enum_constant_values[constantValues[i]])
881 return (Inspector::Protocol::Page::Appearance)constantValues[i];
882
883 return WTF::nullopt;
884}
885
886
887// Enums in the 'Recording' Domain
888template<>
889Optional<Inspector::Protocol::Recording::Type> parseEnumValueFromString<Inspector::Protocol::Recording::Type>(const String& protocolString)
890{
891 static const size_t constantValues[] = {
892 (size_t)Inspector::Protocol::Recording::Type::Canvas2D,
893 (size_t)Inspector::Protocol::Recording::Type::CanvasBitmapRenderer,
894 (size_t)Inspector::Protocol::Recording::Type::CanvasWebGL,
895 (size_t)Inspector::Protocol::Recording::Type::CanvasWebGL2,
896 };
897 for (size_t i = 0; i < 4; ++i)
898 if (protocolString == enum_constant_values[constantValues[i]])
899 return (Inspector::Protocol::Recording::Type)constantValues[i];
900
901 return WTF::nullopt;
902}
903
904template<>
905Optional<Inspector::Protocol::Recording::Initiator> parseEnumValueFromString<Inspector::Protocol::Recording::Initiator>(const String& protocolString)
906{
907 static const size_t constantValues[] = {
908 (size_t)Inspector::Protocol::Recording::Initiator::Frontend,
909 (size_t)Inspector::Protocol::Recording::Initiator::Console,
910 (size_t)Inspector::Protocol::Recording::Initiator::AutoCapture,
911 };
912 for (size_t i = 0; i < 3; ++i)
913 if (protocolString == enum_constant_values[constantValues[i]])
914 return (Inspector::Protocol::Recording::Initiator)constantValues[i];
915
916 return WTF::nullopt;
917}
918
919
920// Enums in the 'Runtime' Domain
921template<>
922Optional<Inspector::Protocol::Runtime::SyntaxErrorType> parseEnumValueFromString<Inspector::Protocol::Runtime::SyntaxErrorType>(const String& protocolString)
923{
924 static const size_t constantValues[] = {
925 (size_t)Inspector::Protocol::Runtime::SyntaxErrorType::None,
926 (size_t)Inspector::Protocol::Runtime::SyntaxErrorType::Irrecoverable,
927 (size_t)Inspector::Protocol::Runtime::SyntaxErrorType::UnterminatedLiteral,
928 (size_t)Inspector::Protocol::Runtime::SyntaxErrorType::Recoverable,
929 };
930 for (size_t i = 0; i < 4; ++i)
931 if (protocolString == enum_constant_values[constantValues[i]])
932 return (Inspector::Protocol::Runtime::SyntaxErrorType)constantValues[i];
933
934 return WTF::nullopt;
935}
936
937template<>
938Optional<Inspector::Protocol::Runtime::RemoteObject::Type> parseEnumValueFromString<Inspector::Protocol::Runtime::RemoteObject::Type>(const String& protocolString)
939{
940 static const size_t constantValues[] = {
941 (size_t)Inspector::Protocol::Runtime::RemoteObject::Type::Object,
942 (size_t)Inspector::Protocol::Runtime::RemoteObject::Type::Function,
943 (size_t)Inspector::Protocol::Runtime::RemoteObject::Type::Undefined,
944 (size_t)Inspector::Protocol::Runtime::RemoteObject::Type::String,
945 (size_t)Inspector::Protocol::Runtime::RemoteObject::Type::Number,
946 (size_t)Inspector::Protocol::Runtime::RemoteObject::Type::Boolean,
947 (size_t)Inspector::Protocol::Runtime::RemoteObject::Type::Symbol,
948 };
949 for (size_t i = 0; i < 7; ++i)
950 if (protocolString == enum_constant_values[constantValues[i]])
951 return (Inspector::Protocol::Runtime::RemoteObject::Type)constantValues[i];
952
953 return WTF::nullopt;
954}
955
956template<>
957Optional<Inspector::Protocol::Runtime::RemoteObject::Subtype> parseEnumValueFromString<Inspector::Protocol::Runtime::RemoteObject::Subtype>(const String& protocolString)
958{
959 static const size_t constantValues[] = {
960 (size_t)Inspector::Protocol::Runtime::RemoteObject::Subtype::Array,
961 (size_t)Inspector::Protocol::Runtime::RemoteObject::Subtype::Null,
962 (size_t)Inspector::Protocol::Runtime::RemoteObject::Subtype::Node,
963 (size_t)Inspector::Protocol::Runtime::RemoteObject::Subtype::Regexp,
964 (size_t)Inspector::Protocol::Runtime::RemoteObject::Subtype::Date,
965 (size_t)Inspector::Protocol::Runtime::RemoteObject::Subtype::Error,
966 (size_t)Inspector::Protocol::Runtime::RemoteObject::Subtype::Map,
967 (size_t)Inspector::Protocol::Runtime::RemoteObject::Subtype::Set,
968 (size_t)Inspector::Protocol::Runtime::RemoteObject::Subtype::Weakmap,
969 (size_t)Inspector::Protocol::Runtime::RemoteObject::Subtype::Weakset,
970 (size_t)Inspector::Protocol::Runtime::RemoteObject::Subtype::Iterator,
971 (size_t)Inspector::Protocol::Runtime::RemoteObject::Subtype::Class,
972 (size_t)Inspector::Protocol::Runtime::RemoteObject::Subtype::Proxy,
973 };
974 for (size_t i = 0; i < 13; ++i)
975 if (protocolString == enum_constant_values[constantValues[i]])
976 return (Inspector::Protocol::Runtime::RemoteObject::Subtype)constantValues[i];
977
978 return WTF::nullopt;
979}
980
981template<>
982Optional<Inspector::Protocol::Runtime::ObjectPreview::Type> parseEnumValueFromString<Inspector::Protocol::Runtime::ObjectPreview::Type>(const String& protocolString)
983{
984 static const size_t constantValues[] = {
985 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Type::Object,
986 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Type::Function,
987 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Type::Undefined,
988 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Type::String,
989 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Type::Number,
990 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Type::Boolean,
991 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Type::Symbol,
992 };
993 for (size_t i = 0; i < 7; ++i)
994 if (protocolString == enum_constant_values[constantValues[i]])
995 return (Inspector::Protocol::Runtime::ObjectPreview::Type)constantValues[i];
996
997 return WTF::nullopt;
998}
999
1000template<>
1001Optional<Inspector::Protocol::Runtime::ObjectPreview::Subtype> parseEnumValueFromString<Inspector::Protocol::Runtime::ObjectPreview::Subtype>(const String& protocolString)
1002{
1003 static const size_t constantValues[] = {
1004 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Subtype::Array,
1005 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Subtype::Null,
1006 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Subtype::Node,
1007 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Subtype::Regexp,
1008 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Subtype::Date,
1009 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Subtype::Error,
1010 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Subtype::Map,
1011 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Subtype::Set,
1012 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Subtype::Weakmap,
1013 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Subtype::Weakset,
1014 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Subtype::Iterator,
1015 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Subtype::Class,
1016 (size_t)Inspector::Protocol::Runtime::ObjectPreview::Subtype::Proxy,
1017 };
1018 for (size_t i = 0; i < 13; ++i)
1019 if (protocolString == enum_constant_values[constantValues[i]])
1020 return (Inspector::Protocol::Runtime::ObjectPreview::Subtype)constantValues[i];
1021
1022 return WTF::nullopt;
1023}
1024
1025template<>
1026Optional<Inspector::Protocol::Runtime::PropertyPreview::Type> parseEnumValueFromString<Inspector::Protocol::Runtime::PropertyPreview::Type>(const String& protocolString)
1027{
1028 static const size_t constantValues[] = {
1029 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Type::Object,
1030 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Type::Function,
1031 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Type::Undefined,
1032 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Type::String,
1033 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Type::Number,
1034 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Type::Boolean,
1035 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Type::Symbol,
1036 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Type::Accessor,
1037 };
1038 for (size_t i = 0; i < 8; ++i)
1039 if (protocolString == enum_constant_values[constantValues[i]])
1040 return (Inspector::Protocol::Runtime::PropertyPreview::Type)constantValues[i];
1041
1042 return WTF::nullopt;
1043}
1044
1045template<>
1046Optional<Inspector::Protocol::Runtime::PropertyPreview::Subtype> parseEnumValueFromString<Inspector::Protocol::Runtime::PropertyPreview::Subtype>(const String& protocolString)
1047{
1048 static const size_t constantValues[] = {
1049 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Subtype::Array,
1050 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Subtype::Null,
1051 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Subtype::Node,
1052 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Subtype::Regexp,
1053 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Subtype::Date,
1054 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Subtype::Error,
1055 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Subtype::Map,
1056 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Subtype::Set,
1057 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Subtype::Weakmap,
1058 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Subtype::Weakset,
1059 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Subtype::Iterator,
1060 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Subtype::Class,
1061 (size_t)Inspector::Protocol::Runtime::PropertyPreview::Subtype::Proxy,
1062 };
1063 for (size_t i = 0; i < 13; ++i)
1064 if (protocolString == enum_constant_values[constantValues[i]])
1065 return (Inspector::Protocol::Runtime::PropertyPreview::Subtype)constantValues[i];
1066
1067 return WTF::nullopt;
1068}
1069
1070
1071// Enums in the 'ScriptProfiler' Domain
1072template<>
1073Optional<Inspector::Protocol::ScriptProfiler::EventType> parseEnumValueFromString<Inspector::Protocol::ScriptProfiler::EventType>(const String& protocolString)
1074{
1075 static const size_t constantValues[] = {
1076 (size_t)Inspector::Protocol::ScriptProfiler::EventType::API,
1077 (size_t)Inspector::Protocol::ScriptProfiler::EventType::Microtask,
1078 (size_t)Inspector::Protocol::ScriptProfiler::EventType::Other,
1079 };
1080 for (size_t i = 0; i < 3; ++i)
1081 if (protocolString == enum_constant_values[constantValues[i]])
1082 return (Inspector::Protocol::ScriptProfiler::EventType)constantValues[i];
1083
1084 return WTF::nullopt;
1085}
1086
1087
1088// Enums in the 'Target' Domain
1089template<>
1090Optional<Inspector::Protocol::Target::TargetInfo::Type> parseEnumValueFromString<Inspector::Protocol::Target::TargetInfo::Type>(const String& protocolString)
1091{
1092 static const size_t constantValues[] = {
1093 (size_t)Inspector::Protocol::Target::TargetInfo::Type::JavaScript,
1094 (size_t)Inspector::Protocol::Target::TargetInfo::Type::Page,
1095 (size_t)Inspector::Protocol::Target::TargetInfo::Type::Worker,
1096 (size_t)Inspector::Protocol::Target::TargetInfo::Type::ServiceWorker,
1097 };
1098 for (size_t i = 0; i < 4; ++i)
1099 if (protocolString == enum_constant_values[constantValues[i]])
1100 return (Inspector::Protocol::Target::TargetInfo::Type)constantValues[i];
1101
1102 return WTF::nullopt;
1103}
1104
1105
1106// Enums in the 'Timeline' Domain
1107template<>
1108Optional<Inspector::Protocol::Timeline::EventType> parseEnumValueFromString<Inspector::Protocol::Timeline::EventType>(const String& protocolString)
1109{
1110 static const size_t constantValues[] = {
1111 (size_t)Inspector::Protocol::Timeline::EventType::EventDispatch,
1112 (size_t)Inspector::Protocol::Timeline::EventType::ScheduleStyleRecalculation,
1113 (size_t)Inspector::Protocol::Timeline::EventType::RecalculateStyles,
1114 (size_t)Inspector::Protocol::Timeline::EventType::InvalidateLayout,
1115 (size_t)Inspector::Protocol::Timeline::EventType::Layout,
1116 (size_t)Inspector::Protocol::Timeline::EventType::Paint,
1117 (size_t)Inspector::Protocol::Timeline::EventType::Composite,
1118 (size_t)Inspector::Protocol::Timeline::EventType::RenderingFrame,
1119 (size_t)Inspector::Protocol::Timeline::EventType::TimerInstall,
1120 (size_t)Inspector::Protocol::Timeline::EventType::TimerRemove,
1121 (size_t)Inspector::Protocol::Timeline::EventType::TimerFire,
1122 (size_t)Inspector::Protocol::Timeline::EventType::EvaluateScript,
1123 (size_t)Inspector::Protocol::Timeline::EventType::TimeStamp,
1124 (size_t)Inspector::Protocol::Timeline::EventType::Time,
1125 (size_t)Inspector::Protocol::Timeline::EventType::TimeEnd,
1126 (size_t)Inspector::Protocol::Timeline::EventType::FunctionCall,
1127 (size_t)Inspector::Protocol::Timeline::EventType::ProbeSample,
1128 (size_t)Inspector::Protocol::Timeline::EventType::ConsoleProfile,
1129 (size_t)Inspector::Protocol::Timeline::EventType::RequestAnimationFrame,
1130 (size_t)Inspector::Protocol::Timeline::EventType::CancelAnimationFrame,
1131 (size_t)Inspector::Protocol::Timeline::EventType::FireAnimationFrame,
1132 (size_t)Inspector::Protocol::Timeline::EventType::ObserverCallback,
1133 };
1134 for (size_t i = 0; i < 22; ++i)
1135 if (protocolString == enum_constant_values[constantValues[i]])
1136 return (Inspector::Protocol::Timeline::EventType)constantValues[i];
1137
1138 return WTF::nullopt;
1139}
1140
1141template<>
1142Optional<Inspector::Protocol::Timeline::Instrument> parseEnumValueFromString<Inspector::Protocol::Timeline::Instrument>(const String& protocolString)
1143{
1144 static const size_t constantValues[] = {
1145 (size_t)Inspector::Protocol::Timeline::Instrument::ScriptProfiler,
1146 (size_t)Inspector::Protocol::Timeline::Instrument::Timeline,
1147 (size_t)Inspector::Protocol::Timeline::Instrument::CPU,
1148 (size_t)Inspector::Protocol::Timeline::Instrument::Memory,
1149 (size_t)Inspector::Protocol::Timeline::Instrument::Heap,
1150 };
1151 for (size_t i = 0; i < 5; ++i)
1152 if (protocolString == enum_constant_values[constantValues[i]])
1153 return (Inspector::Protocol::Timeline::Instrument)constantValues[i];
1154
1155 return WTF::nullopt;
1156}
1157
1158
1159} // namespace InspectorHelpers
1160
1161const char* Inspector::Protocol::CSS::CSSProperty::Implicit = "implicit";
1162const char* Inspector::Protocol::CSS::CSSProperty::Name = "name";
1163const char* Inspector::Protocol::CSS::CSSProperty::ParsedOk = "parsedOk";
1164const char* Inspector::Protocol::CSS::CSSProperty::Priority = "priority";
1165const char* Inspector::Protocol::CSS::CSSProperty::Range = "range";
1166const char* Inspector::Protocol::CSS::CSSProperty::Status = "status";
1167const char* Inspector::Protocol::CSS::CSSProperty::Text = "text";
1168const char* Inspector::Protocol::CSS::CSSProperty::Value = "value";
1169const char* Inspector::Protocol::Network::Response::MimeType = "mimeType";
1170const char* Inspector::Protocol::Timeline::TimelineEvent::Children = "children";
1171const char* Inspector::Protocol::Timeline::TimelineEvent::Data = "data";
1172const char* Inspector::Protocol::Timeline::TimelineEvent::Type = "type";
1173
1174void BindingTraits<Inspector::Protocol::Debugger::Location>::assertValueHasExpectedType(JSON::Value* value)
1175{
1176#if ASSERT_DISABLED
1177 UNUSED_PARAM(value);
1178#else
1179 ASSERT_ARG(value, value);
1180 RefPtr<JSON::Object> object;
1181 bool castSucceeded = value->asObject(object);
1182 ASSERT_UNUSED(castSucceeded, castSucceeded);
1183 {
1184 auto scriptIdPos = object->find("scriptId"_s);
1185 ASSERT(scriptIdPos != object->end());
1186 BindingTraits<String>::assertValueHasExpectedType(scriptIdPos->value.get());
1187 }
1188 {
1189 auto lineNumberPos = object->find("lineNumber"_s);
1190 ASSERT(lineNumberPos != object->end());
1191 BindingTraits<int>::assertValueHasExpectedType(lineNumberPos->value.get());
1192 }
1193
1194 int foundPropertiesCount = 2;
1195 {
1196 auto columnNumberPos = object->find("columnNumber"_s);
1197 if (columnNumberPos != object->end()) {
1198 BindingTraits<int>::assertValueHasExpectedType(columnNumberPos->value.get());
1199 ++foundPropertiesCount;
1200 }
1201 }
1202 if (foundPropertiesCount != object->size())
1203 FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
1204#endif // !ASSERT_DISABLED
1205}
1206
1207void BindingTraits<Inspector::Protocol::Debugger::FunctionDetails>::assertValueHasExpectedType(JSON::Value* value)
1208{
1209#if ASSERT_DISABLED
1210 UNUSED_PARAM(value);
1211#else
1212 ASSERT_ARG(value, value);
1213 RefPtr<JSON::Object> object;
1214 bool castSucceeded = value->asObject(object);
1215 ASSERT_UNUSED(castSucceeded, castSucceeded);
1216 {
1217 auto locationPos = object->find("location"_s);
1218 ASSERT(locationPos != object->end());
1219 BindingTraits<Inspector::Protocol::Debugger::Location>::assertValueHasExpectedType(locationPos->value.get());
1220 }
1221
1222 int foundPropertiesCount = 1;
1223 {
1224 auto namePos = object->find("name"_s);
1225 if (namePos != object->end()) {
1226 BindingTraits<String>::assertValueHasExpectedType(namePos->value.get());
1227 ++foundPropertiesCount;
1228 }
1229 }
1230 {
1231 auto displayNamePos = object->find("displayName"_s);
1232 if (displayNamePos != object->end()) {
1233 BindingTraits<String>::assertValueHasExpectedType(displayNamePos->value.get());
1234 ++foundPropertiesCount;
1235 }
1236 }
1237 {
1238 auto scopeChainPos = object->find("scopeChain"_s);
1239 if (scopeChainPos != object->end()) {
1240 BindingTraits<JSON::ArrayOf<Inspector::Protocol::Debugger::Scope>>::assertValueHasExpectedType(scopeChainPos->value.get());
1241 ++foundPropertiesCount;
1242 }
1243 }
1244 if (foundPropertiesCount != object->size())
1245 FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
1246#endif // !ASSERT_DISABLED
1247}
1248
1249RefPtr<Inspector::Protocol::Debugger::FunctionDetails> BindingTraits<Inspector::Protocol::Debugger::FunctionDetails>::runtimeCast(RefPtr<JSON::Value>&& value)
1250{
1251 RefPtr<JSON::Object> result;
1252 bool castSucceeded = value->asObject(result);
1253 ASSERT_UNUSED(castSucceeded, castSucceeded);
1254 BindingTraits<Inspector::Protocol::Debugger::FunctionDetails>::assertValueHasExpectedType(result.get());
1255 COMPILE_ASSERT(sizeof(Inspector::Protocol::Debugger::FunctionDetails) == sizeof(JSON::ObjectBase), type_cast_problem);
1256 return static_cast<Inspector::Protocol::Debugger::FunctionDetails*>(static_cast<JSON::ObjectBase*>(result.get()));
1257}
1258
1259
1260void BindingTraits<Inspector::Protocol::Debugger::CallFrame>::assertValueHasExpectedType(JSON::Value* value)
1261{
1262#if ASSERT_DISABLED
1263 UNUSED_PARAM(value);
1264#else
1265 ASSERT_ARG(value, value);
1266 RefPtr<JSON::Object> object;
1267 bool castSucceeded = value->asObject(object);
1268 ASSERT_UNUSED(castSucceeded, castSucceeded);
1269 {
1270 auto callFrameIdPos = object->find("callFrameId"_s);
1271 ASSERT(callFrameIdPos != object->end());
1272 BindingTraits<String>::assertValueHasExpectedType(callFrameIdPos->value.get());
1273 }
1274 {
1275 auto functionNamePos = object->find("functionName"_s);
1276 ASSERT(functionNamePos != object->end());
1277 BindingTraits<String>::assertValueHasExpectedType(functionNamePos->value.get());
1278 }
1279 {
1280 auto locationPos = object->find("location"_s);
1281 ASSERT(locationPos != object->end());
1282 BindingTraits<Inspector::Protocol::Debugger::Location>::assertValueHasExpectedType(locationPos->value.get());
1283 }
1284 {
1285 auto scopeChainPos = object->find("scopeChain"_s);
1286 ASSERT(scopeChainPos != object->end());
1287 BindingTraits<JSON::ArrayOf<Inspector::Protocol::Debugger::Scope>>::assertValueHasExpectedType(scopeChainPos->value.get());
1288 }
1289 {
1290 auto thisPos = object->find("this"_s);
1291 ASSERT(thisPos != object->end());
1292 BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::assertValueHasExpectedType(thisPos->value.get());
1293 }
1294 {
1295 auto isTailDeletedPos = object->find("isTailDeleted"_s);
1296 ASSERT(isTailDeletedPos != object->end());
1297 BindingTraits<bool>::assertValueHasExpectedType(isTailDeletedPos->value.get());
1298 }
1299
1300 int foundPropertiesCount = 6;
1301 if (foundPropertiesCount != object->size())
1302 FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
1303#endif // !ASSERT_DISABLED
1304}
1305
1306RefPtr<Inspector::Protocol::Debugger::CallFrame> BindingTraits<Inspector::Protocol::Debugger::CallFrame>::runtimeCast(RefPtr<JSON::Value>&& value)
1307{
1308 RefPtr<JSON::Object> result;
1309 bool castSucceeded = value->asObject(result);
1310 ASSERT_UNUSED(castSucceeded, castSucceeded);
1311 BindingTraits<Inspector::Protocol::Debugger::CallFrame>::assertValueHasExpectedType(result.get());
1312 COMPILE_ASSERT(sizeof(Inspector::Protocol::Debugger::CallFrame) == sizeof(JSON::ObjectBase), type_cast_problem);
1313 return static_cast<Inspector::Protocol::Debugger::CallFrame*>(static_cast<JSON::ObjectBase*>(result.get()));
1314}
1315
1316
1317void BindingTraits<Inspector::Protocol::Debugger::Scope::Type>::assertValueHasExpectedType(JSON::Value* value)
1318{
1319#if ASSERT_DISABLED
1320 UNUSED_PARAM(value);
1321#else
1322 ASSERT_ARG(value, value);
1323 String result;
1324 bool castSucceeded = value->asString(result);
1325 ASSERT(castSucceeded);
1326 ASSERT(result == "global" || result == "with" || result == "closure" || result == "catch" || result == "functionName" || result == "globalLexicalEnvironment" || result == "nestedLexical");
1327#endif // !ASSERT_DISABLED
1328}
1329
1330void BindingTraits<Inspector::Protocol::Debugger::Scope>::assertValueHasExpectedType(JSON::Value* value)
1331{
1332#if ASSERT_DISABLED
1333 UNUSED_PARAM(value);
1334#else
1335 ASSERT_ARG(value, value);
1336 RefPtr<JSON::Object> object;
1337 bool castSucceeded = value->asObject(object);
1338 ASSERT_UNUSED(castSucceeded, castSucceeded);
1339 {
1340 auto objectPos = object->find("object"_s);
1341 ASSERT(objectPos != object->end());
1342 BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::assertValueHasExpectedType(objectPos->value.get());
1343 }
1344 {
1345 auto typePos = object->find("type"_s);
1346 ASSERT(typePos != object->end());
1347 BindingTraits<Inspector::Protocol::Debugger::Scope::Type>::assertValueHasExpectedType(typePos->value.get());
1348 }
1349
1350 int foundPropertiesCount = 2;
1351 {
1352 auto namePos = object->find("name"_s);
1353 if (namePos != object->end()) {
1354 BindingTraits<String>::assertValueHasExpectedType(namePos->value.get());
1355 ++foundPropertiesCount;
1356 }
1357 }
1358 {
1359 auto locationPos = object->find("location"_s);
1360 if (locationPos != object->end()) {
1361 BindingTraits<Inspector::Protocol::Debugger::Location>::assertValueHasExpectedType(locationPos->value.get());
1362 ++foundPropertiesCount;
1363 }
1364 }
1365 {
1366 auto emptyPos = object->find("empty"_s);
1367 if (emptyPos != object->end()) {
1368 BindingTraits<bool>::assertValueHasExpectedType(emptyPos->value.get());
1369 ++foundPropertiesCount;
1370 }
1371 }
1372 if (foundPropertiesCount != object->size())
1373 FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
1374#endif // !ASSERT_DISABLED
1375}
1376
1377void BindingTraits<Inspector::Protocol::Runtime::RemoteObject::Type>::assertValueHasExpectedType(JSON::Value* value)
1378{
1379#if ASSERT_DISABLED
1380 UNUSED_PARAM(value);
1381#else
1382 ASSERT_ARG(value, value);
1383 String result;
1384 bool castSucceeded = value->asString(result);
1385 ASSERT(castSucceeded);
1386 ASSERT(result == "object" || result == "function" || result == "undefined" || result == "string" || result == "number" || result == "boolean" || result == "symbol");
1387#endif // !ASSERT_DISABLED
1388}
1389
1390void BindingTraits<Inspector::Protocol::Runtime::RemoteObject::Subtype>::assertValueHasExpectedType(JSON::Value* value)
1391{
1392#if ASSERT_DISABLED
1393 UNUSED_PARAM(value);
1394#else
1395 ASSERT_ARG(value, value);
1396 String result;
1397 bool castSucceeded = value->asString(result);
1398 ASSERT(castSucceeded);
1399 ASSERT(result == "array" || result == "null" || result == "node" || result == "regexp" || result == "date" || result == "error" || result == "map" || result == "set" || result == "weakmap" || result == "weakset" || result == "iterator" || result == "class" || result == "proxy");
1400#endif // !ASSERT_DISABLED
1401}
1402
1403void BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::assertValueHasExpectedType(JSON::Value* value)
1404{
1405#if ASSERT_DISABLED
1406 UNUSED_PARAM(value);
1407#else
1408 ASSERT_ARG(value, value);
1409 RefPtr<JSON::Object> object;
1410 bool castSucceeded = value->asObject(object);
1411 ASSERT_UNUSED(castSucceeded, castSucceeded);
1412 {
1413 auto typePos = object->find("type"_s);
1414 ASSERT(typePos != object->end());
1415 BindingTraits<Inspector::Protocol::Runtime::RemoteObject::Type>::assertValueHasExpectedType(typePos->value.get());
1416 }
1417
1418 int foundPropertiesCount = 1;
1419 {
1420 auto subtypePos = object->find("subtype"_s);
1421 if (subtypePos != object->end()) {
1422 BindingTraits<Inspector::Protocol::Runtime::RemoteObject::Subtype>::assertValueHasExpectedType(subtypePos->value.get());
1423 ++foundPropertiesCount;
1424 }
1425 }
1426 {
1427 auto classNamePos = object->find("className"_s);
1428 if (classNamePos != object->end()) {
1429 BindingTraits<String>::assertValueHasExpectedType(classNamePos->value.get());
1430 ++foundPropertiesCount;
1431 }
1432 }
1433 {
1434 auto valuePos = object->find("value"_s);
1435 if (valuePos != object->end()) {
1436 BindingTraits<JSON::Value>::assertValueHasExpectedType(valuePos->value.get());
1437 ++foundPropertiesCount;
1438 }
1439 }
1440 {
1441 auto descriptionPos = object->find("description"_s);
1442 if (descriptionPos != object->end()) {
1443 BindingTraits<String>::assertValueHasExpectedType(descriptionPos->value.get());
1444 ++foundPropertiesCount;
1445 }
1446 }
1447 {
1448 auto objectIdPos = object->find("objectId"_s);
1449 if (objectIdPos != object->end()) {
1450 BindingTraits<String>::assertValueHasExpectedType(objectIdPos->value.get());
1451 ++foundPropertiesCount;
1452 }
1453 }
1454 {
1455 auto sizePos = object->find("size"_s);
1456 if (sizePos != object->end()) {
1457 BindingTraits<int>::assertValueHasExpectedType(sizePos->value.get());
1458 ++foundPropertiesCount;
1459 }
1460 }
1461 {
1462 auto classPrototypePos = object->find("classPrototype"_s);
1463 if (classPrototypePos != object->end()) {
1464 BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::assertValueHasExpectedType(classPrototypePos->value.get());
1465 ++foundPropertiesCount;
1466 }
1467 }
1468 {
1469 auto previewPos = object->find("preview"_s);
1470 if (previewPos != object->end()) {
1471 BindingTraits<Inspector::Protocol::Runtime::ObjectPreview>::assertValueHasExpectedType(previewPos->value.get());
1472 ++foundPropertiesCount;
1473 }
1474 }
1475 if (foundPropertiesCount != object->size())
1476 FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
1477#endif // !ASSERT_DISABLED
1478}
1479
1480RefPtr<Inspector::Protocol::Runtime::RemoteObject> BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::runtimeCast(RefPtr<JSON::Value>&& value)
1481{
1482 RefPtr<JSON::Object> result;
1483 bool castSucceeded = value->asObject(result);
1484 ASSERT_UNUSED(castSucceeded, castSucceeded);
1485 BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::assertValueHasExpectedType(result.get());
1486 COMPILE_ASSERT(sizeof(Inspector::Protocol::Runtime::RemoteObject) == sizeof(JSON::ObjectBase), type_cast_problem);
1487 return static_cast<Inspector::Protocol::Runtime::RemoteObject*>(static_cast<JSON::ObjectBase*>(result.get()));
1488}
1489
1490
1491void BindingTraits<Inspector::Protocol::Runtime::ObjectPreview::Type>::assertValueHasExpectedType(JSON::Value* value)
1492{
1493#if ASSERT_DISABLED
1494 UNUSED_PARAM(value);
1495#else
1496 ASSERT_ARG(value, value);
1497 String result;
1498 bool castSucceeded = value->asString(result);
1499 ASSERT(castSucceeded);
1500 ASSERT(result == "object" || result == "function" || result == "undefined" || result == "string" || result == "number" || result == "boolean" || result == "symbol");
1501#endif // !ASSERT_DISABLED
1502}
1503
1504void BindingTraits<Inspector::Protocol::Runtime::ObjectPreview::Subtype>::assertValueHasExpectedType(JSON::Value* value)
1505{
1506#if ASSERT_DISABLED
1507 UNUSED_PARAM(value);
1508#else
1509 ASSERT_ARG(value, value);
1510 String result;
1511 bool castSucceeded = value->asString(result);
1512 ASSERT(castSucceeded);
1513 ASSERT(result == "array" || result == "null" || result == "node" || result == "regexp" || result == "date" || result == "error" || result == "map" || result == "set" || result == "weakmap" || result == "weakset" || result == "iterator" || result == "class" || result == "proxy");
1514#endif // !ASSERT_DISABLED
1515}
1516
1517void BindingTraits<Inspector::Protocol::Runtime::ObjectPreview>::assertValueHasExpectedType(JSON::Value* value)
1518{
1519#if ASSERT_DISABLED
1520 UNUSED_PARAM(value);
1521#else
1522 ASSERT_ARG(value, value);
1523 RefPtr<JSON::Object> object;
1524 bool castSucceeded = value->asObject(object);
1525 ASSERT_UNUSED(castSucceeded, castSucceeded);
1526 {
1527 auto typePos = object->find("type"_s);
1528 ASSERT(typePos != object->end());
1529 BindingTraits<Inspector::Protocol::Runtime::ObjectPreview::Type>::assertValueHasExpectedType(typePos->value.get());
1530 }
1531 {
1532 auto losslessPos = object->find("lossless"_s);
1533 ASSERT(losslessPos != object->end());
1534 BindingTraits<bool>::assertValueHasExpectedType(losslessPos->value.get());
1535 }
1536
1537 int foundPropertiesCount = 2;
1538 {
1539 auto subtypePos = object->find("subtype"_s);
1540 if (subtypePos != object->end()) {
1541 BindingTraits<Inspector::Protocol::Runtime::ObjectPreview::Subtype>::assertValueHasExpectedType(subtypePos->value.get());
1542 ++foundPropertiesCount;
1543 }
1544 }
1545 {
1546 auto descriptionPos = object->find("description"_s);
1547 if (descriptionPos != object->end()) {
1548 BindingTraits<String>::assertValueHasExpectedType(descriptionPos->value.get());
1549 ++foundPropertiesCount;
1550 }
1551 }
1552 {
1553 auto overflowPos = object->find("overflow"_s);
1554 if (overflowPos != object->end()) {
1555 BindingTraits<bool>::assertValueHasExpectedType(overflowPos->value.get());
1556 ++foundPropertiesCount;
1557 }
1558 }
1559 {
1560 auto propertiesPos = object->find("properties"_s);
1561 if (propertiesPos != object->end()) {
1562 BindingTraits<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyPreview>>::assertValueHasExpectedType(propertiesPos->value.get());
1563 ++foundPropertiesCount;
1564 }
1565 }
1566 {
1567 auto entriesPos = object->find("entries"_s);
1568 if (entriesPos != object->end()) {
1569 BindingTraits<JSON::ArrayOf<Inspector::Protocol::Runtime::EntryPreview>>::assertValueHasExpectedType(entriesPos->value.get());
1570 ++foundPropertiesCount;
1571 }
1572 }
1573 {
1574 auto sizePos = object->find("size"_s);
1575 if (sizePos != object->end()) {
1576 BindingTraits<int>::assertValueHasExpectedType(sizePos->value.get());
1577 ++foundPropertiesCount;
1578 }
1579 }
1580 if (foundPropertiesCount != object->size())
1581 FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
1582#endif // !ASSERT_DISABLED
1583}
1584
1585RefPtr<Inspector::Protocol::Runtime::ObjectPreview> BindingTraits<Inspector::Protocol::Runtime::ObjectPreview>::runtimeCast(RefPtr<JSON::Value>&& value)
1586{
1587 RefPtr<JSON::Object> result;
1588 bool castSucceeded = value->asObject(result);
1589 ASSERT_UNUSED(castSucceeded, castSucceeded);
1590 BindingTraits<Inspector::Protocol::Runtime::ObjectPreview>::assertValueHasExpectedType(result.get());
1591 COMPILE_ASSERT(sizeof(Inspector::Protocol::Runtime::ObjectPreview) == sizeof(JSON::ObjectBase), type_cast_problem);
1592 return static_cast<Inspector::Protocol::Runtime::ObjectPreview*>(static_cast<JSON::ObjectBase*>(result.get()));
1593}
1594
1595
1596void BindingTraits<Inspector::Protocol::Runtime::PropertyPreview::Type>::assertValueHasExpectedType(JSON::Value* value)
1597{
1598#if ASSERT_DISABLED
1599 UNUSED_PARAM(value);
1600#else
1601 ASSERT_ARG(value, value);
1602 String result;
1603 bool castSucceeded = value->asString(result);
1604 ASSERT(castSucceeded);
1605 ASSERT(result == "object" || result == "function" || result == "undefined" || result == "string" || result == "number" || result == "boolean" || result == "symbol" || result == "accessor");
1606#endif // !ASSERT_DISABLED
1607}
1608
1609void BindingTraits<Inspector::Protocol::Runtime::PropertyPreview::Subtype>::assertValueHasExpectedType(JSON::Value* value)
1610{
1611#if ASSERT_DISABLED
1612 UNUSED_PARAM(value);
1613#else
1614 ASSERT_ARG(value, value);
1615 String result;
1616 bool castSucceeded = value->asString(result);
1617 ASSERT(castSucceeded);
1618 ASSERT(result == "array" || result == "null" || result == "node" || result == "regexp" || result == "date" || result == "error" || result == "map" || result == "set" || result == "weakmap" || result == "weakset" || result == "iterator" || result == "class" || result == "proxy");
1619#endif // !ASSERT_DISABLED
1620}
1621
1622void BindingTraits<Inspector::Protocol::Runtime::PropertyPreview>::assertValueHasExpectedType(JSON::Value* value)
1623{
1624#if ASSERT_DISABLED
1625 UNUSED_PARAM(value);
1626#else
1627 ASSERT_ARG(value, value);
1628 RefPtr<JSON::Object> object;
1629 bool castSucceeded = value->asObject(object);
1630 ASSERT_UNUSED(castSucceeded, castSucceeded);
1631 {
1632 auto namePos = object->find("name"_s);
1633 ASSERT(namePos != object->end());
1634 BindingTraits<String>::assertValueHasExpectedType(namePos->value.get());
1635 }
1636 {
1637 auto typePos = object->find("type"_s);
1638 ASSERT(typePos != object->end());
1639 BindingTraits<Inspector::Protocol::Runtime::PropertyPreview::Type>::assertValueHasExpectedType(typePos->value.get());
1640 }
1641
1642 int foundPropertiesCount = 2;
1643 {
1644 auto subtypePos = object->find("subtype"_s);
1645 if (subtypePos != object->end()) {
1646 BindingTraits<Inspector::Protocol::Runtime::PropertyPreview::Subtype>::assertValueHasExpectedType(subtypePos->value.get());
1647 ++foundPropertiesCount;
1648 }
1649 }
1650 {
1651 auto valuePos = object->find("value"_s);
1652 if (valuePos != object->end()) {
1653 BindingTraits<String>::assertValueHasExpectedType(valuePos->value.get());
1654 ++foundPropertiesCount;
1655 }
1656 }
1657 {
1658 auto valuePreviewPos = object->find("valuePreview"_s);
1659 if (valuePreviewPos != object->end()) {
1660 BindingTraits<Inspector::Protocol::Runtime::ObjectPreview>::assertValueHasExpectedType(valuePreviewPos->value.get());
1661 ++foundPropertiesCount;
1662 }
1663 }
1664 {
1665 auto internalPos = object->find("internal"_s);
1666 if (internalPos != object->end()) {
1667 BindingTraits<bool>::assertValueHasExpectedType(internalPos->value.get());
1668 ++foundPropertiesCount;
1669 }
1670 }
1671 if (foundPropertiesCount != object->size())
1672 FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
1673#endif // !ASSERT_DISABLED
1674}
1675
1676void BindingTraits<Inspector::Protocol::Runtime::EntryPreview>::assertValueHasExpectedType(JSON::Value* value)
1677{
1678#if ASSERT_DISABLED
1679 UNUSED_PARAM(value);
1680#else
1681 ASSERT_ARG(value, value);
1682 RefPtr<JSON::Object> object;
1683 bool castSucceeded = value->asObject(object);
1684 ASSERT_UNUSED(castSucceeded, castSucceeded);
1685 {
1686 auto valuePos = object->find("value"_s);
1687 ASSERT(valuePos != object->end());
1688 BindingTraits<Inspector::Protocol::Runtime::ObjectPreview>::assertValueHasExpectedType(valuePos->value.get());
1689 }
1690
1691 int foundPropertiesCount = 1;
1692 {
1693 auto keyPos = object->find("key"_s);
1694 if (keyPos != object->end()) {
1695 BindingTraits<Inspector::Protocol::Runtime::ObjectPreview>::assertValueHasExpectedType(keyPos->value.get());
1696 ++foundPropertiesCount;
1697 }
1698 }
1699 if (foundPropertiesCount != object->size())
1700 FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
1701#endif // !ASSERT_DISABLED
1702}
1703
1704void BindingTraits<Inspector::Protocol::Runtime::CollectionEntry>::assertValueHasExpectedType(JSON::Value* value)
1705{
1706#if ASSERT_DISABLED
1707 UNUSED_PARAM(value);
1708#else
1709 ASSERT_ARG(value, value);
1710 RefPtr<JSON::Object> object;
1711 bool castSucceeded = value->asObject(object);
1712 ASSERT_UNUSED(castSucceeded, castSucceeded);
1713 {
1714 auto valuePos = object->find("value"_s);
1715 ASSERT(valuePos != object->end());
1716 BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::assertValueHasExpectedType(valuePos->value.get());
1717 }
1718
1719 int foundPropertiesCount = 1;
1720 {
1721 auto keyPos = object->find("key"_s);
1722 if (keyPos != object->end()) {
1723 BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::assertValueHasExpectedType(keyPos->value.get());
1724 ++foundPropertiesCount;
1725 }
1726 }
1727 if (foundPropertiesCount != object->size())
1728 FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
1729#endif // !ASSERT_DISABLED
1730}
1731
1732RefPtr<Inspector::Protocol::Runtime::CollectionEntry> BindingTraits<Inspector::Protocol::Runtime::CollectionEntry>::runtimeCast(RefPtr<JSON::Value>&& value)
1733{
1734 RefPtr<JSON::Object> result;
1735 bool castSucceeded = value->asObject(result);
1736 ASSERT_UNUSED(castSucceeded, castSucceeded);
1737 BindingTraits<Inspector::Protocol::Runtime::CollectionEntry>::assertValueHasExpectedType(result.get());
1738 COMPILE_ASSERT(sizeof(Inspector::Protocol::Runtime::CollectionEntry) == sizeof(JSON::ObjectBase), type_cast_problem);
1739 return static_cast<Inspector::Protocol::Runtime::CollectionEntry*>(static_cast<JSON::ObjectBase*>(result.get()));
1740}
1741
1742
1743void BindingTraits<Inspector::Protocol::Runtime::PropertyDescriptor>::assertValueHasExpectedType(JSON::Value* value)
1744{
1745#if ASSERT_DISABLED
1746 UNUSED_PARAM(value);
1747#else
1748 ASSERT_ARG(value, value);
1749 RefPtr<JSON::Object> object;
1750 bool castSucceeded = value->asObject(object);
1751 ASSERT_UNUSED(castSucceeded, castSucceeded);
1752 {
1753 auto namePos = object->find("name"_s);
1754 ASSERT(namePos != object->end());
1755 BindingTraits<String>::assertValueHasExpectedType(namePos->value.get());
1756 }
1757 {
1758 auto configurablePos = object->find("configurable"_s);
1759 ASSERT(configurablePos != object->end());
1760 BindingTraits<bool>::assertValueHasExpectedType(configurablePos->value.get());
1761 }
1762 {
1763 auto enumerablePos = object->find("enumerable"_s);
1764 ASSERT(enumerablePos != object->end());
1765 BindingTraits<bool>::assertValueHasExpectedType(enumerablePos->value.get());
1766 }
1767
1768 int foundPropertiesCount = 3;
1769 {
1770 auto valuePos = object->find("value"_s);
1771 if (valuePos != object->end()) {
1772 BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::assertValueHasExpectedType(valuePos->value.get());
1773 ++foundPropertiesCount;
1774 }
1775 }
1776 {
1777 auto writablePos = object->find("writable"_s);
1778 if (writablePos != object->end()) {
1779 BindingTraits<bool>::assertValueHasExpectedType(writablePos->value.get());
1780 ++foundPropertiesCount;
1781 }
1782 }
1783 {
1784 auto getPos = object->find("get"_s);
1785 if (getPos != object->end()) {
1786 BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::assertValueHasExpectedType(getPos->value.get());
1787 ++foundPropertiesCount;
1788 }
1789 }
1790 {
1791 auto setPos = object->find("set"_s);
1792 if (setPos != object->end()) {
1793 BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::assertValueHasExpectedType(setPos->value.get());
1794 ++foundPropertiesCount;
1795 }
1796 }
1797 {
1798 auto wasThrownPos = object->find("wasThrown"_s);
1799 if (wasThrownPos != object->end()) {
1800 BindingTraits<bool>::assertValueHasExpectedType(wasThrownPos->value.get());
1801 ++foundPropertiesCount;
1802 }
1803 }
1804 {
1805 auto isOwnPos = object->find("isOwn"_s);
1806 if (isOwnPos != object->end()) {
1807 BindingTraits<bool>::assertValueHasExpectedType(isOwnPos->value.get());
1808 ++foundPropertiesCount;
1809 }
1810 }
1811 {
1812 auto symbolPos = object->find("symbol"_s);
1813 if (symbolPos != object->end()) {
1814 BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::assertValueHasExpectedType(symbolPos->value.get());
1815 ++foundPropertiesCount;
1816 }
1817 }
1818 {
1819 auto nativeGetterPos = object->find("nativeGetter"_s);
1820 if (nativeGetterPos != object->end()) {
1821 BindingTraits<bool>::assertValueHasExpectedType(nativeGetterPos->value.get());
1822 ++foundPropertiesCount;
1823 }
1824 }
1825 if (foundPropertiesCount != object->size())
1826 FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
1827#endif // !ASSERT_DISABLED
1828}
1829
1830RefPtr<Inspector::Protocol::Runtime::PropertyDescriptor> BindingTraits<Inspector::Protocol::Runtime::PropertyDescriptor>::runtimeCast(RefPtr<JSON::Value>&& value)
1831{
1832 RefPtr<JSON::Object> result;
1833 bool castSucceeded = value->asObject(result);
1834 ASSERT_UNUSED(castSucceeded, castSucceeded);
1835 BindingTraits<Inspector::Protocol::Runtime::PropertyDescriptor>::assertValueHasExpectedType(result.get());
1836 COMPILE_ASSERT(sizeof(Inspector::Protocol::Runtime::PropertyDescriptor) == sizeof(JSON::ObjectBase), type_cast_problem);
1837 return static_cast<Inspector::Protocol::Runtime::PropertyDescriptor*>(static_cast<JSON::ObjectBase*>(result.get()));
1838}
1839
1840
1841void BindingTraits<Inspector::Protocol::Runtime::InternalPropertyDescriptor>::assertValueHasExpectedType(JSON::Value* value)
1842{
1843#if ASSERT_DISABLED
1844 UNUSED_PARAM(value);
1845#else
1846 ASSERT_ARG(value, value);
1847 RefPtr<JSON::Object> object;
1848 bool castSucceeded = value->asObject(object);
1849 ASSERT_UNUSED(castSucceeded, castSucceeded);
1850 {
1851 auto namePos = object->find("name"_s);
1852 ASSERT(namePos != object->end());
1853 BindingTraits<String>::assertValueHasExpectedType(namePos->value.get());
1854 }
1855
1856 int foundPropertiesCount = 1;
1857 {
1858 auto valuePos = object->find("value"_s);
1859 if (valuePos != object->end()) {
1860 BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::assertValueHasExpectedType(valuePos->value.get());
1861 ++foundPropertiesCount;
1862 }
1863 }
1864 if (foundPropertiesCount != object->size())
1865 FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
1866#endif // !ASSERT_DISABLED
1867}
1868
1869RefPtr<Inspector::Protocol::Runtime::InternalPropertyDescriptor> BindingTraits<Inspector::Protocol::Runtime::InternalPropertyDescriptor>::runtimeCast(RefPtr<JSON::Value>&& value)
1870{
1871 RefPtr<JSON::Object> result;
1872 bool castSucceeded = value->asObject(result);
1873 ASSERT_UNUSED(castSucceeded, castSucceeded);
1874 BindingTraits<Inspector::Protocol::Runtime::InternalPropertyDescriptor>::assertValueHasExpectedType(result.get());
1875 COMPILE_ASSERT(sizeof(Inspector::Protocol::Runtime::InternalPropertyDescriptor) == sizeof(JSON::ObjectBase), type_cast_problem);
1876 return static_cast<Inspector::Protocol::Runtime::InternalPropertyDescriptor*>(static_cast<JSON::ObjectBase*>(result.get()));
1877}
1878
1879
1880void BindingTraits<Inspector::Protocol::Timeline::EventType>::assertValueHasExpectedType(JSON::Value* value)
1881{
1882#if ASSERT_DISABLED
1883 UNUSED_PARAM(value);
1884#else
1885 ASSERT_ARG(value, value);
1886 String result;
1887 bool castSucceeded = value->asString(result);
1888 ASSERT(castSucceeded);
1889 ASSERT(result == "EventDispatch" || result == "ScheduleStyleRecalculation" || result == "RecalculateStyles" || result == "InvalidateLayout" || result == "Layout" || result == "Paint" || result == "Composite" || result == "RenderingFrame" || result == "TimerInstall" || result == "TimerRemove" || result == "TimerFire" || result == "EvaluateScript" || result == "TimeStamp" || result == "Time" || result == "TimeEnd" || result == "FunctionCall" || result == "ProbeSample" || result == "ConsoleProfile" || result == "RequestAnimationFrame" || result == "CancelAnimationFrame" || result == "FireAnimationFrame" || result == "ObserverCallback");
1890#endif // !ASSERT_DISABLED
1891}
1892
1893void BindingTraits<Inspector::Protocol::Timeline::TimelineEvent>::assertValueHasExpectedType(JSON::Value* value)
1894{
1895#if ASSERT_DISABLED
1896 UNUSED_PARAM(value);
1897#else
1898 ASSERT_ARG(value, value);
1899 RefPtr<JSON::Object> object;
1900 bool castSucceeded = value->asObject(object);
1901 ASSERT_UNUSED(castSucceeded, castSucceeded);
1902 {
1903 auto typePos = object->find("type"_s);
1904 ASSERT(typePos != object->end());
1905 BindingTraits<Inspector::Protocol::Timeline::EventType>::assertValueHasExpectedType(typePos->value.get());
1906 }
1907 {
1908 auto dataPos = object->find("data"_s);
1909 ASSERT(dataPos != object->end());
1910 BindingTraits<JSON::Object>::assertValueHasExpectedType(dataPos->value.get());
1911 }
1912 {
1913 auto childrenPos = object->find("children"_s);
1914 if (childrenPos != object->end()) {
1915 BindingTraits<JSON::ArrayOf<Inspector::Protocol::Timeline::TimelineEvent>>::assertValueHasExpectedType(childrenPos->value.get());
1916 }
1917 }
1918#endif // !ASSERT_DISABLED
1919}
1920
1921RefPtr<Inspector::Protocol::Timeline::TimelineEvent> BindingTraits<Inspector::Protocol::Timeline::TimelineEvent>::runtimeCast(RefPtr<JSON::Value>&& value)
1922{
1923 RefPtr<JSON::Object> result;
1924 bool castSucceeded = value->asObject(result);
1925 ASSERT_UNUSED(castSucceeded, castSucceeded);
1926 BindingTraits<Inspector::Protocol::Timeline::TimelineEvent>::assertValueHasExpectedType(result.get());
1927 COMPILE_ASSERT(sizeof(Inspector::Protocol::Timeline::TimelineEvent) == sizeof(JSON::ObjectBase), type_cast_problem);
1928 return static_cast<Inspector::Protocol::Timeline::TimelineEvent*>(static_cast<JSON::ObjectBase*>(result.get()));
1929}
1930
1931
1932} // namespace Protocol
1933
1934} // namespace Inspector
1935