]>
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 commands-with-async-attribute.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 AlternateDatabaseBackendDispatcher : public AlternateBackendDispatcher { | |
52 | public: | |
53 | virtual ~AlternateDatabaseBackendDispatcher() { } | |
54 | virtual void executeSQLSyncOptionalReturnValues(long callId, int in_databaseId, const String& in_query) = 0; | |
55 | virtual void executeSQLAsyncOptionalReturnValues(long callId, int in_databaseId, const String& in_query) = 0; | |
56 | virtual void executeSQLSync(long callId, int in_databaseId, const String& in_query) = 0; | |
57 | virtual void executeSQLAsync(long callId, int in_databaseId, const String& in_query) = 0; | |
58 | }; | |
59 | ||
60 | } // namespace Inspector | |
61 | ||
62 | #endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
63 | ||
64 | #endif // !defined(InspectorAlternateBackendDispatchers_h) | |
65 | ### End File: InspectorAlternateBackendDispatchers.h | |
66 | ||
67 | ### Begin File: InspectorBackendCommands.js | |
68 | /* | |
69 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
70 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
71 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
72 | * | |
73 | * Redistribution and use in source and binary forms, with or without | |
74 | * modification, are permitted provided that the following conditions | |
75 | * are met: | |
76 | * 1. Redistributions of source code must retain the above copyright | |
77 | * notice, this list of conditions and the following disclaimer. | |
78 | * 2. Redistributions in binary form must reproduce the above copyright | |
79 | * notice, this list of conditions and the following disclaimer in the | |
80 | * documentation and/or other materials provided with the distribution. | |
81 | * | |
82 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
83 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
84 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
85 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
86 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
87 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
88 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
89 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
90 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
91 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
92 | * THE POSSIBILITY OF SUCH DAMAGE. | |
93 | */ | |
94 | ||
95 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
96 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
97 | ||
98 | // Database. | |
99 | InspectorBackend.registerDatabaseDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Database"); | |
100 | InspectorBackend.registerEnum("Database.PrimaryColors", {Red: "red", Green: "green", Blue: "blue"}); | |
101 | InspectorBackend.registerCommand("Database.executeSQLSyncOptionalReturnValues", [{"name": "databaseId", "type": "number", "optional": false}, {"name": "query", "type": "string", "optional": false}], ["columnNames", "notes", "timestamp", "values", "payload", "databaseId", "sqlError", "screenColor", "alternateColors", "printColor"]); | |
102 | InspectorBackend.registerCommand("Database.executeSQLAsyncOptionalReturnValues", [{"name": "databaseId", "type": "number", "optional": false}, {"name": "query", "type": "string", "optional": false}], ["columnNames", "notes", "timestamp", "values", "payload", "databaseId", "sqlError", "screenColor", "alternateColors", "printColor"]); | |
103 | InspectorBackend.registerCommand("Database.executeSQLSync", [{"name": "databaseId", "type": "number", "optional": false}, {"name": "query", "type": "string", "optional": false}], ["columnNames", "notes", "timestamp", "values", "payload", "databaseId", "sqlError", "alternateColors", "screenColor", "printColor"]); | |
104 | InspectorBackend.registerCommand("Database.executeSQLAsync", [{"name": "databaseId", "type": "number", "optional": false}, {"name": "query", "type": "string", "optional": false}], ["columnNames", "notes", "timestamp", "values", "payload", "databaseId", "sqlError", "screenColor", "alternateColors", "printColor"]); | |
105 | InspectorBackend.activateDomain("Database"); | |
106 | ### End File: InspectorBackendCommands.js | |
107 | ||
108 | ### Begin File: InspectorBackendDispatchers.h | |
109 | /* | |
110 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
111 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
112 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
113 | * | |
114 | * Redistribution and use in source and binary forms, with or without | |
115 | * modification, are permitted provided that the following conditions | |
116 | * are met: | |
117 | * 1. Redistributions of source code must retain the above copyright | |
118 | * notice, this list of conditions and the following disclaimer. | |
119 | * 2. Redistributions in binary form must reproduce the above copyright | |
120 | * notice, this list of conditions and the following disclaimer in the | |
121 | * documentation and/or other materials provided with the distribution. | |
122 | * | |
123 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
124 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
125 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
126 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
127 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
128 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
129 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
130 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
131 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
132 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
133 | * THE POSSIBILITY OF SUCH DAMAGE. | |
134 | */ | |
135 | ||
136 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
137 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
138 | ||
139 | #ifndef InspectorBackendDispatchers_h | |
140 | #define InspectorBackendDispatchers_h | |
141 | ||
142 | #include "InspectorProtocolObjects.h" | |
143 | #include <inspector/InspectorBackendDispatcher.h> | |
144 | #include <wtf/text/WTFString.h> | |
145 | ||
146 | namespace Inspector { | |
147 | ||
148 | typedef String ErrorString; | |
149 | ||
150 | #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
151 | class AlternateDatabaseBackendDispatcher; | |
152 | #endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
153 | ||
154 | class DatabaseBackendDispatcherHandler { | |
155 | public: | |
156 | // Named after parameter 'screenColor' while generating command/event executeSQLSyncOptionalReturnValues. | |
157 | enum class ScreenColor { | |
158 | Red = 0, | |
159 | Green = 1, | |
160 | Blue = 2, | |
161 | }; // enum class ScreenColor | |
162 | // Named after parameter 'printColor' while generating command/event executeSQLSyncOptionalReturnValues. | |
163 | enum class PrintColor { | |
164 | Cyan = 3, | |
165 | Magenta = 4, | |
166 | Yellow = 5, | |
167 | Black = 6, | |
168 | }; // enum class PrintColor | |
169 | virtual void executeSQLSyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, RefPtr<Inspector::Protocol::Array<String>>& opt_out_columnNames, Inspector::Protocol::OptOutput<String>* opt_out_notes, Inspector::Protocol::OptOutput<double>* opt_out_timestamp, Inspector::Protocol::OptOutput<Inspector::InspectorObject>* opt_out_values, Inspector::Protocol::OptOutput<Inspector::InspectorValue>* opt_out_payload, Inspector::Protocol::OptOutput<int>* opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0; | |
170 | class ExecuteSQLAsyncOptionalReturnValuesCallback : public BackendDispatcher::CallbackBase { | |
171 | public: | |
172 | ExecuteSQLAsyncOptionalReturnValuesCallback(Ref<BackendDispatcher>&&, int id); | |
173 | void sendSuccess(RefPtr<Inspector::Protocol::Array<String>>&& columnNames, Inspector::Protocol::OptOutput<String>* notes, Inspector::Protocol::OptOutput<double>* timestamp, Inspector::Protocol::OptOutput<Inspector::InspectorObject>* values, Inspector::Protocol::OptOutput<Inspector::InspectorValue>* payload, Inspector::Protocol::OptOutput<int>* databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, Inspector::Protocol::OptOutput<String>* screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, Inspector::Protocol::OptOutput<String>* printColor); | |
174 | }; | |
175 | virtual void executeSQLAsyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, Ref<ExecuteSQLAsyncOptionalReturnValuesCallback>&& callback) = 0; | |
176 | virtual void executeSQLSync(ErrorString&, int in_databaseId, const String& in_query, RefPtr<Inspector::Protocol::Array<String>>& out_columnNames, String* out_notes, double* out_timestamp, Inspector::InspectorObject* out_values, Inspector::InspectorValue* out_payload, int* out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& out_sqlError, RefPtr<Inspector::Protocol::Database::ColorList>& out_alternateColors, Inspector::Protocol::Database::PrimaryColors* out_screenColor, DatabaseBackendDispatcherHandler::PrintColor* out_printColor) = 0; | |
177 | class ExecuteSQLAsyncCallback : public BackendDispatcher::CallbackBase { | |
178 | public: | |
179 | ExecuteSQLAsyncCallback(Ref<BackendDispatcher>&&, int id); | |
180 | void sendSuccess(RefPtr<Inspector::Protocol::Array<String>>&& columnNames, const String& notes, double timestamp, Inspector::InspectorObject values, Inspector::InspectorValue payload, int databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, const String& screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, const String& printColor); | |
181 | }; | |
182 | virtual void executeSQLAsync(ErrorString&, int in_databaseId, const String& in_query, Ref<ExecuteSQLAsyncCallback>&& callback) = 0; | |
183 | protected: | |
184 | virtual ~DatabaseBackendDispatcherHandler(); | |
185 | }; | |
186 | ||
187 | class DatabaseBackendDispatcher final : public SupplementalBackendDispatcher { | |
188 | public: | |
189 | static Ref<DatabaseBackendDispatcher> create(BackendDispatcher*, DatabaseBackendDispatcherHandler*); | |
190 | virtual void dispatch(long callId, const String& method, Ref<InspectorObject>&& message) override; | |
191 | private: | |
192 | void executeSQLSyncOptionalReturnValues(long callId, const InspectorObject& message); | |
193 | void executeSQLAsyncOptionalReturnValues(long callId, const InspectorObject& message); | |
194 | void executeSQLSync(long callId, const InspectorObject& message); | |
195 | void executeSQLAsync(long callId, const InspectorObject& message); | |
196 | private: | |
197 | DatabaseBackendDispatcher(BackendDispatcher&, DatabaseBackendDispatcherHandler*); | |
198 | DatabaseBackendDispatcherHandler* m_agent; | |
199 | #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
200 | public: | |
201 | void setAlternateDispatcher(AlternateDatabaseBackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; } | |
202 | private: | |
203 | AlternateDatabaseBackendDispatcher* m_alternateDispatcher; | |
204 | #endif | |
205 | }; | |
206 | ||
207 | } // namespace Inspector | |
208 | ||
209 | #endif // !defined(InspectorBackendDispatchers_h) | |
210 | ### End File: InspectorBackendDispatchers.h | |
211 | ||
212 | ### Begin File: InspectorBackendDispatchers.cpp | |
213 | /* | |
214 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
215 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
216 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
217 | * | |
218 | * Redistribution and use in source and binary forms, with or without | |
219 | * modification, are permitted provided that the following conditions | |
220 | * are met: | |
221 | * 1. Redistributions of source code must retain the above copyright | |
222 | * notice, this list of conditions and the following disclaimer. | |
223 | * 2. Redistributions in binary form must reproduce the above copyright | |
224 | * notice, this list of conditions and the following disclaimer in the | |
225 | * documentation and/or other materials provided with the distribution. | |
226 | * | |
227 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
228 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
229 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
230 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
231 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
232 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
233 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
234 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
235 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
236 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
237 | * THE POSSIBILITY OF SUCH DAMAGE. | |
238 | */ | |
239 | ||
240 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
241 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
242 | ||
243 | #include "config.h" | |
244 | #include "InspectorBackendDispatchers.h" | |
245 | ||
246 | #include <inspector/InspectorFrontendChannel.h> | |
247 | #include <inspector/InspectorValues.h> | |
248 | #include <wtf/text/CString.h> | |
249 | ||
250 | #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
251 | #include "InspectorAlternateBackendDispatchers.h" | |
252 | #endif | |
253 | ||
254 | namespace Inspector { | |
255 | ||
256 | DatabaseBackendDispatcherHandler::~DatabaseBackendDispatcherHandler() { } | |
257 | ||
258 | Ref<DatabaseBackendDispatcher> DatabaseBackendDispatcher::create(BackendDispatcher* backendDispatcher, DatabaseBackendDispatcherHandler* agent) | |
259 | { | |
260 | return adoptRef(*new DatabaseBackendDispatcher(*backendDispatcher, agent)); | |
261 | } | |
262 | ||
263 | DatabaseBackendDispatcher::DatabaseBackendDispatcher(BackendDispatcher& backendDispatcher, DatabaseBackendDispatcherHandler* agent) | |
264 | : SupplementalBackendDispatcher(backendDispatcher) | |
265 | , m_agent(agent) | |
266 | #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
267 | , m_alternateDispatcher(nullptr) | |
268 | #endif | |
269 | { | |
270 | m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("Database"), this); | |
271 | } | |
272 | ||
273 | void DatabaseBackendDispatcher::dispatch(long callId, const String& method, Ref<InspectorObject>&& message) | |
274 | { | |
275 | Ref<DatabaseBackendDispatcher> protect(*this); | |
276 | ||
277 | if (method == "executeSQLSyncOptionalReturnValues") | |
278 | executeSQLSyncOptionalReturnValues(callId, message); | |
279 | else if (method == "executeSQLAsyncOptionalReturnValues") | |
280 | executeSQLAsyncOptionalReturnValues(callId, message); | |
281 | else if (method == "executeSQLSync") | |
282 | executeSQLSync(callId, message); | |
283 | else if (method == "executeSQLAsync") | |
284 | executeSQLAsync(callId, message); | |
285 | else | |
286 | m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::MethodNotFound, makeString('\'', "Database", '.', method, "' was not found")); | |
287 | } | |
288 | ||
289 | void DatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long callId, const InspectorObject& message) | |
290 | { | |
291 | auto protocolErrors = Inspector::Protocol::Array<String>::create(); | |
292 | RefPtr<InspectorObject> paramsContainer; | |
293 | message.getObject(ASCIILiteral("params"), paramsContainer); | |
294 | int in_databaseId = BackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), nullptr, protocolErrors.get()); | |
295 | String in_query = BackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("query"), nullptr, protocolErrors.get()); | |
296 | if (protocolErrors->length()) { | |
297 | String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSyncOptionalReturnValues"); | |
298 | m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors)); | |
299 | return; | |
300 | } | |
301 | ||
302 | #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
303 | if (m_alternateDispatcher) { | |
304 | m_alternateDispatcher->executeSQLSyncOptionalReturnValues(callId, in_databaseId, in_query); | |
305 | return; | |
306 | } | |
307 | #endif | |
308 | ||
309 | ErrorString error; | |
310 | Ref<InspectorObject> result = InspectorObject::create(); | |
311 | RefPtr<Inspector::Protocol::Array<String>> out_columnNames; | |
312 | Inspector::Protocol::OptOutput<String> out_notes; | |
313 | Inspector::Protocol::OptOutput<double> out_timestamp; | |
314 | Inspector::Protocol::OptOutput<Inspector::InspectorObject> out_values; | |
315 | Inspector::Protocol::OptOutput<Inspector::InspectorValue> out_payload; | |
316 | Inspector::Protocol::OptOutput<Inspector::Protocol::Database::DatabaseId> out_databaseId; | |
317 | RefPtr<Inspector::Protocol::Database::Error> out_sqlError; | |
318 | Inspector::Protocol::Database::PrimaryColors out_screenColor; | |
319 | RefPtr<Inspector::Protocol::Database::ColorList> out_alternateColors; | |
320 | DatabaseBackendDispatcherHandler::PrintColor out_printColor; | |
321 | m_agent->executeSQLSyncOptionalReturnValues(error, in_databaseId, in_query, out_columnNames, &out_notes, &out_timestamp, out_values, &out_payload, &out_databaseId, out_sqlError, &out_screenColor, out_alternateColors, &out_printColor); | |
322 | ||
323 | if (!error.length()) { | |
324 | if (out_columnNames) | |
325 | result->setArray(ASCIILiteral("columnNames"), out_columnNames); | |
326 | if (out_notes.isAssigned()) | |
327 | result->setString(ASCIILiteral("notes"), out_notes.getValue()); | |
328 | if (out_timestamp.isAssigned()) | |
329 | result->setDouble(ASCIILiteral("timestamp"), out_timestamp.getValue()); | |
330 | if (out_values.isAssigned()) | |
331 | result->setObject(ASCIILiteral("values"), out_values.getValue()); | |
332 | if (out_payload.isAssigned()) | |
333 | result->setValue(ASCIILiteral("payload"), out_payload.getValue()); | |
334 | if (out_databaseId.isAssigned()) | |
335 | result->setInteger(ASCIILiteral("databaseId"), out_databaseId.getValue()); | |
336 | if (out_sqlError) | |
337 | result->setObject(ASCIILiteral("sqlError"), out_sqlError); | |
338 | if (out_screenColor.isAssigned()) | |
339 | result->setString(ASCIILiteral("screenColor"), out_screenColor.getValue()); | |
340 | if (out_alternateColors) | |
341 | result->setArray(ASCIILiteral("alternateColors"), out_alternateColors); | |
342 | if (out_printColor.isAssigned()) | |
343 | result->setString(ASCIILiteral("printColor"), out_printColor.getValue()); | |
344 | } | |
345 | m_backendDispatcher->sendResponse(callId, WTF::move(result), error); | |
346 | } | |
347 | ||
348 | DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::ExecuteSQLAsyncOptionalReturnValuesCallback(Ref<BackendDispatcher>&& backendDispatcher, int id) : BackendDispatcher::CallbackBase(WTF::move(backendDispatcher), id) { } | |
349 | ||
350 | void DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::sendSuccess(RefPtr<Inspector::Protocol::Array<String>>&& columnNames, Inspector::Protocol::OptOutput<String>* notes, Inspector::Protocol::OptOutput<double>* timestamp, Inspector::Protocol::OptOutput<Inspector::InspectorObject>* values, Inspector::Protocol::OptOutput<Inspector::InspectorValue>* payload, Inspector::Protocol::OptOutput<int>* databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, Inspector::Protocol::OptOutput<String>* screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, Inspector::Protocol::OptOutput<String>* printColor) | |
351 | { | |
352 | Ref<InspectorObject> jsonMessage = InspectorObject::create(); | |
353 | if (columnNames) | |
354 | jsonMessage->setArray(ASCIILiteral("columnNames"), columnNames); | |
355 | if (notes.isAssigned()) | |
356 | jsonMessage->setString(ASCIILiteral("notes"), notes.getValue()); | |
357 | if (timestamp.isAssigned()) | |
358 | jsonMessage->setDouble(ASCIILiteral("timestamp"), timestamp.getValue()); | |
359 | if (values.isAssigned()) | |
360 | jsonMessage->setObject(ASCIILiteral("values"), values.getValue()); | |
361 | if (payload.isAssigned()) | |
362 | jsonMessage->setValue(ASCIILiteral("payload"), payload.getValue()); | |
363 | if (databaseId.isAssigned()) | |
364 | jsonMessage->setInteger(ASCIILiteral("databaseId"), databaseId.getValue()); | |
365 | if (sqlError) | |
366 | jsonMessage->setObject(ASCIILiteral("sqlError"), sqlError); | |
367 | if (screenColor.isAssigned()) | |
368 | jsonMessage->setString(ASCIILiteral("screenColor"), screenColor.getValue()); | |
369 | if (alternateColors) | |
370 | jsonMessage->setArray(ASCIILiteral("alternateColors"), alternateColors); | |
371 | if (printColor.isAssigned()) | |
372 | jsonMessage->setString(ASCIILiteral("printColor"), printColor.getValue()); | |
373 | sendIfActive(WTF::move(jsonMessage), ErrorString()); | |
374 | } | |
375 | ||
376 | void DatabaseBackendDispatcher::executeSQLAsyncOptionalReturnValues(long callId, const InspectorObject& message) | |
377 | { | |
378 | auto protocolErrors = Inspector::Protocol::Array<String>::create(); | |
379 | RefPtr<InspectorObject> paramsContainer; | |
380 | message.getObject(ASCIILiteral("params"), paramsContainer); | |
381 | int in_databaseId = BackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), nullptr, protocolErrors.get()); | |
382 | String in_query = BackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("query"), nullptr, protocolErrors.get()); | |
383 | if (protocolErrors->length()) { | |
384 | String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsyncOptionalReturnValues"); | |
385 | m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors)); | |
386 | return; | |
387 | } | |
388 | ||
389 | #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
390 | if (m_alternateDispatcher) { | |
391 | m_alternateDispatcher->executeSQLAsyncOptionalReturnValues(callId, in_databaseId, in_query); | |
392 | return; | |
393 | } | |
394 | #endif | |
395 | ||
396 | ErrorString error; | |
397 | Ref<InspectorObject> result = InspectorObject::create(); | |
398 | Ref<DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback> callback = adoptRef(*new DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback(m_backendDispatcher.copyRef(), callId)); | |
399 | m_agent->executeSQLAsyncOptionalReturnValues(error, in_databaseId, in_query, callback.copyRef()); | |
400 | ||
401 | if (error.length()) { | |
402 | callback->disable(); | |
403 | m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::ServerError, error); | |
404 | return; | |
405 | } | |
406 | } | |
407 | ||
408 | void DatabaseBackendDispatcher::executeSQLSync(long callId, const InspectorObject& message) | |
409 | { | |
410 | auto protocolErrors = Inspector::Protocol::Array<String>::create(); | |
411 | RefPtr<InspectorObject> paramsContainer; | |
412 | message.getObject(ASCIILiteral("params"), paramsContainer); | |
413 | int in_databaseId = BackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), nullptr, protocolErrors.get()); | |
414 | String in_query = BackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("query"), nullptr, protocolErrors.get()); | |
415 | if (protocolErrors->length()) { | |
416 | String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSync"); | |
417 | m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors)); | |
418 | return; | |
419 | } | |
420 | ||
421 | #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
422 | if (m_alternateDispatcher) { | |
423 | m_alternateDispatcher->executeSQLSync(callId, in_databaseId, in_query); | |
424 | return; | |
425 | } | |
426 | #endif | |
427 | ||
428 | ErrorString error; | |
429 | Ref<InspectorObject> result = InspectorObject::create(); | |
430 | RefPtr<Inspector::Protocol::Array<String>> out_columnNames; | |
431 | String out_notes; | |
432 | double out_timestamp; | |
433 | Inspector::InspectorObject out_values; | |
434 | Inspector::InspectorValue out_payload; | |
435 | Inspector::Protocol::Database::DatabaseId out_databaseId; | |
436 | RefPtr<Inspector::Protocol::Database::Error> out_sqlError; | |
437 | RefPtr<Inspector::Protocol::Database::ColorList> out_alternateColors; | |
438 | Inspector::Protocol::Database::PrimaryColors out_screenColor; | |
439 | DatabaseBackendDispatcherHandler::PrintColor out_printColor; | |
440 | m_agent->executeSQLSync(error, in_databaseId, in_query, out_columnNames, &out_notes, &out_timestamp, out_values, &out_payload, &out_databaseId, out_sqlError, out_alternateColors, &out_screenColor, &out_printColor); | |
441 | ||
442 | if (!error.length()) { | |
443 | result->setArray(ASCIILiteral("columnNames"), out_columnNames); | |
444 | result->setString(ASCIILiteral("notes"), out_notes); | |
445 | result->setDouble(ASCIILiteral("timestamp"), out_timestamp); | |
446 | result->setObject(ASCIILiteral("values"), out_values); | |
447 | result->setValue(ASCIILiteral("payload"), out_payload); | |
448 | result->setInteger(ASCIILiteral("databaseId"), out_databaseId); | |
449 | result->setObject(ASCIILiteral("sqlError"), out_sqlError); | |
450 | result->setArray(ASCIILiteral("alternateColors"), out_alternateColors); | |
451 | result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getEnumConstantValue(out_screenColor)); | |
452 | result->setString(ASCIILiteral("printColor"), Inspector::Protocol::getEnumConstantValue(out_printColor)); | |
453 | } | |
454 | m_backendDispatcher->sendResponse(callId, WTF::move(result), error); | |
455 | } | |
456 | ||
457 | DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback::ExecuteSQLAsyncCallback(Ref<BackendDispatcher>&& backendDispatcher, int id) : BackendDispatcher::CallbackBase(WTF::move(backendDispatcher), id) { } | |
458 | ||
459 | void DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback::sendSuccess(RefPtr<Inspector::Protocol::Array<String>>&& columnNames, const String& notes, double timestamp, Inspector::InspectorObject values, Inspector::InspectorValue payload, int databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, const String& screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, const String& printColor) | |
460 | { | |
461 | Ref<InspectorObject> jsonMessage = InspectorObject::create(); | |
462 | jsonMessage->setArray(ASCIILiteral("columnNames"), columnNames); | |
463 | jsonMessage->setString(ASCIILiteral("notes"), notes); | |
464 | jsonMessage->setDouble(ASCIILiteral("timestamp"), timestamp); | |
465 | jsonMessage->setObject(ASCIILiteral("values"), values); | |
466 | jsonMessage->setValue(ASCIILiteral("payload"), payload); | |
467 | jsonMessage->setInteger(ASCIILiteral("databaseId"), databaseId); | |
468 | jsonMessage->setObject(ASCIILiteral("sqlError"), sqlError); | |
469 | jsonMessage->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getEnumConstantValue(screenColor)); | |
470 | jsonMessage->setArray(ASCIILiteral("alternateColors"), alternateColors); | |
471 | jsonMessage->setString(ASCIILiteral("printColor"), Inspector::Protocol::getEnumConstantValue(printColor)); | |
472 | sendIfActive(WTF::move(jsonMessage), ErrorString()); | |
473 | } | |
474 | ||
475 | void DatabaseBackendDispatcher::executeSQLAsync(long callId, const InspectorObject& message) | |
476 | { | |
477 | auto protocolErrors = Inspector::Protocol::Array<String>::create(); | |
478 | RefPtr<InspectorObject> paramsContainer; | |
479 | message.getObject(ASCIILiteral("params"), paramsContainer); | |
480 | int in_databaseId = BackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), nullptr, protocolErrors.get()); | |
481 | String in_query = BackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("query"), nullptr, protocolErrors.get()); | |
482 | if (protocolErrors->length()) { | |
483 | String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsync"); | |
484 | m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors)); | |
485 | return; | |
486 | } | |
487 | ||
488 | #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) | |
489 | if (m_alternateDispatcher) { | |
490 | m_alternateDispatcher->executeSQLAsync(callId, in_databaseId, in_query); | |
491 | return; | |
492 | } | |
493 | #endif | |
494 | ||
495 | ErrorString error; | |
496 | Ref<InspectorObject> result = InspectorObject::create(); | |
497 | Ref<DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback> callback = adoptRef(*new DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback(m_backendDispatcher.copyRef(), callId)); | |
498 | m_agent->executeSQLAsync(error, in_databaseId, in_query, callback.copyRef()); | |
499 | ||
500 | if (error.length()) { | |
501 | callback->disable(); | |
502 | m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::ServerError, error); | |
503 | return; | |
504 | } | |
505 | } | |
506 | ||
507 | } // namespace Inspector | |
508 | ||
509 | ### End File: InspectorBackendDispatchers.cpp | |
510 | ||
511 | ### Begin File: InspectorFrontendDispatchers.h | |
512 | /* | |
513 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
514 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
515 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
516 | * | |
517 | * Redistribution and use in source and binary forms, with or without | |
518 | * modification, are permitted provided that the following conditions | |
519 | * are met: | |
520 | * 1. Redistributions of source code must retain the above copyright | |
521 | * notice, this list of conditions and the following disclaimer. | |
522 | * 2. Redistributions in binary form must reproduce the above copyright | |
523 | * notice, this list of conditions and the following disclaimer in the | |
524 | * documentation and/or other materials provided with the distribution. | |
525 | * | |
526 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
527 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
528 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
529 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
530 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
531 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
532 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
533 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
534 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
535 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
536 | * THE POSSIBILITY OF SUCH DAMAGE. | |
537 | */ | |
538 | ||
539 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
540 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
541 | ||
542 | #ifndef InspectorFrontendDispatchers_h | |
543 | #define InspectorFrontendDispatchers_h | |
544 | ||
545 | #include "InspectorProtocolObjects.h" | |
546 | #include <inspector/InspectorFrontendChannel.h> | |
547 | #include <inspector/InspectorValues.h> | |
548 | #include <wtf/text/WTFString.h> | |
549 | ||
550 | namespace Inspector { | |
551 | ||
552 | ||
553 | ||
554 | } // namespace Inspector | |
555 | ||
556 | #endif // !defined(InspectorFrontendDispatchers_h) | |
557 | ### End File: InspectorFrontendDispatchers.h | |
558 | ||
559 | ### Begin File: InspectorFrontendDispatchers.cpp | |
560 | /* | |
561 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
562 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
563 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
564 | * | |
565 | * Redistribution and use in source and binary forms, with or without | |
566 | * modification, are permitted provided that the following conditions | |
567 | * are met: | |
568 | * 1. Redistributions of source code must retain the above copyright | |
569 | * notice, this list of conditions and the following disclaimer. | |
570 | * 2. Redistributions in binary form must reproduce the above copyright | |
571 | * notice, this list of conditions and the following disclaimer in the | |
572 | * documentation and/or other materials provided with the distribution. | |
573 | * | |
574 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
575 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
576 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
577 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
578 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
579 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
580 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
581 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
582 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
583 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
584 | * THE POSSIBILITY OF SUCH DAMAGE. | |
585 | */ | |
586 | ||
587 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
588 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
589 | ||
590 | #include "config.h" | |
591 | #include "InspectorFrontendDispatchers.h" | |
592 | ||
593 | #include <wtf/text/CString.h> | |
594 | ||
595 | namespace Inspector { | |
596 | ||
597 | } // namespace Inspector | |
598 | ||
599 | ### End File: InspectorFrontendDispatchers.cpp | |
600 | ||
601 | ### Begin File: InspectorProtocolObjects.h | |
602 | /* | |
603 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
604 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
605 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
606 | * | |
607 | * Redistribution and use in source and binary forms, with or without | |
608 | * modification, are permitted provided that the following conditions | |
609 | * are met: | |
610 | * 1. Redistributions of source code must retain the above copyright | |
611 | * notice, this list of conditions and the following disclaimer. | |
612 | * 2. Redistributions in binary form must reproduce the above copyright | |
613 | * notice, this list of conditions and the following disclaimer in the | |
614 | * documentation and/or other materials provided with the distribution. | |
615 | * | |
616 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
617 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
618 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
619 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
620 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
621 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
622 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
623 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
624 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
625 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
626 | * THE POSSIBILITY OF SUCH DAMAGE. | |
627 | */ | |
628 | ||
629 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
630 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
631 | ||
632 | #ifndef InspectorProtocolObjects_h | |
633 | #define InspectorProtocolObjects_h | |
634 | ||
635 | #include <inspector/InspectorProtocolTypes.h> | |
636 | #include <wtf/Assertions.h> | |
637 | ||
638 | namespace Inspector { | |
639 | ||
640 | ||
641 | ||
642 | namespace Protocol { | |
643 | ||
644 | // Forward declarations. | |
645 | namespace Database { | |
646 | class Error; | |
647 | enum class PrimaryColors; | |
648 | } // Database | |
649 | // End of forward declarations. | |
650 | ||
651 | ||
652 | // Typedefs. | |
653 | namespace Database { | |
654 | /* Unique identifier of Database object. */ | |
655 | typedef int DatabaseId; | |
656 | typedef Inspector::Protocol::Array<Inspector::Protocol::Database::PrimaryColors> ColorList; | |
657 | } // Database | |
658 | // End of typedefs. | |
659 | ||
660 | String getEnumConstantValue(int code); | |
661 | ||
662 | template<typename T> String getEnumConstantValue(T enumValue) | |
663 | { | |
664 | return getEnumConstantValue(static_cast<int>(enumValue)); | |
665 | } | |
666 | ||
667 | namespace Database { | |
668 | /* */ | |
669 | enum class PrimaryColors { | |
670 | Red = 0, | |
671 | Green = 1, | |
672 | Blue = 2, | |
673 | }; // enum class PrimaryColors | |
674 | /* Database error. */ | |
675 | class Error : public Inspector::InspectorObjectBase { | |
676 | public: | |
677 | enum { | |
678 | NoFieldsSet = 0, | |
679 | MessageSet = 1 << 0, | |
680 | CodeSet = 1 << 1, | |
681 | AllFieldsSet = (MessageSet | CodeSet) | |
682 | }; | |
683 | ||
684 | template<int STATE> | |
685 | class Builder { | |
686 | private: | |
687 | RefPtr<InspectorObject> m_result; | |
688 | ||
689 | template<int STEP> Builder<STATE | STEP>& castState() | |
690 | { | |
691 | return *reinterpret_cast<Builder<STATE | STEP>*>(this); | |
692 | } | |
693 | ||
694 | Builder(Ref</*Error*/InspectorObject>&& object) | |
695 | : m_result(WTF::move(object)) | |
696 | { | |
697 | COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state); | |
698 | } | |
699 | friend class Error; | |
700 | public: | |
701 | ||
702 | Builder<STATE | MessageSet>& setMessage(const String& value) | |
703 | { | |
704 | COMPILE_ASSERT(!(STATE & MessageSet), property_message_already_set); | |
705 | m_result->setString(ASCIILiteral("message"), value); | |
706 | return castState<MessageSet>(); | |
707 | } | |
708 | ||
709 | Builder<STATE | CodeSet>& setCode(int value) | |
710 | { | |
711 | COMPILE_ASSERT(!(STATE & CodeSet), property_code_already_set); | |
712 | m_result->setInteger(ASCIILiteral("code"), value); | |
713 | return castState<CodeSet>(); | |
714 | } | |
715 | ||
716 | Ref<Error> release() | |
717 | { | |
718 | COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready); | |
719 | COMPILE_ASSERT(sizeof(Error) == sizeof(InspectorObject), cannot_cast); | |
720 | ||
721 | Ref<InspectorObject> result = m_result.releaseNonNull(); | |
722 | return WTF::move(*reinterpret_cast<Ref<Error>*>(&result)); | |
723 | } | |
724 | }; | |
725 | ||
726 | /* | |
727 | * Synthetic constructor: | |
728 | * Ref<Error> result = Error::create() | |
729 | * .setMessage(...) | |
730 | * .setCode(...) | |
731 | * .release(); | |
732 | */ | |
733 | static Builder<NoFieldsSet> create() | |
734 | { | |
735 | return Builder<NoFieldsSet>(InspectorObject::create()); | |
736 | } | |
737 | }; | |
738 | ||
739 | } // Database | |
740 | ||
741 | ||
742 | ||
743 | } // namespace Protocol | |
744 | ||
745 | } // namespace Inspector | |
746 | ||
747 | #endif // !defined(InspectorProtocolObjects_h) | |
748 | ### End File: InspectorProtocolObjects.h | |
749 | ||
750 | ### Begin File: InspectorProtocolObjects.cpp | |
751 | /* | |
752 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
753 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
754 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
755 | * | |
756 | * Redistribution and use in source and binary forms, with or without | |
757 | * modification, are permitted provided that the following conditions | |
758 | * are met: | |
759 | * 1. Redistributions of source code must retain the above copyright | |
760 | * notice, this list of conditions and the following disclaimer. | |
761 | * 2. Redistributions in binary form must reproduce the above copyright | |
762 | * notice, this list of conditions and the following disclaimer in the | |
763 | * documentation and/or other materials provided with the distribution. | |
764 | * | |
765 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
766 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
767 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
768 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
769 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
770 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
771 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
772 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
773 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
774 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
775 | * THE POSSIBILITY OF SUCH DAMAGE. | |
776 | */ | |
777 | ||
778 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
779 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
780 | ||
781 | #include "config.h" | |
782 | #include "InspectorProtocolObjects.h" | |
783 | ||
784 | #include <wtf/text/CString.h> | |
785 | ||
786 | namespace Inspector { | |
787 | ||
788 | namespace Protocol { | |
789 | ||
790 | static const char* const enum_constant_values[] = { | |
791 | "red", | |
792 | "green", | |
793 | "blue", | |
794 | "cyan", | |
795 | "magenta", | |
796 | "yellow", | |
797 | "black", | |
798 | }; | |
799 | ||
800 | String getEnumConstantValue(int code) { | |
801 | return enum_constant_values[code]; | |
802 | } | |
803 | ||
804 | ||
805 | ||
806 | } // namespace Protocol | |
807 | ||
808 | } // namespace Inspector | |
809 | ||
810 | ### End File: InspectorProtocolObjects.cpp | |
811 | ||
812 | ### Begin File: RWIProtocolBackendDispatchers.h | |
813 | /* | |
814 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
815 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
816 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
817 | * | |
818 | * Redistribution and use in source and binary forms, with or without | |
819 | * modification, are permitted provided that the following conditions | |
820 | * are met: | |
821 | * 1. Redistributions of source code must retain the above copyright | |
822 | * notice, this list of conditions and the following disclaimer. | |
823 | * 2. Redistributions in binary form must reproduce the above copyright | |
824 | * notice, this list of conditions and the following disclaimer in the | |
825 | * documentation and/or other materials provided with the distribution. | |
826 | * | |
827 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
828 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
829 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
830 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
831 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
832 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
833 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
834 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
835 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
836 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
837 | * THE POSSIBILITY OF SUCH DAMAGE. | |
838 | */ | |
839 | ||
840 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
841 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
842 | ||
843 | #include <JavaScriptCore/InspectorAlternateBackendDispatchers.h> | |
844 | #include <wtf/RetainPtr.h> | |
845 | ||
846 | @protocol RWIProtocolDatabaseDomainHandler; | |
847 | ||
848 | namespace Inspector { | |
849 | ||
850 | ||
851 | class ObjCInspectorDatabaseBackendDispatcher final : public AlternateDatabaseBackendDispatcher { | |
852 | public: | |
853 | ObjCInspectorDatabaseBackendDispatcher(id<RWIProtocolDatabaseDomainHandler> handler) { m_delegate = handler; } | |
854 | virtual void executeSQLSyncOptionalReturnValues(long callId, int in_databaseId, const String& in_query) override; | |
855 | virtual void executeSQLAsyncOptionalReturnValues(long callId, int in_databaseId, const String& in_query) override; | |
856 | virtual void executeSQLSync(long callId, int in_databaseId, const String& in_query) override; | |
857 | virtual void executeSQLAsync(long callId, int in_databaseId, const String& in_query) override; | |
858 | private: | |
859 | RetainPtr<id<RWIProtocolDatabaseDomainHandler>> m_delegate; | |
860 | }; | |
861 | ||
862 | } // namespace Inspector | |
863 | ||
864 | ### End File: RWIProtocolBackendDispatchers.h | |
865 | ||
866 | ### Begin File: RWIProtocolConfiguration.mm | |
867 | /* | |
868 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
869 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
870 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
871 | * | |
872 | * Redistribution and use in source and binary forms, with or without | |
873 | * modification, are permitted provided that the following conditions | |
874 | * are met: | |
875 | * 1. Redistributions of source code must retain the above copyright | |
876 | * notice, this list of conditions and the following disclaimer. | |
877 | * 2. Redistributions in binary form must reproduce the above copyright | |
878 | * notice, this list of conditions and the following disclaimer in the | |
879 | * documentation and/or other materials provided with the distribution. | |
880 | * | |
881 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
882 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
883 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
884 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
885 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
886 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
887 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
888 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
889 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
890 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
891 | * THE POSSIBILITY OF SUCH DAMAGE. | |
892 | */ | |
893 | ||
894 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
895 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
896 | ||
897 | #import "config.h" | |
898 | #import "RWIProtocolConfiguration.h" | |
899 | ||
900 | #import "RWIProtocolInternal.h" | |
901 | #import "RWIProtocolBackendDispatchers.h" | |
902 | #import <JavaScriptCore/AlternateDispatchableAgent.h> | |
903 | #import <JavaScriptCore/AugmentableInspectorController.h> | |
904 | #import <JavaScriptCore/InspectorAlternateBackendDispatchers.h> | |
905 | #import <JavaScriptCore/InspectorBackendDispatchers.h> | |
906 | ||
907 | using namespace Inspector; | |
908 | ||
909 | @implementation RWIProtocolConfiguration | |
910 | { | |
911 | AugmentableInspectorController* _controller; | |
912 | id<RWIProtocolDatabaseDomainHandler> _databaseHandler; | |
913 | } | |
914 | ||
915 | - (instancetype)initWithController:(AugmentableInspectorController*)controller | |
916 | { | |
917 | self = [super init]; | |
918 | if (!self) | |
919 | return nil; | |
920 | ASSERT(controller); | |
921 | _controller = controller; | |
922 | return self; | |
923 | } | |
924 | ||
925 | - (void)dealloc | |
926 | { | |
927 | [_databaseHandler release]; | |
928 | [super dealloc]; | |
929 | } | |
930 | ||
931 | - (void)setDatabaseHandler:(id<RWIProtocolDatabaseDomainHandler>)handler | |
932 | { | |
933 | if (handler == _databaseHandler) | |
934 | return; | |
935 | ||
936 | [_databaseHandler release]; | |
937 | _databaseHandler = [handler retain]; | |
938 | ||
939 | auto alternateDispatcher = std::make_unique<ObjCInspectorDatabaseBackendDispatcher>(handler); | |
940 | auto alternateAgent = std::make_unique<AlternateDispatchableAgent<DatabaseBackendDispatcher, AlternateDatabaseBackendDispatcher>>(ASCIILiteral("Database"), WTF::move(alternateDispatcher)); | |
941 | _controller->appendExtraAgent(WTF::move(alternateAgent)); | |
942 | } | |
943 | ||
944 | - (id<RWIProtocolDatabaseDomainHandler>)databaseHandler | |
945 | { | |
946 | return _databaseHandler; | |
947 | } | |
948 | ||
949 | @end | |
950 | ||
951 | ||
952 | ### End File: RWIProtocolConfiguration.mm | |
953 | ||
954 | ### Begin File: RWIProtocolConfiguration.h | |
955 | /* | |
956 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
957 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
958 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
959 | * | |
960 | * Redistribution and use in source and binary forms, with or without | |
961 | * modification, are permitted provided that the following conditions | |
962 | * are met: | |
963 | * 1. Redistributions of source code must retain the above copyright | |
964 | * notice, this list of conditions and the following disclaimer. | |
965 | * 2. Redistributions in binary form must reproduce the above copyright | |
966 | * notice, this list of conditions and the following disclaimer in the | |
967 | * documentation and/or other materials provided with the distribution. | |
968 | * | |
969 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
970 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
971 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
972 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
973 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
974 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
975 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
976 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
977 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
978 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
979 | * THE POSSIBILITY OF SUCH DAMAGE. | |
980 | */ | |
981 | ||
982 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
983 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
984 | ||
985 | #import "RWIProtocol.h" | |
986 | ||
987 | __attribute__((visibility ("default"))) | |
988 | @interface RWIProtocolConfiguration : NSObject | |
989 | @property (nonatomic, retain, setter=setDatabaseHandler:) id<RWIProtocolDatabaseDomainHandler> databaseHandler; | |
990 | @end | |
991 | ||
992 | ||
993 | ### End File: RWIProtocolConfiguration.h | |
994 | ||
995 | ### Begin File: RWIProtocolBackendDispatchers.mm | |
996 | /* | |
997 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
998 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
999 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
1000 | * | |
1001 | * Redistribution and use in source and binary forms, with or without | |
1002 | * modification, are permitted provided that the following conditions | |
1003 | * are met: | |
1004 | * 1. Redistributions of source code must retain the above copyright | |
1005 | * notice, this list of conditions and the following disclaimer. | |
1006 | * 2. Redistributions in binary form must reproduce the above copyright | |
1007 | * notice, this list of conditions and the following disclaimer in the | |
1008 | * documentation and/or other materials provided with the distribution. | |
1009 | * | |
1010 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
1011 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
1012 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
1013 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
1014 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
1015 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
1016 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
1017 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
1018 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
1019 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
1020 | * THE POSSIBILITY OF SUCH DAMAGE. | |
1021 | */ | |
1022 | ||
1023 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
1024 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
1025 | ||
1026 | #import "config.h" | |
1027 | #import "RWIProtocolBackendDispatchers.h" | |
1028 | ||
1029 | #include "RWIProtocolInternal.h" | |
1030 | #include "RWIProtocolEnumConversionHelpers.h" | |
1031 | #include <JavaScriptCore/InspectorFrontendChannel.h> | |
1032 | #include <JavaScriptCore/InspectorValues.h> | |
1033 | ||
1034 | namespace Inspector { | |
1035 | ||
1036 | void ObjCInspectorDatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long callId, int in_databaseId, const String& in_query) | |
1037 | { | |
1038 | id errorCallback = ^(NSString *error) { | |
1039 | backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); | |
1040 | }; | |
1041 | ||
1042 | id successCallback = ^(NSArray/*<NSString>*/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, RWIProtocolDatabaseError **sqlError, RWIProtocolDatabasePrimaryColors *screenColor, NSArray/*<NSString>*/ **alternateColors, RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor *printColor) { | |
1043 | Ref<InspectorObject> resultObject = InspectorObject::create(); | |
1044 | THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(columnNames, @"columnNames"); | |
1045 | THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(notes, @"notes"); | |
1046 | THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(values, @"values"); | |
1047 | THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(payload, @"payload"); | |
1048 | THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(sqlError, @"sqlError"); | |
1049 | THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(alternateColors, @"alternateColors"); | |
1050 | if (columnNames) | |
1051 | resultObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(*columnNames)); | |
1052 | if (notes) | |
1053 | resultObject->setString(ASCIILiteral("notes"), *notes); | |
1054 | if (timestamp) | |
1055 | resultObject->setDouble(ASCIILiteral("timestamp"), *timestamp); | |
1056 | if (values) | |
1057 | resultObject->setObject(ASCIILiteral("values"), [*values toInspectorObject]); | |
1058 | if (payload) | |
1059 | resultObject->setValue(ASCIILiteral("payload"), [*payload toInspectorObject]); | |
1060 | if (databaseId) | |
1061 | resultObject->setInteger(ASCIILiteral("databaseId"), *databaseId); | |
1062 | if (sqlError) | |
1063 | resultObject->setObject(ASCIILiteral("sqlError"), [*sqlError toInspectorObject]); | |
1064 | if (screenColor) | |
1065 | resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(*screenColor)); | |
1066 | if (alternateColors) | |
1067 | resultObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray(*alternateColors)); | |
1068 | if (printColor) | |
1069 | resultObject->setString(ASCIILiteral("printColor"), toProtocolString(*printColor)); | |
1070 | backendDispatcher()->sendResponse(callId, WTF::move(resultObject), String()); | |
1071 | }; | |
1072 | ||
1073 | int o_in_databaseId = in_databaseId; | |
1074 | NSString *o_in_query = in_query; | |
1075 | ||
1076 | [m_delegate executeSQLSyncOptionalReturnValuesWithErrorCallback:errorCallback successCallback:successCallback databaseId:o_in_databaseId query:o_in_query]; | |
1077 | } | |
1078 | ||
1079 | void ObjCInspectorDatabaseBackendDispatcher::executeSQLAsyncOptionalReturnValues(long callId, int in_databaseId, const String& in_query) | |
1080 | { | |
1081 | id errorCallback = ^(NSString *error) { | |
1082 | backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); | |
1083 | }; | |
1084 | ||
1085 | id successCallback = ^(NSArray/*<NSString>*/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, RWIProtocolDatabaseError **sqlError, RWIProtocolDatabasePrimaryColors *screenColor, NSArray/*<NSString>*/ **alternateColors, RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor *printColor) { | |
1086 | Ref<InspectorObject> resultObject = InspectorObject::create(); | |
1087 | THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(columnNames, @"columnNames"); | |
1088 | THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(notes, @"notes"); | |
1089 | THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(values, @"values"); | |
1090 | THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(payload, @"payload"); | |
1091 | THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(sqlError, @"sqlError"); | |
1092 | THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(alternateColors, @"alternateColors"); | |
1093 | if (columnNames) | |
1094 | resultObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(*columnNames)); | |
1095 | if (notes) | |
1096 | resultObject->setString(ASCIILiteral("notes"), *notes); | |
1097 | if (timestamp) | |
1098 | resultObject->setDouble(ASCIILiteral("timestamp"), *timestamp); | |
1099 | if (values) | |
1100 | resultObject->setObject(ASCIILiteral("values"), [*values toInspectorObject]); | |
1101 | if (payload) | |
1102 | resultObject->setValue(ASCIILiteral("payload"), [*payload toInspectorObject]); | |
1103 | if (databaseId) | |
1104 | resultObject->setInteger(ASCIILiteral("databaseId"), *databaseId); | |
1105 | if (sqlError) | |
1106 | resultObject->setObject(ASCIILiteral("sqlError"), [*sqlError toInspectorObject]); | |
1107 | if (screenColor) | |
1108 | resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(*screenColor)); | |
1109 | if (alternateColors) | |
1110 | resultObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray(*alternateColors)); | |
1111 | if (printColor) | |
1112 | resultObject->setString(ASCIILiteral("printColor"), toProtocolString(*printColor)); | |
1113 | backendDispatcher()->sendResponse(callId, WTF::move(resultObject), String()); | |
1114 | }; | |
1115 | ||
1116 | int o_in_databaseId = in_databaseId; | |
1117 | NSString *o_in_query = in_query; | |
1118 | ||
1119 | [m_delegate executeSQLAsyncOptionalReturnValuesWithErrorCallback:errorCallback successCallback:successCallback databaseId:o_in_databaseId query:o_in_query]; | |
1120 | } | |
1121 | ||
1122 | void ObjCInspectorDatabaseBackendDispatcher::executeSQLSync(long callId, int in_databaseId, const String& in_query) | |
1123 | { | |
1124 | id errorCallback = ^(NSString *error) { | |
1125 | backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); | |
1126 | }; | |
1127 | ||
1128 | id successCallback = ^(NSArray/*<NSString>*/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, RWIProtocolDatabaseError *sqlError, NSArray/*<NSString>*/ *alternateColors, RWIProtocolDatabasePrimaryColors screenColor, RWIProtocolDatabaseExecuteSQLSyncPrintColor printColor) { | |
1129 | Ref<InspectorObject> resultObject = InspectorObject::create(); | |
1130 | THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(columnNames, @"columnNames"); | |
1131 | THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(notes, @"notes"); | |
1132 | THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(values, @"values"); | |
1133 | THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(payload, @"payload"); | |
1134 | THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(sqlError, @"sqlError"); | |
1135 | THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(alternateColors, @"alternateColors"); | |
1136 | resultObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(columnNames)); | |
1137 | resultObject->setString(ASCIILiteral("notes"), notes); | |
1138 | resultObject->setDouble(ASCIILiteral("timestamp"), timestamp); | |
1139 | resultObject->setObject(ASCIILiteral("values"), [values toInspectorObject]); | |
1140 | resultObject->setValue(ASCIILiteral("payload"), [payload toInspectorObject]); | |
1141 | resultObject->setInteger(ASCIILiteral("databaseId"), databaseId); | |
1142 | resultObject->setObject(ASCIILiteral("sqlError"), [sqlError toInspectorObject]); | |
1143 | resultObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray(alternateColors)); | |
1144 | resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(screenColor)); | |
1145 | resultObject->setString(ASCIILiteral("printColor"), toProtocolString(printColor)); | |
1146 | backendDispatcher()->sendResponse(callId, WTF::move(resultObject), String()); | |
1147 | }; | |
1148 | ||
1149 | int o_in_databaseId = in_databaseId; | |
1150 | NSString *o_in_query = in_query; | |
1151 | ||
1152 | [m_delegate executeSQLSyncWithErrorCallback:errorCallback successCallback:successCallback databaseId:o_in_databaseId query:o_in_query]; | |
1153 | } | |
1154 | ||
1155 | void ObjCInspectorDatabaseBackendDispatcher::executeSQLAsync(long callId, int in_databaseId, const String& in_query) | |
1156 | { | |
1157 | id errorCallback = ^(NSString *error) { | |
1158 | backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); | |
1159 | }; | |
1160 | ||
1161 | id successCallback = ^(NSArray/*<NSString>*/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, RWIProtocolDatabaseError *sqlError, RWIProtocolDatabasePrimaryColors screenColor, NSArray/*<NSString>*/ *alternateColors, RWIProtocolDatabaseExecuteSQLAsyncPrintColor printColor) { | |
1162 | Ref<InspectorObject> resultObject = InspectorObject::create(); | |
1163 | THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(columnNames, @"columnNames"); | |
1164 | THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(notes, @"notes"); | |
1165 | THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(values, @"values"); | |
1166 | THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(payload, @"payload"); | |
1167 | THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(sqlError, @"sqlError"); | |
1168 | THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(alternateColors, @"alternateColors"); | |
1169 | resultObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(columnNames)); | |
1170 | resultObject->setString(ASCIILiteral("notes"), notes); | |
1171 | resultObject->setDouble(ASCIILiteral("timestamp"), timestamp); | |
1172 | resultObject->setObject(ASCIILiteral("values"), [values toInspectorObject]); | |
1173 | resultObject->setValue(ASCIILiteral("payload"), [payload toInspectorObject]); | |
1174 | resultObject->setInteger(ASCIILiteral("databaseId"), databaseId); | |
1175 | resultObject->setObject(ASCIILiteral("sqlError"), [sqlError toInspectorObject]); | |
1176 | resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(screenColor)); | |
1177 | resultObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray(alternateColors)); | |
1178 | resultObject->setString(ASCIILiteral("printColor"), toProtocolString(printColor)); | |
1179 | backendDispatcher()->sendResponse(callId, WTF::move(resultObject), String()); | |
1180 | }; | |
1181 | ||
1182 | int o_in_databaseId = in_databaseId; | |
1183 | NSString *o_in_query = in_query; | |
1184 | ||
1185 | [m_delegate executeSQLAsyncWithErrorCallback:errorCallback successCallback:successCallback databaseId:o_in_databaseId query:o_in_query]; | |
1186 | } | |
1187 | ||
1188 | ||
1189 | } // namespace Inspector | |
1190 | ||
1191 | ### End File: RWIProtocolBackendDispatchers.mm | |
1192 | ||
1193 | ### Begin File: RWIProtocolEnumConversionHelpers.h | |
1194 | /* | |
1195 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
1196 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
1197 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
1198 | * | |
1199 | * Redistribution and use in source and binary forms, with or without | |
1200 | * modification, are permitted provided that the following conditions | |
1201 | * are met: | |
1202 | * 1. Redistributions of source code must retain the above copyright | |
1203 | * notice, this list of conditions and the following disclaimer. | |
1204 | * 2. Redistributions in binary form must reproduce the above copyright | |
1205 | * notice, this list of conditions and the following disclaimer in the | |
1206 | * documentation and/or other materials provided with the distribution. | |
1207 | * | |
1208 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
1209 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
1210 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
1211 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
1212 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
1213 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
1214 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
1215 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
1216 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
1217 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
1218 | * THE POSSIBILITY OF SUCH DAMAGE. | |
1219 | */ | |
1220 | ||
1221 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
1222 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
1223 | ||
1224 | #import "RWIProtocolArrayConversionHelpers.h" | |
1225 | ||
1226 | namespace Inspector { | |
1227 | ||
1228 | template<typename ObjCEnumType> | |
1229 | ObjCEnumType fromProtocolString(const String& value); | |
1230 | ||
1231 | ||
1232 | inline String toProtocolString(RWIProtocolDatabasePrimaryColors value) | |
1233 | { | |
1234 | switch(value) { | |
1235 | case RWIProtocolDatabasePrimaryColorsRed: | |
1236 | return ASCIILiteral("red"); | |
1237 | case RWIProtocolDatabasePrimaryColorsGreen: | |
1238 | return ASCIILiteral("green"); | |
1239 | case RWIProtocolDatabasePrimaryColorsBlue: | |
1240 | return ASCIILiteral("blue"); | |
1241 | } | |
1242 | } | |
1243 | ||
1244 | template<> | |
1245 | inline RWIProtocolDatabasePrimaryColors fromProtocolString(const String& value) | |
1246 | { | |
1247 | if (value == "red") | |
1248 | return RWIProtocolDatabasePrimaryColorsRed; | |
1249 | if (value == "green") | |
1250 | return RWIProtocolDatabasePrimaryColorsGreen; | |
1251 | if (value == "blue") | |
1252 | return RWIProtocolDatabasePrimaryColorsBlue; | |
1253 | ASSERT_NOT_REACHED(); | |
1254 | return RWIProtocolDatabasePrimaryColorsRed; | |
1255 | } | |
1256 | ||
1257 | inline String toProtocolString(RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor value) | |
1258 | { | |
1259 | switch(value) { | |
1260 | case RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorCyan: | |
1261 | return ASCIILiteral("cyan"); | |
1262 | case RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorMagenta: | |
1263 | return ASCIILiteral("magenta"); | |
1264 | case RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorYellow: | |
1265 | return ASCIILiteral("yellow"); | |
1266 | case RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorBlack: | |
1267 | return ASCIILiteral("black"); | |
1268 | } | |
1269 | } | |
1270 | ||
1271 | template<> | |
1272 | inline RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor fromProtocolString(const String& value) | |
1273 | { | |
1274 | if (value == "cyan") | |
1275 | return RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorCyan; | |
1276 | if (value == "magenta") | |
1277 | return RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorMagenta; | |
1278 | if (value == "yellow") | |
1279 | return RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorYellow; | |
1280 | if (value == "black") | |
1281 | return RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorBlack; | |
1282 | ASSERT_NOT_REACHED(); | |
1283 | return RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorCyan; | |
1284 | } | |
1285 | ||
1286 | inline String toProtocolString(RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor value) | |
1287 | { | |
1288 | switch(value) { | |
1289 | case RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorCyan: | |
1290 | return ASCIILiteral("cyan"); | |
1291 | case RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorMagenta: | |
1292 | return ASCIILiteral("magenta"); | |
1293 | case RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorYellow: | |
1294 | return ASCIILiteral("yellow"); | |
1295 | case RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorBlack: | |
1296 | return ASCIILiteral("black"); | |
1297 | } | |
1298 | } | |
1299 | ||
1300 | template<> | |
1301 | inline RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor fromProtocolString(const String& value) | |
1302 | { | |
1303 | if (value == "cyan") | |
1304 | return RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorCyan; | |
1305 | if (value == "magenta") | |
1306 | return RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorMagenta; | |
1307 | if (value == "yellow") | |
1308 | return RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorYellow; | |
1309 | if (value == "black") | |
1310 | return RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorBlack; | |
1311 | ASSERT_NOT_REACHED(); | |
1312 | return RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorCyan; | |
1313 | } | |
1314 | ||
1315 | inline String toProtocolString(RWIProtocolDatabaseExecuteSQLSyncPrintColor value) | |
1316 | { | |
1317 | switch(value) { | |
1318 | case RWIProtocolDatabaseExecuteSQLSyncPrintColorCyan: | |
1319 | return ASCIILiteral("cyan"); | |
1320 | case RWIProtocolDatabaseExecuteSQLSyncPrintColorMagenta: | |
1321 | return ASCIILiteral("magenta"); | |
1322 | case RWIProtocolDatabaseExecuteSQLSyncPrintColorYellow: | |
1323 | return ASCIILiteral("yellow"); | |
1324 | case RWIProtocolDatabaseExecuteSQLSyncPrintColorBlack: | |
1325 | return ASCIILiteral("black"); | |
1326 | } | |
1327 | } | |
1328 | ||
1329 | template<> | |
1330 | inline RWIProtocolDatabaseExecuteSQLSyncPrintColor fromProtocolString(const String& value) | |
1331 | { | |
1332 | if (value == "cyan") | |
1333 | return RWIProtocolDatabaseExecuteSQLSyncPrintColorCyan; | |
1334 | if (value == "magenta") | |
1335 | return RWIProtocolDatabaseExecuteSQLSyncPrintColorMagenta; | |
1336 | if (value == "yellow") | |
1337 | return RWIProtocolDatabaseExecuteSQLSyncPrintColorYellow; | |
1338 | if (value == "black") | |
1339 | return RWIProtocolDatabaseExecuteSQLSyncPrintColorBlack; | |
1340 | ASSERT_NOT_REACHED(); | |
1341 | return RWIProtocolDatabaseExecuteSQLSyncPrintColorCyan; | |
1342 | } | |
1343 | ||
1344 | inline String toProtocolString(RWIProtocolDatabaseExecuteSQLAsyncPrintColor value) | |
1345 | { | |
1346 | switch(value) { | |
1347 | case RWIProtocolDatabaseExecuteSQLAsyncPrintColorCyan: | |
1348 | return ASCIILiteral("cyan"); | |
1349 | case RWIProtocolDatabaseExecuteSQLAsyncPrintColorMagenta: | |
1350 | return ASCIILiteral("magenta"); | |
1351 | case RWIProtocolDatabaseExecuteSQLAsyncPrintColorYellow: | |
1352 | return ASCIILiteral("yellow"); | |
1353 | case RWIProtocolDatabaseExecuteSQLAsyncPrintColorBlack: | |
1354 | return ASCIILiteral("black"); | |
1355 | } | |
1356 | } | |
1357 | ||
1358 | template<> | |
1359 | inline RWIProtocolDatabaseExecuteSQLAsyncPrintColor fromProtocolString(const String& value) | |
1360 | { | |
1361 | if (value == "cyan") | |
1362 | return RWIProtocolDatabaseExecuteSQLAsyncPrintColorCyan; | |
1363 | if (value == "magenta") | |
1364 | return RWIProtocolDatabaseExecuteSQLAsyncPrintColorMagenta; | |
1365 | if (value == "yellow") | |
1366 | return RWIProtocolDatabaseExecuteSQLAsyncPrintColorYellow; | |
1367 | if (value == "black") | |
1368 | return RWIProtocolDatabaseExecuteSQLAsyncPrintColorBlack; | |
1369 | ASSERT_NOT_REACHED(); | |
1370 | return RWIProtocolDatabaseExecuteSQLAsyncPrintColorCyan; | |
1371 | } | |
1372 | ||
1373 | } // namespace Inspector | |
1374 | ||
1375 | ### End File: RWIProtocolEnumConversionHelpers.h | |
1376 | ||
1377 | ### Begin File: RWIProtocolEventDispatchers.mm | |
1378 | /* | |
1379 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
1380 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
1381 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
1382 | * | |
1383 | * Redistribution and use in source and binary forms, with or without | |
1384 | * modification, are permitted provided that the following conditions | |
1385 | * are met: | |
1386 | * 1. Redistributions of source code must retain the above copyright | |
1387 | * notice, this list of conditions and the following disclaimer. | |
1388 | * 2. Redistributions in binary form must reproduce the above copyright | |
1389 | * notice, this list of conditions and the following disclaimer in the | |
1390 | * documentation and/or other materials provided with the distribution. | |
1391 | * | |
1392 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
1393 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
1394 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
1395 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
1396 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
1397 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
1398 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
1399 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
1400 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
1401 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
1402 | * THE POSSIBILITY OF SUCH DAMAGE. | |
1403 | */ | |
1404 | ||
1405 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
1406 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
1407 | ||
1408 | #import "config.h" | |
1409 | #import "RWIProtocolInternal.h" | |
1410 | ||
1411 | #import "RWIProtocolEnumConversionHelpers.h" | |
1412 | #import <JavaScriptCore/InspectorFrontendChannel.h> | |
1413 | #import <JavaScriptCore/InspectorValues.h> | |
1414 | ||
1415 | using namespace Inspector; | |
1416 | ||
1417 | ||
1418 | ||
1419 | ||
1420 | ### End File: RWIProtocolEventDispatchers.mm | |
1421 | ||
1422 | ### Begin File: RWIProtocol.h | |
1423 | /* | |
1424 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
1425 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
1426 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
1427 | * | |
1428 | * Redistribution and use in source and binary forms, with or without | |
1429 | * modification, are permitted provided that the following conditions | |
1430 | * are met: | |
1431 | * 1. Redistributions of source code must retain the above copyright | |
1432 | * notice, this list of conditions and the following disclaimer. | |
1433 | * 2. Redistributions in binary form must reproduce the above copyright | |
1434 | * notice, this list of conditions and the following disclaimer in the | |
1435 | * documentation and/or other materials provided with the distribution. | |
1436 | * | |
1437 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
1438 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
1439 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
1440 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
1441 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
1442 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
1443 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
1444 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
1445 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
1446 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
1447 | * THE POSSIBILITY OF SUCH DAMAGE. | |
1448 | */ | |
1449 | ||
1450 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
1451 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
1452 | ||
1453 | #import <Foundation/Foundation.h> | |
1454 | ||
1455 | #import <WebInspector/RWIProtocolJSONObject.h> | |
1456 | ||
1457 | ||
1458 | @class RWIProtocolDatabaseError; | |
1459 | ||
1460 | ||
1461 | typedef NS_ENUM(NSInteger, RWIProtocolDatabasePrimaryColors) { | |
1462 | RWIProtocolDatabasePrimaryColorsRed, | |
1463 | RWIProtocolDatabasePrimaryColorsGreen, | |
1464 | RWIProtocolDatabasePrimaryColorsBlue, | |
1465 | }; | |
1466 | ||
1467 | typedef NS_ENUM(NSInteger, RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor) { | |
1468 | RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorCyan, | |
1469 | RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorMagenta, | |
1470 | RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorYellow, | |
1471 | RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorBlack, | |
1472 | }; | |
1473 | ||
1474 | typedef NS_ENUM(NSInteger, RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor) { | |
1475 | RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorCyan, | |
1476 | RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorMagenta, | |
1477 | RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorYellow, | |
1478 | RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorBlack, | |
1479 | }; | |
1480 | ||
1481 | typedef NS_ENUM(NSInteger, RWIProtocolDatabaseExecuteSQLSyncPrintColor) { | |
1482 | RWIProtocolDatabaseExecuteSQLSyncPrintColorCyan, | |
1483 | RWIProtocolDatabaseExecuteSQLSyncPrintColorMagenta, | |
1484 | RWIProtocolDatabaseExecuteSQLSyncPrintColorYellow, | |
1485 | RWIProtocolDatabaseExecuteSQLSyncPrintColorBlack, | |
1486 | }; | |
1487 | ||
1488 | typedef NS_ENUM(NSInteger, RWIProtocolDatabaseExecuteSQLAsyncPrintColor) { | |
1489 | RWIProtocolDatabaseExecuteSQLAsyncPrintColorCyan, | |
1490 | RWIProtocolDatabaseExecuteSQLAsyncPrintColorMagenta, | |
1491 | RWIProtocolDatabaseExecuteSQLAsyncPrintColorYellow, | |
1492 | RWIProtocolDatabaseExecuteSQLAsyncPrintColorBlack, | |
1493 | }; | |
1494 | ||
1495 | ||
1496 | __attribute__((visibility ("default"))) | |
1497 | @interface RWIProtocolDatabaseError : RWIProtocolJSONObject | |
1498 | - (instancetype)initWithMessage:(NSString *)message code:(int)code; | |
1499 | /* required */ @property (nonatomic, copy) NSString *message; | |
1500 | /* required */ @property (nonatomic, assign) int code; | |
1501 | @end | |
1502 | ||
1503 | @protocol RWIProtocolDatabaseDomainHandler <NSObject> | |
1504 | @required | |
1505 | - (void)executeSQLSyncOptionalReturnValuesWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(NSArray/*<NSString>*/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, RWIProtocolDatabaseError **sqlError, RWIProtocolDatabasePrimaryColors *screenColor, NSArray/*<NSString>*/ **alternateColors, RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor *printColor))successCallback databaseId:(int)databaseId query:(NSString *)query; | |
1506 | - (void)executeSQLAsyncOptionalReturnValuesWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(NSArray/*<NSString>*/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, RWIProtocolDatabaseError **sqlError, RWIProtocolDatabasePrimaryColors *screenColor, NSArray/*<NSString>*/ **alternateColors, RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor *printColor))successCallback databaseId:(int)databaseId query:(NSString *)query; | |
1507 | - (void)executeSQLSyncWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(NSArray/*<NSString>*/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, RWIProtocolDatabaseError *sqlError, NSArray/*<NSString>*/ *alternateColors, RWIProtocolDatabasePrimaryColors screenColor, RWIProtocolDatabaseExecuteSQLSyncPrintColor printColor))successCallback databaseId:(int)databaseId query:(NSString *)query; | |
1508 | - (void)executeSQLAsyncWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(NSArray/*<NSString>*/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, RWIProtocolDatabaseError *sqlError, RWIProtocolDatabasePrimaryColors screenColor, NSArray/*<NSString>*/ *alternateColors, RWIProtocolDatabaseExecuteSQLAsyncPrintColor printColor))successCallback databaseId:(int)databaseId query:(NSString *)query; | |
1509 | @end | |
1510 | ||
1511 | ||
1512 | ||
1513 | ||
1514 | ### End File: RWIProtocol.h | |
1515 | ||
1516 | ### Begin File: RWIProtocolTypes.mm | |
1517 | /* | |
1518 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
1519 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
1520 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
1521 | * | |
1522 | * Redistribution and use in source and binary forms, with or without | |
1523 | * modification, are permitted provided that the following conditions | |
1524 | * are met: | |
1525 | * 1. Redistributions of source code must retain the above copyright | |
1526 | * notice, this list of conditions and the following disclaimer. | |
1527 | * 2. Redistributions in binary form must reproduce the above copyright | |
1528 | * notice, this list of conditions and the following disclaimer in the | |
1529 | * documentation and/or other materials provided with the distribution. | |
1530 | * | |
1531 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
1532 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
1533 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
1534 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
1535 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
1536 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
1537 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
1538 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
1539 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
1540 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
1541 | * THE POSSIBILITY OF SUCH DAMAGE. | |
1542 | */ | |
1543 | ||
1544 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
1545 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
1546 | ||
1547 | #import "config.h" | |
1548 | #import "RWIProtocolInternal.h" | |
1549 | ||
1550 | #import "RWIProtocolEnumConversionHelpers.h" | |
1551 | #import <JavaScriptCore/InspectorValues.h> | |
1552 | #import <wtf/Assertions.h> | |
1553 | ||
1554 | using namespace Inspector; | |
1555 | ||
1556 | ||
1557 | @implementation RWIProtocolDatabaseError | |
1558 | ||
1559 | - (instancetype)initWithMessage:(NSString *)message code:(int)code; | |
1560 | { | |
1561 | self = [super init]; | |
1562 | if (!self) | |
1563 | return nil; | |
1564 | ||
1565 | THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(message, @"message"); | |
1566 | ||
1567 | self.message = message; | |
1568 | self.code = code; | |
1569 | ||
1570 | return self; | |
1571 | } | |
1572 | ||
1573 | - (void)setMessage:(NSString *)message | |
1574 | { | |
1575 | [super setString:message forKey:@"message"]; | |
1576 | } | |
1577 | ||
1578 | - (NSString *)message | |
1579 | { | |
1580 | return [super stringForKey:@"message"]; | |
1581 | } | |
1582 | ||
1583 | - (void)setCode:(int)code | |
1584 | { | |
1585 | [super setInteger:code forKey:@"code"]; | |
1586 | } | |
1587 | ||
1588 | - (int)code | |
1589 | { | |
1590 | return [super integerForKey:@"code"]; | |
1591 | } | |
1592 | ||
1593 | @end | |
1594 | ||
1595 | ||
1596 | ### End File: RWIProtocolTypes.mm | |
1597 | ||
1598 | ### Begin File: RWIProtocolInternal.h | |
1599 | /* | |
1600 | * Copyright (C) 2013 Google Inc. All rights reserved. | |
1601 | * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. | |
1602 | * Copyright (C) 2014 University of Washington. All rights reserved. | |
1603 | * | |
1604 | * Redistribution and use in source and binary forms, with or without | |
1605 | * modification, are permitted provided that the following conditions | |
1606 | * are met: | |
1607 | * 1. Redistributions of source code must retain the above copyright | |
1608 | * notice, this list of conditions and the following disclaimer. | |
1609 | * 2. Redistributions in binary form must reproduce the above copyright | |
1610 | * notice, this list of conditions and the following disclaimer in the | |
1611 | * documentation and/or other materials provided with the distribution. | |
1612 | * | |
1613 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
1614 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
1615 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
1616 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
1617 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
1618 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
1619 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
1620 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
1621 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
1622 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
1623 | * THE POSSIBILITY OF SUCH DAMAGE. | |
1624 | */ | |
1625 | ||
1626 | // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json | |
1627 | // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py | |
1628 | ||
1629 | #import "RWIProtocol.h" | |
1630 | #import "RWIProtocolJSONObjectInternal.h" | |
1631 | #import <JavaScriptCore/AugmentableInspectorController.h> | |
1632 | #import <JavaScriptCore/InspectorValues.h> | |
1633 | ||
1634 | ||
1635 | ||
1636 | ||
1637 | ### End File: RWIProtocolInternal.h |