]>
Commit | Line | Data |
---|---|---|
ed1e77d3 A |
1 | ### Begin File: InspectorAlternateBackendDispatchers.h |
2 | /* | |
3 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
4 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
5 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
18 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
26 | * THE POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | |
28 | ||
29 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
30 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
31 | ||
32 | #ifndef InspectorAlternateBackendDispatchers_h | |
33 | #define InspectorAlternateBackendDispatchers_h | |
34 | ||
35 | #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
36 | ||
37 | #include "InspectorProtocolTypes.h" | |
38 | #include <JavaScriptCore/InspectorBackendDispatcher.h> | |
39 | ||
40 | namespace Inspector { | |
41 | ||
42 | class AlternateBackendDispatcher { | |
43 | public: | |
44 | void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(dispatcher); } | |
45 | BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); } | |
46 | private: | |
47 | RefPtr<BackendDispatcher> m_backendDispatcher; | |
48 | }; | |
49 | ||
50 | ||
51 | class AlternateCommandDomainBackendDispatcher : public AlternateBackendDispatcher { | |
52 | public: | |
53 | virtual ~AlternateCommandDomainBackendDispatcher() { } | |
54 | virtual void commandWithEnumReturnValue(long callId) = 0; | |
55 | }; | |
56 | ||
57 | } // namespace Inspector | |
58 | ||
59 | #endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
60 | ||
61 | #endif // !defined(InspectorAlternateBackendDispatchers_h) | |
62 | ### End File: InspectorAlternateBackendDispatchers.h | |
63 | ||
64 | ### Begin File: InspectorBackendCommands.js | |
65 | /* | |
66 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
67 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
68 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
69 | * | |
70 | * Redistribution and use in source and binary forms, with or without | |
71 | * modification, are permitted provided that the following conditions | |
72 | * are met: | |
73 | * 1. Redistributions of source code must retain the above copyright | |
74 | * notice, this list of conditions and the following disclaimer. | |
75 | * 2. Redistributions in binary form must reproduce the above copyright | |
76 | * notice, this list of conditions and the following disclaimer in the | |
77 | * documentation and/or other materials provided with the distribution. | |
78 | * | |
79 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
80 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
81 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
82 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
83 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
84 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
85 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
86 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
87 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
88 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
89 | * THE POSSIBILITY OF SUCH DAMAGE. | |
90 | */ | |
91 | ||
92 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
93 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
94 | ||
95 | // TypeDomain. | |
96 | InspectorBackend.registerEnum("TypeDomain.TypeDomainEnum", {Shared: "shared", Red: "red", Green: "green", Blue: "blue"}); | |
97 | ||
98 | // CommandDomain. | |
99 | InspectorBackend.registerCommand("CommandDomain.commandWithEnumReturnValue", [], ["returnValue"]); | |
100 | InspectorBackend.activateDomain("CommandDomain"); | |
101 | ||
102 | // EventDomain. | |
103 | InspectorBackend.registerEventDomainDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "EventDomain"); | |
104 | InspectorBackend.registerEnum("EventDomain.EventWithEnumParameterParameter", {Shared: "shared", Black: "black", White: "white"}); | |
105 | InspectorBackend.registerEvent("EventDomain.eventWithEnumParameter", ["parameter"]); | |
106 | InspectorBackend.activateDomain("EventDomain"); | |
107 | ### End File: InspectorBackendCommands.js | |
108 | ||
109 | ### Begin File: InspectorBackendDispatchers.h | |
110 | /* | |
111 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
112 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
113 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
114 | * | |
115 | * Redistribution and use in source and binary forms, with or without | |
116 | * modification, are permitted provided that the following conditions | |
117 | * are met: | |
118 | * 1. Redistributions of source code must retain the above copyright | |
119 | * notice, this list of conditions and the following disclaimer. | |
120 | * 2. Redistributions in binary form must reproduce the above copyright | |
121 | * notice, this list of conditions and the following disclaimer in the | |
122 | * documentation and/or other materials provided with the distribution. | |
123 | * | |
124 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
125 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
126 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
127 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
128 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
129 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
130 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
131 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
132 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
133 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
134 | * THE POSSIBILITY OF SUCH DAMAGE. | |
135 | */ | |
136 | ||
137 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
138 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
139 | ||
140 | #ifndef InspectorBackendDispatchers_h | |
141 | #define InspectorBackendDispatchers_h | |
142 | ||
143 | #include "InspectorProtocolObjects.h" | |
144 | #include <inspector/InspectorBackendDispatcher.h> | |
145 | #include <wtf/text/WTFString.h> | |
146 | ||
147 | namespace Inspector { | |
148 | ||
149 | typedef String ErrorString; | |
150 | ||
151 | #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
152 | class AlternateCommandDomainBackendDispatcher; | |
153 | #endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
154 | ||
155 | class CommandDomainBackendDispatcherHandler { | |
156 | public: | |
157 | // Named after parameter 'returnValue' while generating command/event commandWithEnumReturnValue. | |
158 | enum class ReturnValue { | |
159 | Shared = 0, | |
160 | Cyan = 6, | |
161 | Magenta = 7, | |
162 | Yellow = 8, | |
163 | }; // enum class ReturnValue | |
164 | virtual void commandWithEnumReturnValue(ErrorString&, CommandDomainBackendDispatcherHandler::ReturnValue* out_returnValue) = 0; | |
165 | protected: | |
166 | virtual ~CommandDomainBackendDispatcherHandler(); | |
167 | }; | |
168 | ||
169 | class CommandDomainBackendDispatcher final : public SupplementalBackendDispatcher { | |
170 | public: | |
171 | static Ref<CommandDomainBackendDispatcher> create(BackendDispatcher*, CommandDomainBackendDispatcherHandler*); | |
172 | virtual void dispatch(long callId, const String& method, Ref<InspectorObject>&& message) override; | |
173 | private: | |
174 | void commandWithEnumReturnValue(long callId, const InspectorObject& message); | |
175 | private: | |
176 | CommandDomainBackendDispatcher(BackendDispatcher&, CommandDomainBackendDispatcherHandler*); | |
177 | CommandDomainBackendDispatcherHandler* m_agent; | |
178 | #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
179 | public: | |
180 | void setAlternateDispatcher(AlternateCommandDomainBackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; } | |
181 | private: | |
182 | AlternateCommandDomainBackendDispatcher* m_alternateDispatcher; | |
183 | #endif | |
184 | }; | |
185 | ||
186 | } // namespace Inspector | |
187 | ||
188 | #endif // !defined(InspectorBackendDispatchers_h) | |
189 | ### End File: InspectorBackendDispatchers.h | |
190 | ||
191 | ### Begin File: InspectorBackendDispatchers.cpp | |
192 | /* | |
193 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
194 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
195 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
196 | * | |
197 | * Redistribution and use in source and binary forms, with or without | |
198 | * modification, are permitted provided that the following conditions | |
199 | * are met: | |
200 | * 1. Redistributions of source code must retain the above copyright | |
201 | * notice, this list of conditions and the following disclaimer. | |
202 | * 2. Redistributions in binary form must reproduce the above copyright | |
203 | * notice, this list of conditions and the following disclaimer in the | |
204 | * documentation and/or other materials provided with the distribution. | |
205 | * | |
206 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
207 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
208 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
209 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
210 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
211 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
212 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
213 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
214 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
215 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
216 | * THE POSSIBILITY OF SUCH DAMAGE. | |
217 | */ | |
218 | ||
219 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
220 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
221 | ||
222 | #include "config.h" | |
223 | #include "InspectorBackendDispatchers.h" | |
224 | ||
225 | #include <inspector/InspectorFrontendChannel.h> | |
226 | #include <inspector/InspectorValues.h> | |
227 | #include <wtf/text/CString.h> | |
228 | ||
229 | #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
230 | #include "InspectorAlternateBackendDispatchers.h" | |
231 | #endif | |
232 | ||
233 | namespace Inspector { | |
234 | ||
235 | CommandDomainBackendDispatcherHandler::~CommandDomainBackendDispatcherHandler() { } | |
236 | ||
237 | Ref<CommandDomainBackendDispatcher> CommandDomainBackendDispatcher::create(BackendDispatcher* backendDispatcher, CommandDomainBackendDispatcherHandler* agent) | |
238 | { | |
239 | return adoptRef(*new CommandDomainBackendDispatcher(*backendDispatcher, agent)); | |
240 | } | |
241 | ||
242 | CommandDomainBackendDispatcher::CommandDomainBackendDispatcher(BackendDispatcher& backendDispatcher, CommandDomainBackendDispatcherHandler* agent) | |
243 | : SupplementalBackendDispatcher(backendDispatcher) | |
244 | , m_agent(agent) | |
245 | #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
246 | , m_alternateDispatcher(nullptr) | |
247 | #endif | |
248 | { | |
249 | m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("CommandDomain"), this); | |
250 | } | |
251 | ||
252 | void CommandDomainBackendDispatcher::dispatch(long callId, const String& method, Ref<InspectorObject>&& message) | |
253 | { | |
254 | Ref<CommandDomainBackendDispatcher> protect(*this); | |
255 | ||
256 | if (method == "commandWithEnumReturnValue") | |
257 | commandWithEnumReturnValue(callId, message); | |
258 | else | |
259 | m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::MethodNotFound, makeString('\'', "CommandDomain", '.', method, "' was not found")); | |
260 | } | |
261 | ||
262 | void CommandDomainBackendDispatcher::commandWithEnumReturnValue(long callId, const InspectorObject&) | |
263 | { | |
264 | #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
265 | if (m_alternateDispatcher) { | |
266 | m_alternateDispatcher->commandWithEnumReturnValue(callId); | |
267 | return; | |
268 | } | |
269 | #endif | |
270 | ||
271 | ErrorString error; | |
272 | Ref<InspectorObject> result = InspectorObject::create(); | |
273 | CommandDomainBackendDispatcherHandler::ReturnValue out_returnValue; | |
274 | m_agent->commandWithEnumReturnValue(error, &out_returnValue); | |
275 | ||
276 | if (!error.length()) | |
277 | result->setString(ASCIILiteral("returnValue"), Inspector::Protocol::getEnumConstantValue(out_returnValue)); | |
278 | ||
279 | m_backendDispatcher->sendResponse(callId, WTF::move(result), error); | |
280 | } | |
281 | ||
282 | } // namespace Inspector | |
283 | ||
284 | ### End File: InspectorBackendDispatchers.cpp | |
285 | ||
286 | ### Begin File: InspectorFrontendDispatchers.h | |
287 | /* | |
288 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
289 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
290 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
291 | * | |
292 | * Redistribution and use in source and binary forms, with or without | |
293 | * modification, are permitted provided that the following conditions | |
294 | * are met: | |
295 | * 1. Redistributions of source code must retain the above copyright | |
296 | * notice, this list of conditions and the following disclaimer. | |
297 | * 2. Redistributions in binary form must reproduce the above copyright | |
298 | * notice, this list of conditions and the following disclaimer in the | |
299 | * documentation and/or other materials provided with the distribution. | |
300 | * | |
301 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
302 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
303 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
304 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
305 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
306 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
307 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
308 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
309 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
310 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
311 | * THE POSSIBILITY OF SUCH DAMAGE. | |
312 | */ | |
313 | ||
314 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
315 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
316 | ||
317 | #ifndef InspectorFrontendDispatchers_h | |
318 | #define InspectorFrontendDispatchers_h | |
319 | ||
320 | #include "InspectorProtocolObjects.h" | |
321 | #include <inspector/InspectorFrontendChannel.h> | |
322 | #include <inspector/InspectorValues.h> | |
323 | #include <wtf/text/WTFString.h> | |
324 | ||
325 | namespace Inspector { | |
326 | ||
327 | ||
328 | ||
329 | class EventDomainFrontendDispatcher { | |
330 | public: | |
331 | EventDomainFrontendDispatcher(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { } | |
332 | // Named after parameter 'parameter' while generating command/event eventWithEnumParameter. | |
333 | enum class Parameter { | |
334 | Shared = 0, | |
335 | Black = 4, | |
336 | White = 5, | |
337 | }; // enum class Parameter | |
338 | void eventWithEnumParameter(Parameter parameter); | |
339 | private: | |
340 | FrontendChannel* m_frontendChannel; | |
341 | }; | |
342 | ||
343 | } // namespace Inspector | |
344 | ||
345 | #endif // !defined(InspectorFrontendDispatchers_h) | |
346 | ### End File: InspectorFrontendDispatchers.h | |
347 | ||
348 | ### Begin File: InspectorFrontendDispatchers.cpp | |
349 | /* | |
350 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
351 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
352 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
353 | * | |
354 | * Redistribution and use in source and binary forms, with or without | |
355 | * modification, are permitted provided that the following conditions | |
356 | * are met: | |
357 | * 1. Redistributions of source code must retain the above copyright | |
358 | * notice, this list of conditions and the following disclaimer. | |
359 | * 2. Redistributions in binary form must reproduce the above copyright | |
360 | * notice, this list of conditions and the following disclaimer in the | |
361 | * documentation and/or other materials provided with the distribution. | |
362 | * | |
363 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
364 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
365 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
366 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
367 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
368 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
369 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
370 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
371 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
372 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
373 | * THE POSSIBILITY OF SUCH DAMAGE. | |
374 | */ | |
375 | ||
376 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
377 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
378 | ||
379 | #include "config.h" | |
380 | #include "InspectorFrontendDispatchers.h" | |
381 | ||
382 | #include <wtf/text/CString.h> | |
383 | ||
384 | namespace Inspector { | |
385 | ||
386 | void EventDomainFrontendDispatcher::eventWithEnumParameter(Parameter parameter) | |
387 | { | |
388 | Ref<InspectorObject> jsonMessage = InspectorObject::create(); | |
389 | jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("EventDomain.eventWithEnumParameter")); | |
390 | Ref<InspectorObject> paramsObject = InspectorObject::create(); | |
391 | paramsObject->setString(ASCIILiteral("parameter"), Inspector::Protocol::getEnumConstantValue(parameter)); | |
392 | jsonMessage->setObject(ASCIILiteral("params"), WTF::move(paramsObject)); | |
393 | ||
394 | m_frontendChannel->sendMessageToFrontend(jsonMessage->toJSONString()); | |
395 | } | |
396 | ||
397 | } // namespace Inspector | |
398 | ||
399 | ### End File: InspectorFrontendDispatchers.cpp | |
400 | ||
401 | ### Begin File: InspectorProtocolObjects.h | |
402 | /* | |
403 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
404 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
405 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
406 | * | |
407 | * Redistribution and use in source and binary forms, with or without | |
408 | * modification, are permitted provided that the following conditions | |
409 | * are met: | |
410 | * 1. Redistributions of source code must retain the above copyright | |
411 | * notice, this list of conditions and the following disclaimer. | |
412 | * 2. Redistributions in binary form must reproduce the above copyright | |
413 | * notice, this list of conditions and the following disclaimer in the | |
414 | * documentation and/or other materials provided with the distribution. | |
415 | * | |
416 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
417 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
418 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
419 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
420 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
421 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
422 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
423 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
424 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
425 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
426 | * THE POSSIBILITY OF SUCH DAMAGE. | |
427 | */ | |
428 | ||
429 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
430 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
431 | ||
432 | #ifndef InspectorProtocolObjects_h | |
433 | #define InspectorProtocolObjects_h | |
434 | ||
435 | #include <inspector/InspectorProtocolTypes.h> | |
436 | #include <wtf/Assertions.h> | |
437 | ||
438 | namespace Inspector { | |
439 | ||
440 | ||
441 | ||
442 | namespace Protocol { | |
443 | ||
444 | // Forward declarations. | |
445 | namespace TypeDomain { | |
446 | enum class TypeDomainEnum; | |
447 | } // TypeDomain | |
448 | // End of forward declarations. | |
449 | ||
450 | ||
451 | ||
452 | ||
453 | String getEnumConstantValue(int code); | |
454 | ||
455 | template<typename T> String getEnumConstantValue(T enumValue) | |
456 | { | |
457 | return getEnumConstantValue(static_cast<int>(enumValue)); | |
458 | } | |
459 | ||
460 | namespace TypeDomain { | |
461 | /* */ | |
462 | enum class TypeDomainEnum { | |
463 | Shared = 0, | |
464 | Red = 1, | |
465 | Green = 2, | |
466 | Blue = 3, | |
467 | }; // enum class TypeDomainEnum | |
468 | } // TypeDomain | |
469 | ||
470 | ||
471 | ||
472 | } // namespace Protocol | |
473 | ||
474 | } // namespace Inspector | |
475 | ||
476 | #endif // !defined(InspectorProtocolObjects_h) | |
477 | ### End File: InspectorProtocolObjects.h | |
478 | ||
479 | ### Begin File: InspectorProtocolObjects.cpp | |
480 | /* | |
481 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
482 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
483 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
484 | * | |
485 | * Redistribution and use in source and binary forms, with or without | |
486 | * modification, are permitted provided that the following conditions | |
487 | * are met: | |
488 | * 1. Redistributions of source code must retain the above copyright | |
489 | * notice, this list of conditions and the following disclaimer. | |
490 | * 2. Redistributions in binary form must reproduce the above copyright | |
491 | * notice, this list of conditions and the following disclaimer in the | |
492 | * documentation and/or other materials provided with the distribution. | |
493 | * | |
494 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
495 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
496 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
497 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
498 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
499 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
500 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
501 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
502 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
503 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
504 | * THE POSSIBILITY OF SUCH DAMAGE. | |
505 | */ | |
506 | ||
507 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
508 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
509 | ||
510 | #include "config.h" | |
511 | #include "InspectorProtocolObjects.h" | |
512 | ||
513 | #include <wtf/text/CString.h> | |
514 | ||
515 | namespace Inspector { | |
516 | ||
517 | namespace Protocol { | |
518 | ||
519 | static const char* const enum_constant_values[] = { | |
520 | "shared", | |
521 | "red", | |
522 | "green", | |
523 | "blue", | |
524 | "black", | |
525 | "white", | |
526 | "cyan", | |
527 | "magenta", | |
528 | "yellow", | |
529 | }; | |
530 | ||
531 | String getEnumConstantValue(int code) { | |
532 | return enum_constant_values[code]; | |
533 | } | |
534 | ||
535 | ||
536 | ||
537 | } // namespace Protocol | |
538 | ||
539 | } // namespace Inspector | |
540 | ||
541 | ### End File: InspectorProtocolObjects.cpp | |
542 | ||
543 | ### Begin File: RWIProtocolBackendDispatchers.h | |
544 | /* | |
545 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
546 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
547 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
548 | * | |
549 | * Redistribution and use in source and binary forms, with or without | |
550 | * modification, are permitted provided that the following conditions | |
551 | * are met: | |
552 | * 1. Redistributions of source code must retain the above copyright | |
553 | * notice, this list of conditions and the following disclaimer. | |
554 | * 2. Redistributions in binary form must reproduce the above copyright | |
555 | * notice, this list of conditions and the following disclaimer in the | |
556 | * documentation and/or other materials provided with the distribution. | |
557 | * | |
558 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
559 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
560 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
561 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
562 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
563 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
564 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
565 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
566 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
567 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
568 | * THE POSSIBILITY OF SUCH DAMAGE. | |
569 | */ | |
570 | ||
571 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
572 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
573 | ||
574 | #include <JavaScriptCore/InspectorAlternateBackendDispatchers.h> | |
575 | #include <wtf/RetainPtr.h> | |
576 | ||
577 | @protocol RWIProtocolCommandDomainDomainHandler; | |
578 | ||
579 | namespace Inspector { | |
580 | ||
581 | ||
582 | ||
583 | ||
584 | class ObjCInspectorCommandDomainBackendDispatcher final : public AlternateCommandDomainBackendDispatcher { | |
585 | public: | |
586 | ObjCInspectorCommandDomainBackendDispatcher(id<RWIProtocolCommandDomainDomainHandler> handler) { m_delegate = handler; } | |
587 | virtual void commandWithEnumReturnValue(long callId) override; | |
588 | private: | |
589 | RetainPtr<id<RWIProtocolCommandDomainDomainHandler>> m_delegate; | |
590 | }; | |
591 | ||
592 | ||
593 | ||
594 | } // namespace Inspector | |
595 | ||
596 | ### End File: RWIProtocolBackendDispatchers.h | |
597 | ||
598 | ### Begin File: RWIProtocolConfiguration.mm | |
599 | /* | |
600 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
601 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
602 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
603 | * | |
604 | * Redistribution and use in source and binary forms, with or without | |
605 | * modification, are permitted provided that the following conditions | |
606 | * are met: | |
607 | * 1. Redistributions of source code must retain the above copyright | |
608 | * notice, this list of conditions and the following disclaimer. | |
609 | * 2. Redistributions in binary form must reproduce the above copyright | |
610 | * notice, this list of conditions and the following disclaimer in the | |
611 | * documentation and/or other materials provided with the distribution. | |
612 | * | |
613 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
614 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
615 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
616 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
617 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
618 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
619 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
620 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
621 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
622 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
623 | * THE POSSIBILITY OF SUCH DAMAGE. | |
624 | */ | |
625 | ||
626 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
627 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
628 | ||
629 | #import "config.h" | |
630 | #import "RWIProtocolConfiguration.h" | |
631 | ||
632 | #import "RWIProtocolInternal.h" | |
633 | #import "RWIProtocolBackendDispatchers.h" | |
634 | #import <JavaScriptCore/AlternateDispatchableAgent.h> | |
635 | #import <JavaScriptCore/AugmentableInspectorController.h> | |
636 | #import <JavaScriptCore/InspectorAlternateBackendDispatchers.h> | |
637 | #import <JavaScriptCore/InspectorBackendDispatchers.h> | |
638 | ||
639 | using namespace Inspector; | |
640 | ||
641 | @implementation RWIProtocolConfiguration | |
642 | { | |
643 | AugmentableInspectorController* _controller; | |
644 | id<RWIProtocolCommandDomainDomainHandler> _commandDomainHandler; | |
645 | RWIProtocolEventDomainDomainEventDispatcher *_eventDomainEventDispatcher; | |
646 | } | |
647 | ||
648 | - (instancetype)initWithController:(AugmentableInspectorController*)controller | |
649 | { | |
650 | self = [super init]; | |
651 | if (!self) | |
652 | return nil; | |
653 | ASSERT(controller); | |
654 | _controller = controller; | |
655 | return self; | |
656 | } | |
657 | ||
658 | - (void)dealloc | |
659 | { | |
660 | [_commandDomainHandler release]; | |
661 | [_eventDomainEventDispatcher release]; | |
662 | [super dealloc]; | |
663 | } | |
664 | ||
665 | - (void)setCommandDomainHandler:(id<RWIProtocolCommandDomainDomainHandler>)handler | |
666 | { | |
667 | if (handler == _commandDomainHandler) | |
668 | return; | |
669 | ||
670 | [_commandDomainHandler release]; | |
671 | _commandDomainHandler = [handler retain]; | |
672 | ||
673 | auto alternateDispatcher = std::make_unique<ObjCInspectorCommandDomainBackendDispatcher>(handler); | |
674 | auto alternateAgent = std::make_unique<AlternateDispatchableAgent<CommandDomainBackendDispatcher, AlternateCommandDomainBackendDispatcher>>(ASCIILiteral("CommandDomain"), WTF::move(alternateDispatcher)); | |
675 | _controller->appendExtraAgent(WTF::move(alternateAgent)); | |
676 | } | |
677 | ||
678 | - (id<RWIProtocolCommandDomainDomainHandler>)commandDomainHandler | |
679 | { | |
680 | return _commandDomainHandler; | |
681 | } | |
682 | ||
683 | - (RWIProtocolEventDomainDomainEventDispatcher *)eventDomainEventDispatcher | |
684 | { | |
685 | if (!_eventDomainEventDispatcher) | |
686 | _eventDomainEventDispatcher = [[RWIProtocolEventDomainDomainEventDispatcher alloc] initWithController:_controller]; | |
687 | return _eventDomainEventDispatcher; | |
688 | } | |
689 | ||
690 | @end | |
691 | ||
692 | ||
693 | ### End File: RWIProtocolConfiguration.mm | |
694 | ||
695 | ### Begin File: RWIProtocolConfiguration.h | |
696 | /* | |
697 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
698 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
699 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
700 | * | |
701 | * Redistribution and use in source and binary forms, with or without | |
702 | * modification, are permitted provided that the following conditions | |
703 | * are met: | |
704 | * 1. Redistributions of source code must retain the above copyright | |
705 | * notice, this list of conditions and the following disclaimer. | |
706 | * 2. Redistributions in binary form must reproduce the above copyright | |
707 | * notice, this list of conditions and the following disclaimer in the | |
708 | * documentation and/or other materials provided with the distribution. | |
709 | * | |
710 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
711 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
712 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
713 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
714 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
715 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
716 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
717 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
718 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
719 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
720 | * THE POSSIBILITY OF SUCH DAMAGE. | |
721 | */ | |
722 | ||
723 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
724 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
725 | ||
726 | #import "RWIProtocol.h" | |
727 | ||
728 | __attribute__((visibility ("default"))) | |
729 | @interface RWIProtocolConfiguration : NSObject | |
730 | @property (nonatomic, retain, setter=setCommandDomainHandler:) id<RWIProtocolCommandDomainDomainHandler> commandDomainHandler; | |
731 | @property (nonatomic, readonly) RWIProtocolEventDomainDomainEventDispatcher *eventDomainEventDispatcher; | |
732 | @end | |
733 | ||
734 | ||
735 | ### End File: RWIProtocolConfiguration.h | |
736 | ||
737 | ### Begin File: RWIProtocolBackendDispatchers.mm | |
738 | /* | |
739 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
740 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
741 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
742 | * | |
743 | * Redistribution and use in source and binary forms, with or without | |
744 | * modification, are permitted provided that the following conditions | |
745 | * are met: | |
746 | * 1. Redistributions of source code must retain the above copyright | |
747 | * notice, this list of conditions and the following disclaimer. | |
748 | * 2. Redistributions in binary form must reproduce the above copyright | |
749 | * notice, this list of conditions and the following disclaimer in the | |
750 | * documentation and/or other materials provided with the distribution. | |
751 | * | |
752 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
753 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
754 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
755 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
756 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
757 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
758 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
759 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
760 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
761 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
762 | * THE POSSIBILITY OF SUCH DAMAGE. | |
763 | */ | |
764 | ||
765 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
766 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
767 | ||
768 | #import "config.h" | |
769 | #import "RWIProtocolBackendDispatchers.h" | |
770 | ||
771 | #include "RWIProtocolInternal.h" | |
772 | #include "RWIProtocolEnumConversionHelpers.h" | |
773 | #include <JavaScriptCore/InspectorFrontendChannel.h> | |
774 | #include <JavaScriptCore/InspectorValues.h> | |
775 | ||
776 | namespace Inspector { | |
777 | ||
778 | ||
779 | ||
780 | void ObjCInspectorCommandDomainBackendDispatcher::commandWithEnumReturnValue(long callId) | |
781 | { | |
782 | id errorCallback = ^(NSString *error) { | |
783 | backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); | |
784 | }; | |
785 | ||
786 | id successCallback = ^(RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValue returnValue) { | |
787 | Ref<InspectorObject> resultObject = InspectorObject::create(); | |
788 | resultObject->setString(ASCIILiteral("returnValue"), toProtocolString(returnValue)); | |
789 | backendDispatcher()->sendResponse(callId, WTF::move(resultObject), String()); | |
790 | }; | |
791 | ||
792 | [m_delegate commandWithEnumReturnValueWithErrorCallback:errorCallback successCallback:successCallback]; | |
793 | } | |
794 | ||
795 | ||
796 | ||
797 | ||
798 | } // namespace Inspector | |
799 | ||
800 | ### End File: RWIProtocolBackendDispatchers.mm | |
801 | ||
802 | ### Begin File: RWIProtocolEnumConversionHelpers.h | |
803 | /* | |
804 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
805 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
806 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
807 | * | |
808 | * Redistribution and use in source and binary forms, with or without | |
809 | * modification, are permitted provided that the following conditions | |
810 | * are met: | |
811 | * 1. Redistributions of source code must retain the above copyright | |
812 | * notice, this list of conditions and the following disclaimer. | |
813 | * 2. Redistributions in binary form must reproduce the above copyright | |
814 | * notice, this list of conditions and the following disclaimer in the | |
815 | * documentation and/or other materials provided with the distribution. | |
816 | * | |
817 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
818 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
819 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
820 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
821 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
822 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
823 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
824 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
825 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
826 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
827 | * THE POSSIBILITY OF SUCH DAMAGE. | |
828 | */ | |
829 | ||
830 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
831 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
832 | ||
833 | #import "RWIProtocolArrayConversionHelpers.h" | |
834 | ||
835 | namespace Inspector { | |
836 | ||
837 | template<typename ObjCEnumType> | |
838 | ObjCEnumType fromProtocolString(const String& value); | |
839 | ||
840 | ||
841 | inline String toProtocolString(RWIProtocolTypeDomainEnum value) | |
842 | { | |
843 | switch(value) { | |
844 | case RWIProtocolTypeDomainEnumShared: | |
845 | return ASCIILiteral("shared"); | |
846 | case RWIProtocolTypeDomainEnumRed: | |
847 | return ASCIILiteral("red"); | |
848 | case RWIProtocolTypeDomainEnumGreen: | |
849 | return ASCIILiteral("green"); | |
850 | case RWIProtocolTypeDomainEnumBlue: | |
851 | return ASCIILiteral("blue"); | |
852 | } | |
853 | } | |
854 | ||
855 | template<> | |
856 | inline RWIProtocolTypeDomainEnum fromProtocolString(const String& value) | |
857 | { | |
858 | if (value == "shared") | |
859 | return RWIProtocolTypeDomainEnumShared; | |
860 | if (value == "red") | |
861 | return RWIProtocolTypeDomainEnumRed; | |
862 | if (value == "green") | |
863 | return RWIProtocolTypeDomainEnumGreen; | |
864 | if (value == "blue") | |
865 | return RWIProtocolTypeDomainEnumBlue; | |
866 | ASSERT_NOT_REACHED(); | |
867 | return RWIProtocolTypeDomainEnumShared; | |
868 | } | |
869 | ||
870 | ||
871 | inline String toProtocolString(RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValue value) | |
872 | { | |
873 | switch(value) { | |
874 | case RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueShared: | |
875 | return ASCIILiteral("shared"); | |
876 | case RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueCyan: | |
877 | return ASCIILiteral("cyan"); | |
878 | case RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueMagenta: | |
879 | return ASCIILiteral("magenta"); | |
880 | case RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueYellow: | |
881 | return ASCIILiteral("yellow"); | |
882 | } | |
883 | } | |
884 | ||
885 | template<> | |
886 | inline RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValue fromProtocolString(const String& value) | |
887 | { | |
888 | if (value == "shared") | |
889 | return RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueShared; | |
890 | if (value == "cyan") | |
891 | return RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueCyan; | |
892 | if (value == "magenta") | |
893 | return RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueMagenta; | |
894 | if (value == "yellow") | |
895 | return RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueYellow; | |
896 | ASSERT_NOT_REACHED(); | |
897 | return RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueShared; | |
898 | } | |
899 | ||
900 | ||
901 | inline String toProtocolString(RWIProtocolEventDomainEventWithEnumParameterParameter value) | |
902 | { | |
903 | switch(value) { | |
904 | case RWIProtocolEventDomainEventWithEnumParameterParameterShared: | |
905 | return ASCIILiteral("shared"); | |
906 | case RWIProtocolEventDomainEventWithEnumParameterParameterBlack: | |
907 | return ASCIILiteral("black"); | |
908 | case RWIProtocolEventDomainEventWithEnumParameterParameterWhite: | |
909 | return ASCIILiteral("white"); | |
910 | } | |
911 | } | |
912 | ||
913 | template<> | |
914 | inline RWIProtocolEventDomainEventWithEnumParameterParameter fromProtocolString(const String& value) | |
915 | { | |
916 | if (value == "shared") | |
917 | return RWIProtocolEventDomainEventWithEnumParameterParameterShared; | |
918 | if (value == "black") | |
919 | return RWIProtocolEventDomainEventWithEnumParameterParameterBlack; | |
920 | if (value == "white") | |
921 | return RWIProtocolEventDomainEventWithEnumParameterParameterWhite; | |
922 | ASSERT_NOT_REACHED(); | |
923 | return RWIProtocolEventDomainEventWithEnumParameterParameterShared; | |
924 | } | |
925 | ||
926 | } // namespace Inspector | |
927 | ||
928 | ### End File: RWIProtocolEnumConversionHelpers.h | |
929 | ||
930 | ### Begin File: RWIProtocolEventDispatchers.mm | |
931 | /* | |
932 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
933 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
934 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
935 | * | |
936 | * Redistribution and use in source and binary forms, with or without | |
937 | * modification, are permitted provided that the following conditions | |
938 | * are met: | |
939 | * 1. Redistributions of source code must retain the above copyright | |
940 | * notice, this list of conditions and the following disclaimer. | |
941 | * 2. Redistributions in binary form must reproduce the above copyright | |
942 | * notice, this list of conditions and the following disclaimer in the | |
943 | * documentation and/or other materials provided with the distribution. | |
944 | * | |
945 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
946 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
947 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
948 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
949 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
950 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
951 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
952 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
953 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
954 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
955 | * THE POSSIBILITY OF SUCH DAMAGE. | |
956 | */ | |
957 | ||
958 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
959 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
960 | ||
961 | #import "config.h" | |
962 | #import "RWIProtocolInternal.h" | |
963 | ||
964 | #import "RWIProtocolEnumConversionHelpers.h" | |
965 | #import <JavaScriptCore/InspectorFrontendChannel.h> | |
966 | #import <JavaScriptCore/InspectorValues.h> | |
967 | ||
968 | using namespace Inspector; | |
969 | ||
970 | ||
971 | ||
972 | ||
973 | ||
974 | @implementation RWIProtocolEventDomainDomainEventDispatcher | |
975 | { | |
976 | AugmentableInspectorController* _controller; | |
977 | } | |
978 | ||
979 | - (instancetype)initWithController:(AugmentableInspectorController*)controller; | |
980 | { | |
981 | self = [super init]; | |
982 | if (!self) | |
983 | return nil; | |
984 | ASSERT(controller); | |
985 | _controller = controller; | |
986 | return self; | |
987 | } | |
988 | ||
989 | - (void)eventWithEnumParameterWithParameter:(RWIProtocolEventDomainEventWithEnumParameterParameter)parameter | |
990 | { | |
991 | FrontendChannel* frontendChannel = _controller->frontendChannel(); | |
992 | if (!frontendChannel) | |
993 | return; | |
994 | ||
995 | Ref<InspectorObject> jsonMessage = InspectorObject::create(); | |
996 | jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("EventDomain.eventWithEnumParameter")); | |
997 | Ref<InspectorObject> paramsObject = InspectorObject::create(); | |
998 | paramsObject->setString(ASCIILiteral("parameter"), toProtocolString(parameter)); | |
999 | jsonMessage->setObject(ASCIILiteral("params"), WTF::move(paramsObject)); | |
1000 | frontendChannel->sendMessageToFrontend(jsonMessage->toJSONString()); | |
1001 | } | |
1002 | ||
1003 | @end | |
1004 | ||
1005 | ||
1006 | ### End File: RWIProtocolEventDispatchers.mm | |
1007 | ||
1008 | ### Begin File: RWIProtocol.h | |
1009 | /* | |
1010 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
1011 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
1012 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
1013 | * | |
1014 | * Redistribution and use in source and binary forms, with or without | |
1015 | * modification, are permitted provided that the following conditions | |
1016 | * are met: | |
1017 | * 1. Redistributions of source code must retain the above copyright | |
1018 | * notice, this list of conditions and the following disclaimer. | |
1019 | * 2. Redistributions in binary form must reproduce the above copyright | |
1020 | * notice, this list of conditions and the following disclaimer in the | |
1021 | * documentation and/or other materials provided with the distribution. | |
1022 | * | |
1023 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
1024 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
1025 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
1026 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
1027 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
1028 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
1029 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
1030 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
1031 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
1032 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
1033 | * THE POSSIBILITY OF SUCH DAMAGE. | |
1034 | */ | |
1035 | ||
1036 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
1037 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
1038 | ||
1039 | #import <Foundation/Foundation.h> | |
1040 | ||
1041 | #import <WebInspector/RWIProtocolJSONObject.h> | |
1042 | ||
1043 | ||
1044 | ||
1045 | ||
1046 | ||
1047 | typedef NS_ENUM(NSInteger, RWIProtocolTypeDomainEnum) { | |
1048 | RWIProtocolTypeDomainEnumShared, | |
1049 | RWIProtocolTypeDomainEnumRed, | |
1050 | RWIProtocolTypeDomainEnumGreen, | |
1051 | RWIProtocolTypeDomainEnumBlue, | |
1052 | }; | |
1053 | ||
1054 | typedef NS_ENUM(NSInteger, RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValue) { | |
1055 | RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueShared, | |
1056 | RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueCyan, | |
1057 | RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueMagenta, | |
1058 | RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueYellow, | |
1059 | }; | |
1060 | ||
1061 | typedef NS_ENUM(NSInteger, RWIProtocolEventDomainEventWithEnumParameterParameter) { | |
1062 | RWIProtocolEventDomainEventWithEnumParameterParameterShared, | |
1063 | RWIProtocolEventDomainEventWithEnumParameterParameterBlack, | |
1064 | RWIProtocolEventDomainEventWithEnumParameterParameterWhite, | |
1065 | }; | |
1066 | ||
1067 | ||
1068 | ||
1069 | @protocol RWIProtocolCommandDomainDomainHandler <NSObject> | |
1070 | @required | |
1071 | - (void)commandWithEnumReturnValueWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValue returnValue))successCallback; | |
1072 | @end | |
1073 | ||
1074 | __attribute__((visibility ("default"))) | |
1075 | @interface RWIProtocolEventDomainDomainEventDispatcher : NSObject | |
1076 | - (void)eventWithEnumParameterWithParameter:(RWIProtocolEventDomainEventWithEnumParameterParameter)parameter; | |
1077 | @end | |
1078 | ||
1079 | ||
1080 | ### End File: RWIProtocol.h | |
1081 | ||
1082 | ### Begin File: RWIProtocolTypes.mm | |
1083 | /* | |
1084 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
1085 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
1086 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
1087 | * | |
1088 | * Redistribution and use in source and binary forms, with or without | |
1089 | * modification, are permitted provided that the following conditions | |
1090 | * are met: | |
1091 | * 1. Redistributions of source code must retain the above copyright | |
1092 | * notice, this list of conditions and the following disclaimer. | |
1093 | * 2. Redistributions in binary form must reproduce the above copyright | |
1094 | * notice, this list of conditions and the following disclaimer in the | |
1095 | * documentation and/or other materials provided with the distribution. | |
1096 | * | |
1097 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
1098 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
1099 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
1100 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
1101 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
1102 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
1103 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
1104 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
1105 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
1106 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
1107 | * THE POSSIBILITY OF SUCH DAMAGE. | |
1108 | */ | |
1109 | ||
1110 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
1111 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
1112 | ||
1113 | #import "config.h" | |
1114 | #import "RWIProtocolInternal.h" | |
1115 | ||
1116 | #import "RWIProtocolEnumConversionHelpers.h" | |
1117 | #import <JavaScriptCore/InspectorValues.h> | |
1118 | #import <wtf/Assertions.h> | |
1119 | ||
1120 | using namespace Inspector; | |
1121 | ||
1122 | ||
1123 | ||
1124 | ||
1125 | ||
1126 | ||
1127 | ||
1128 | ||
1129 | ### End File: RWIProtocolTypes.mm | |
1130 | ||
1131 | ### Begin File: RWIProtocolInternal.h | |
1132 | /* | |
1133 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
1134 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
1135 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
1136 | * | |
1137 | * Redistribution and use in source and binary forms, with or without | |
1138 | * modification, are permitted provided that the following conditions | |
1139 | * are met: | |
1140 | * 1. Redistributions of source code must retain the above copyright | |
1141 | * notice, this list of conditions and the following disclaimer. | |
1142 | * 2. Redistributions in binary form must reproduce the above copyright | |
1143 | * notice, this list of conditions and the following disclaimer in the | |
1144 | * documentation and/or other materials provided with the distribution. | |
1145 | * | |
1146 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
1147 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
1148 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
1149 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
1150 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
1151 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
1152 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
1153 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
1154 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
1155 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
1156 | * THE POSSIBILITY OF SUCH DAMAGE. | |
1157 | */ | |
1158 | ||
1159 | // DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json | |
1160 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
1161 | ||
1162 | #import "RWIProtocol.h" | |
1163 | #import "RWIProtocolJSONObjectInternal.h" | |
1164 | #import <JavaScriptCore/AugmentableInspectorController.h> | |
1165 | #import <JavaScriptCore/InspectorValues.h> | |
1166 | ||
1167 | @interface RWIProtocolEventDomainDomainEventDispatcher (Private) | |
1168 | - (instancetype)initWithController:(Inspector::AugmentableInspectorController*)controller; | |
1169 | @end | |
1170 | ||
1171 | ||
1172 | ### End File: RWIProtocolInternal.h |