### Begin File: InspectorBackendCommands.js /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py // Database. InspectorBackend.registerDatabaseDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Database"); InspectorBackend.registerEnum("Database.PrimaryColors", {Red: "red", Green: "green", Blue: "blue"}); 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"]); 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"]); 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"]); 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"]); InspectorBackend.activateDomain("Database"); ### End File: InspectorBackendCommands.js ### Begin File: TestAlternateBackendDispatchers.h /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #pragma once #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) #include "TestProtocolTypes.h" #include #include namespace Inspector { class AlternateBackendDispatcher { public: void setBackendDispatcher(RefPtr&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); } BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); } private: RefPtr m_backendDispatcher; }; class AlternateDatabaseBackendDispatcher : public AlternateBackendDispatcher { public: virtual ~AlternateDatabaseBackendDispatcher() { } virtual void executeSQLSyncOptionalReturnValues(long callId, int in_databaseId, const String& in_query) = 0; virtual void executeSQLAsyncOptionalReturnValues(long callId, int in_databaseId, const String& in_query) = 0; virtual void executeSQLSync(long callId, int in_databaseId, const String& in_query) = 0; virtual void executeSQLAsync(long callId, int in_databaseId, const String& in_query) = 0; }; } // namespace Inspector #endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) ### End File: TestAlternateBackendDispatchers.h ### Begin File: TestBackendDispatchers.h /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #pragma once #include "TestProtocolObjects.h" #include #include namespace Inspector { typedef String ErrorString; #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) class AlternateDatabaseBackendDispatcher; #endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) class DatabaseBackendDispatcherHandler { public: // Named after parameter 'printColor' while generating command/event executeSQLSyncOptionalReturnValues. enum class PrintColor { Cyan = 3, Magenta = 4, Yellow = 5, Black = 6, }; // enum class PrintColor virtual void executeSQLSyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, RefPtr>& opt_out_columnNames, Inspector::Protocol::OptOutput* opt_out_notes, Inspector::Protocol::OptOutput* opt_out_timestamp, Inspector::Protocol::OptOutput* opt_out_values, Inspector::Protocol::OptOutput* opt_out_payload, Inspector::Protocol::OptOutput* opt_out_databaseId, RefPtr& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0; class ExecuteSQLAsyncOptionalReturnValuesCallback : public BackendDispatcher::CallbackBase { public: ExecuteSQLAsyncOptionalReturnValuesCallback(Ref&&, int id); void sendSuccess(RefPtr>&& columnNames, Inspector::Protocol::OptOutput* notes, Inspector::Protocol::OptOutput* timestamp, Inspector::Protocol::OptOutput* values, Inspector::Protocol::OptOutput* payload, Inspector::Protocol::OptOutput* databaseId, RefPtr&& sqlError, Inspector::Protocol::OptOutput* screenColor, RefPtr&& alternateColors, Inspector::Protocol::OptOutput* printColor); }; virtual void executeSQLAsyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, Ref&& callback) = 0; virtual void executeSQLSync(ErrorString&, int in_databaseId, const String& in_query, RefPtr>& out_columnNames, String* out_notes, double* out_timestamp, Inspector::InspectorObject* out_values, Inspector::InspectorValue* out_payload, int* out_databaseId, RefPtr& out_sqlError, RefPtr& out_alternateColors, Inspector::Protocol::Database::PrimaryColors* out_screenColor, DatabaseBackendDispatcherHandler::PrintColor* out_printColor) = 0; class ExecuteSQLAsyncCallback : public BackendDispatcher::CallbackBase { public: ExecuteSQLAsyncCallback(Ref&&, int id); void sendSuccess(RefPtr>&& columnNames, const String& notes, double timestamp, Inspector::InspectorObject values, Inspector::InspectorValue payload, int databaseId, RefPtr&& sqlError, const String& screenColor, RefPtr&& alternateColors, const String& printColor); }; virtual void executeSQLAsync(ErrorString&, int in_databaseId, const String& in_query, Ref&& callback) = 0; protected: virtual ~DatabaseBackendDispatcherHandler(); }; class DatabaseBackendDispatcher final : public SupplementalBackendDispatcher { public: static Ref create(BackendDispatcher&, DatabaseBackendDispatcherHandler*); void dispatch(long requestId, const String& method, Ref&& message) override; private: void executeSQLSyncOptionalReturnValues(long requestId, RefPtr&& parameters); void executeSQLAsyncOptionalReturnValues(long requestId, RefPtr&& parameters); void executeSQLSync(long requestId, RefPtr&& parameters); void executeSQLAsync(long requestId, RefPtr&& parameters); #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) public: void setAlternateDispatcher(AlternateDatabaseBackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; } private: AlternateDatabaseBackendDispatcher* m_alternateDispatcher { nullptr }; #endif private: DatabaseBackendDispatcher(BackendDispatcher&, DatabaseBackendDispatcherHandler*); DatabaseBackendDispatcherHandler* m_agent { nullptr }; }; } // namespace Inspector ### End File: TestBackendDispatchers.h ### Begin File: TestBackendDispatchers.cpp /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #include "config.h" #include "TestBackendDispatchers.h" #include #include #include #include #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) #include "TestAlternateBackendDispatchers.h" #endif namespace Inspector { DatabaseBackendDispatcherHandler::~DatabaseBackendDispatcherHandler() { } Ref DatabaseBackendDispatcher::create(BackendDispatcher& backendDispatcher, DatabaseBackendDispatcherHandler* agent) { return adoptRef(*new DatabaseBackendDispatcher(backendDispatcher, agent)); } DatabaseBackendDispatcher::DatabaseBackendDispatcher(BackendDispatcher& backendDispatcher, DatabaseBackendDispatcherHandler* agent) : SupplementalBackendDispatcher(backendDispatcher) , m_agent(agent) { m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("Database"), this); } void DatabaseBackendDispatcher::dispatch(long requestId, const String& method, Ref&& message) { Ref protect(*this); RefPtr parameters; message->getObject(ASCIILiteral("params"), parameters); if (method == "executeSQLSyncOptionalReturnValues") executeSQLSyncOptionalReturnValues(requestId, WTFMove(parameters)); else if (method == "executeSQLAsyncOptionalReturnValues") executeSQLAsyncOptionalReturnValues(requestId, WTFMove(parameters)); else if (method == "executeSQLSync") executeSQLSync(requestId, WTFMove(parameters)); else if (method == "executeSQLAsync") executeSQLAsync(requestId, WTFMove(parameters)); else m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Database", '.', method, "' was not found")); } void DatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long requestId, RefPtr&& parameters) { int in_databaseId = m_backendDispatcher->getInteger(parameters.get(), ASCIILiteral("databaseId"), nullptr); String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr); if (m_backendDispatcher->hasProtocolErrors()) { m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSyncOptionalReturnValues")); return; } #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) if (m_alternateDispatcher) { m_alternateDispatcher->executeSQLSyncOptionalReturnValues(requestId, in_databaseId, in_query); return; } #endif ErrorString error; Ref result = InspectorObject::create(); RefPtr> out_columnNames; Inspector::Protocol::OptOutput out_notes; Inspector::Protocol::OptOutput out_timestamp; Inspector::Protocol::OptOutput out_values; Inspector::Protocol::OptOutput out_payload; Inspector::Protocol::OptOutput out_databaseId; RefPtr out_sqlError; Inspector::Protocol::Database::PrimaryColors out_screenColor; RefPtr out_alternateColors; DatabaseBackendDispatcherHandler::PrintColor out_printColor; 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); if (!error.length()) { if (out_columnNames) result->setArray(ASCIILiteral("columnNames"), out_columnNames); if (out_notes.isAssigned()) result->setString(ASCIILiteral("notes"), out_notes.getValue()); if (out_timestamp.isAssigned()) result->setDouble(ASCIILiteral("timestamp"), out_timestamp.getValue()); if (out_values.isAssigned()) result->setObject(ASCIILiteral("values"), out_values.getValue()); if (out_payload.isAssigned()) result->setValue(ASCIILiteral("payload"), out_payload.getValue()); if (out_databaseId.isAssigned()) result->setInteger(ASCIILiteral("databaseId"), out_databaseId.getValue()); if (out_sqlError) result->setObject(ASCIILiteral("sqlError"), out_sqlError); if (out_screenColor.isAssigned()) result->setString(ASCIILiteral("screenColor"), out_screenColor.getValue()); if (out_alternateColors) result->setArray(ASCIILiteral("alternateColors"), out_alternateColors); if (out_printColor.isAssigned()) result->setString(ASCIILiteral("printColor"), out_printColor.getValue()); } if (!error.length()) m_backendDispatcher->sendResponse(requestId, WTFMove(result)); else m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error)); } DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::ExecuteSQLAsyncOptionalReturnValuesCallback(Ref&& backendDispatcher, int id) : BackendDispatcher::CallbackBase(WTFMove(backendDispatcher), id) { } void DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::sendSuccess(RefPtr>&& columnNames, Inspector::Protocol::OptOutput* notes, Inspector::Protocol::OptOutput* timestamp, Inspector::Protocol::OptOutput* values, Inspector::Protocol::OptOutput* payload, Inspector::Protocol::OptOutput* databaseId, RefPtr&& sqlError, Inspector::Protocol::OptOutput* screenColor, RefPtr&& alternateColors, Inspector::Protocol::OptOutput* printColor) { Ref jsonMessage = InspectorObject::create(); if (columnNames) jsonMessage->setArray(ASCIILiteral("columnNames"), columnNames); if (notes.isAssigned()) jsonMessage->setString(ASCIILiteral("notes"), notes.getValue()); if (timestamp.isAssigned()) jsonMessage->setDouble(ASCIILiteral("timestamp"), timestamp.getValue()); if (values.isAssigned()) jsonMessage->setObject(ASCIILiteral("values"), values.getValue()); if (payload.isAssigned()) jsonMessage->setValue(ASCIILiteral("payload"), payload.getValue()); if (databaseId.isAssigned()) jsonMessage->setInteger(ASCIILiteral("databaseId"), databaseId.getValue()); if (sqlError) jsonMessage->setObject(ASCIILiteral("sqlError"), sqlError); if (screenColor.isAssigned()) jsonMessage->setString(ASCIILiteral("screenColor"), screenColor.getValue()); if (alternateColors) jsonMessage->setArray(ASCIILiteral("alternateColors"), alternateColors); if (printColor.isAssigned()) jsonMessage->setString(ASCIILiteral("printColor"), printColor.getValue()); CallbackBase::sendSuccess(WTFMove(jsonMessage)); } void DatabaseBackendDispatcher::executeSQLAsyncOptionalReturnValues(long requestId, RefPtr&& parameters) { int in_databaseId = m_backendDispatcher->getInteger(parameters.get(), ASCIILiteral("databaseId"), nullptr); String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr); if (m_backendDispatcher->hasProtocolErrors()) { m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsyncOptionalReturnValues")); return; } #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) if (m_alternateDispatcher) { m_alternateDispatcher->executeSQLAsyncOptionalReturnValues(requestId, in_databaseId, in_query); return; } #endif ErrorString error; Ref result = InspectorObject::create(); Ref callback = adoptRef(*new DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback(m_backendDispatcher.copyRef(), requestId)); m_agent->executeSQLAsyncOptionalReturnValues(error, in_databaseId, in_query, callback.copyRef()); if (error.length()) { callback->disable(); m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, error); return; } } void DatabaseBackendDispatcher::executeSQLSync(long requestId, RefPtr&& parameters) { int in_databaseId = m_backendDispatcher->getInteger(parameters.get(), ASCIILiteral("databaseId"), nullptr); String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr); if (m_backendDispatcher->hasProtocolErrors()) { m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSync")); return; } #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) if (m_alternateDispatcher) { m_alternateDispatcher->executeSQLSync(requestId, in_databaseId, in_query); return; } #endif ErrorString error; Ref result = InspectorObject::create(); RefPtr> out_columnNames; String out_notes; double out_timestamp; Inspector::InspectorObject out_values; Inspector::InspectorValue out_payload; Inspector::Protocol::Database::DatabaseId out_databaseId; RefPtr out_sqlError; RefPtr out_alternateColors; Inspector::Protocol::Database::PrimaryColors out_screenColor; DatabaseBackendDispatcherHandler::PrintColor out_printColor; 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); if (!error.length()) { result->setArray(ASCIILiteral("columnNames"), out_columnNames); result->setString(ASCIILiteral("notes"), out_notes); result->setDouble(ASCIILiteral("timestamp"), out_timestamp); result->setObject(ASCIILiteral("values"), out_values); result->setValue(ASCIILiteral("payload"), out_payload); result->setInteger(ASCIILiteral("databaseId"), out_databaseId); result->setObject(ASCIILiteral("sqlError"), out_sqlError); result->setArray(ASCIILiteral("alternateColors"), out_alternateColors); result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(out_screenColor)); result->setString(ASCIILiteral("printColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(out_printColor)); } if (!error.length()) m_backendDispatcher->sendResponse(requestId, WTFMove(result)); else m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error)); } DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback::ExecuteSQLAsyncCallback(Ref&& backendDispatcher, int id) : BackendDispatcher::CallbackBase(WTFMove(backendDispatcher), id) { } void DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback::sendSuccess(RefPtr>&& columnNames, const String& notes, double timestamp, Inspector::InspectorObject values, Inspector::InspectorValue payload, int databaseId, RefPtr&& sqlError, const String& screenColor, RefPtr&& alternateColors, const String& printColor) { Ref jsonMessage = InspectorObject::create(); jsonMessage->setArray(ASCIILiteral("columnNames"), columnNames); jsonMessage->setString(ASCIILiteral("notes"), notes); jsonMessage->setDouble(ASCIILiteral("timestamp"), timestamp); jsonMessage->setObject(ASCIILiteral("values"), values); jsonMessage->setValue(ASCIILiteral("payload"), payload); jsonMessage->setInteger(ASCIILiteral("databaseId"), databaseId); jsonMessage->setObject(ASCIILiteral("sqlError"), sqlError); jsonMessage->setString(ASCIILiteral("screenColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(screenColor)); jsonMessage->setArray(ASCIILiteral("alternateColors"), alternateColors); jsonMessage->setString(ASCIILiteral("printColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(printColor)); CallbackBase::sendSuccess(WTFMove(jsonMessage)); } void DatabaseBackendDispatcher::executeSQLAsync(long requestId, RefPtr&& parameters) { int in_databaseId = m_backendDispatcher->getInteger(parameters.get(), ASCIILiteral("databaseId"), nullptr); String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr); if (m_backendDispatcher->hasProtocolErrors()) { m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsync")); return; } #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) if (m_alternateDispatcher) { m_alternateDispatcher->executeSQLAsync(requestId, in_databaseId, in_query); return; } #endif ErrorString error; Ref result = InspectorObject::create(); Ref callback = adoptRef(*new DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback(m_backendDispatcher.copyRef(), requestId)); m_agent->executeSQLAsync(error, in_databaseId, in_query, callback.copyRef()); if (error.length()) { callback->disable(); m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, error); return; } } } // namespace Inspector ### End File: TestBackendDispatchers.cpp ### Begin File: TestFrontendDispatchers.h /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #pragma once #include "TestProtocolObjects.h" #include #include namespace Inspector { class FrontendRouter; } // namespace Inspector ### End File: TestFrontendDispatchers.h ### Begin File: TestFrontendDispatchers.cpp /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #include "config.h" #include "TestFrontendDispatchers.h" #include "InspectorFrontendRouter.h" #include namespace Inspector { } // namespace Inspector ### End File: TestFrontendDispatchers.cpp ### Begin File: TestProtocolObjects.h /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #pragma once #include #include namespace Inspector { namespace Protocol { // Forward declarations. namespace Database { class Error; enum class PrimaryColors; } // Database // End of forward declarations. // Typedefs. namespace Database { /* Unique identifier of Database object. */ typedef int DatabaseId; typedef Inspector::Protocol::Array ColorList; } // Database // End of typedefs. namespace TestHelpers { String getEnumConstantValue(int code); template String getEnumConstantValue(T enumValue) { return getEnumConstantValue(static_cast(enumValue)); } } // namespace TestHelpers namespace Database { /* */ enum class PrimaryColors { Red = 0, Green = 1, Blue = 2, }; // enum class PrimaryColors /* Database error. */ class Error : public Inspector::InspectorObjectBase { public: enum { NoFieldsSet = 0, MessageSet = 1 << 0, CodeSet = 1 << 1, AllFieldsSet = (MessageSet | CodeSet) }; template class Builder { private: RefPtr m_result; template Builder& castState() { return *reinterpret_cast*>(this); } Builder(Ref&& object) : m_result(WTFMove(object)) { COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state); } friend class Error; public: Builder& setMessage(const String& value) { COMPILE_ASSERT(!(STATE & MessageSet), property_message_already_set); m_result->setString(ASCIILiteral("message"), value); return castState(); } Builder& setCode(int value) { COMPILE_ASSERT(!(STATE & CodeSet), property_code_already_set); m_result->setInteger(ASCIILiteral("code"), value); return castState(); } Ref release() { COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready); COMPILE_ASSERT(sizeof(Error) == sizeof(InspectorObject), cannot_cast); Ref result = m_result.releaseNonNull(); return WTFMove(*reinterpret_cast*>(&result)); } }; /* * Synthetic constructor: * Ref result = Error::create() * .setMessage(...) * .setCode(...) * .release(); */ static Builder create() { return Builder(InspectorObject::create()); } }; } // Database namespace TestHelpers { template Optional parseEnumValueFromString(const String&); // Enums in the 'Database' Domain template<> Optional parseEnumValueFromString(const String&); } // namespace TestHelpers } // namespace Protocol } // namespace Inspector ### End File: TestProtocolObjects.h ### Begin File: TestProtocolObjects.cpp /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #include "config.h" #include "TestProtocolObjects.h" #include #include namespace Inspector { namespace Protocol { namespace TestHelpers { static const char* const enum_constant_values[] = { "red", "green", "blue", "cyan", "magenta", "yellow", "black", }; String getEnumConstantValue(int code) { return enum_constant_values[code]; } // Enums in the 'Database' Domain template<> Optional parseEnumValueFromString(const String& protocolString) { static const size_t constantValues[] = { (size_t)Inspector::Protocol::Database::PrimaryColors::Red, (size_t)Inspector::Protocol::Database::PrimaryColors::Green, (size_t)Inspector::Protocol::Database::PrimaryColors::Blue, }; for (size_t i = 0; i < 3; ++i) if (protocolString == enum_constant_values[constantValues[i]]) return (Inspector::Protocol::Database::PrimaryColors)constantValues[i]; return Nullopt; } } // namespace TestHelpers } // namespace Protocol } // namespace Inspector ### End File: TestProtocolObjects.cpp ### Begin File: TestProtocolBackendDispatchers.h /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #include #include @protocol TestProtocolDatabaseDomainHandler; namespace Inspector { class ObjCInspectorDatabaseBackendDispatcher final : public AlternateDatabaseBackendDispatcher { public: ObjCInspectorDatabaseBackendDispatcher(id handler) { m_delegate = handler; } virtual void executeSQLSyncOptionalReturnValues(long requestId, int in_databaseId, const String& in_query) override; virtual void executeSQLAsyncOptionalReturnValues(long requestId, int in_databaseId, const String& in_query) override; virtual void executeSQLSync(long requestId, int in_databaseId, const String& in_query) override; virtual void executeSQLAsync(long requestId, int in_databaseId, const String& in_query) override; private: RetainPtr> m_delegate; }; } // namespace Inspector ### End File: TestProtocolBackendDispatchers.h ### Begin File: TestProtocolConfiguration.mm /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #import "config.h" #import "TestProtocolConfiguration.h" #import "TestProtocolInternal.h" #import "TestProtocolBackendDispatchers.h" #import #import #import #import using namespace Inspector; @implementation TestProtocolConfiguration { AugmentableInspectorController* _controller; id _databaseHandler; } - (instancetype)initWithController:(AugmentableInspectorController*)controller { self = [super init]; if (!self) return nil; ASSERT(controller); _controller = controller; return self; } - (void)dealloc { [_databaseHandler release]; [super dealloc]; } - (void)setDatabaseHandler:(id)handler { if (handler == _databaseHandler) return; [_databaseHandler release]; _databaseHandler = [handler retain]; auto alternateDispatcher = std::make_unique(handler); auto alternateAgent = std::make_unique>(ASCIILiteral("Database"), *_controller, WTFMove(alternateDispatcher)); _controller->appendExtraAgent(WTFMove(alternateAgent)); } - (id)databaseHandler { return _databaseHandler; } @end ### End File: TestProtocolConfiguration.mm ### Begin File: TestProtocolConfiguration.h /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #import __attribute__((visibility ("default"))) @interface TestProtocolConfiguration : NSObject @property (nonatomic, retain, setter=setDatabaseHandler:) id databaseHandler; @end ### End File: TestProtocolConfiguration.h ### Begin File: TestProtocolBackendDispatchers.mm /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #import "config.h" #import "TestProtocolBackendDispatchers.h" #include "TestProtocolInternal.h" #include "TestProtocolTypeConversions.h" #include namespace Inspector { void ObjCInspectorDatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long requestId, int in_databaseId, const String& in_query) { id errorCallback = ^(NSString *error) { backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error); backendDispatcher()->sendPendingErrors(); }; id successCallback = ^(NSArray/**/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, TestProtocolDatabaseError **sqlError, TestProtocolDatabasePrimaryColors *screenColor, NSArray/**/ **alternateColors, TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor *printColor) { Ref resultObject = InspectorObject::create(); THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(columnNames, @"columnNames"); THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(notes, @"notes"); THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(values, @"values"); THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(payload, @"payload"); THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(sqlError, @"sqlError"); THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(alternateColors, @"alternateColors"); if (columnNames) resultObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(*columnNames)); if (notes) resultObject->setString(ASCIILiteral("notes"), *notes); if (timestamp) resultObject->setDouble(ASCIILiteral("timestamp"), *timestamp); if (values) resultObject->setObject(ASCIILiteral("values"), [*values toInspectorObject]); if (payload) resultObject->setValue(ASCIILiteral("payload"), [*payload toInspectorObject]); if (databaseId) resultObject->setInteger(ASCIILiteral("databaseId"), *databaseId); if (sqlError) resultObject->setObject(ASCIILiteral("sqlError"), [*sqlError toInspectorObject]); if (screenColor) resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(*screenColor)); if (alternateColors) resultObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray(*alternateColors)); if (printColor) resultObject->setString(ASCIILiteral("printColor"), toProtocolString(*printColor)); backendDispatcher()->sendResponse(requestId, WTFMove(resultObject)); }; int o_in_databaseId = in_databaseId; NSString *o_in_query = in_query; [m_delegate executeSQLSyncOptionalReturnValuesWithErrorCallback:errorCallback successCallback:successCallback databaseId:o_in_databaseId query:o_in_query]; } void ObjCInspectorDatabaseBackendDispatcher::executeSQLAsyncOptionalReturnValues(long requestId, int in_databaseId, const String& in_query) { id errorCallback = ^(NSString *error) { backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error); backendDispatcher()->sendPendingErrors(); }; id successCallback = ^(NSArray/**/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, TestProtocolDatabaseError **sqlError, TestProtocolDatabasePrimaryColors *screenColor, NSArray/**/ **alternateColors, TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor *printColor) { Ref resultObject = InspectorObject::create(); THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(columnNames, @"columnNames"); THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(notes, @"notes"); THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(values, @"values"); THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(payload, @"payload"); THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(sqlError, @"sqlError"); THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(alternateColors, @"alternateColors"); if (columnNames) resultObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(*columnNames)); if (notes) resultObject->setString(ASCIILiteral("notes"), *notes); if (timestamp) resultObject->setDouble(ASCIILiteral("timestamp"), *timestamp); if (values) resultObject->setObject(ASCIILiteral("values"), [*values toInspectorObject]); if (payload) resultObject->setValue(ASCIILiteral("payload"), [*payload toInspectorObject]); if (databaseId) resultObject->setInteger(ASCIILiteral("databaseId"), *databaseId); if (sqlError) resultObject->setObject(ASCIILiteral("sqlError"), [*sqlError toInspectorObject]); if (screenColor) resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(*screenColor)); if (alternateColors) resultObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray(*alternateColors)); if (printColor) resultObject->setString(ASCIILiteral("printColor"), toProtocolString(*printColor)); backendDispatcher()->sendResponse(requestId, WTFMove(resultObject)); }; int o_in_databaseId = in_databaseId; NSString *o_in_query = in_query; [m_delegate executeSQLAsyncOptionalReturnValuesWithErrorCallback:errorCallback successCallback:successCallback databaseId:o_in_databaseId query:o_in_query]; } void ObjCInspectorDatabaseBackendDispatcher::executeSQLSync(long requestId, int in_databaseId, const String& in_query) { id errorCallback = ^(NSString *error) { backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error); backendDispatcher()->sendPendingErrors(); }; id successCallback = ^(NSArray/**/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, TestProtocolDatabaseError *sqlError, NSArray/**/ *alternateColors, TestProtocolDatabasePrimaryColors screenColor, TestProtocolDatabaseExecuteSQLSyncPrintColor printColor) { Ref resultObject = InspectorObject::create(); THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(columnNames, @"columnNames"); THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(notes, @"notes"); THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(values, @"values"); THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(payload, @"payload"); THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(sqlError, @"sqlError"); THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(alternateColors, @"alternateColors"); resultObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(columnNames)); resultObject->setString(ASCIILiteral("notes"), notes); resultObject->setDouble(ASCIILiteral("timestamp"), timestamp); resultObject->setObject(ASCIILiteral("values"), [values toInspectorObject]); resultObject->setValue(ASCIILiteral("payload"), [payload toInspectorObject]); resultObject->setInteger(ASCIILiteral("databaseId"), databaseId); resultObject->setObject(ASCIILiteral("sqlError"), [sqlError toInspectorObject]); resultObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray(alternateColors)); resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(screenColor)); resultObject->setString(ASCIILiteral("printColor"), toProtocolString(printColor)); backendDispatcher()->sendResponse(requestId, WTFMove(resultObject)); }; int o_in_databaseId = in_databaseId; NSString *o_in_query = in_query; [m_delegate executeSQLSyncWithErrorCallback:errorCallback successCallback:successCallback databaseId:o_in_databaseId query:o_in_query]; } void ObjCInspectorDatabaseBackendDispatcher::executeSQLAsync(long requestId, int in_databaseId, const String& in_query) { id errorCallback = ^(NSString *error) { backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error); backendDispatcher()->sendPendingErrors(); }; id successCallback = ^(NSArray/**/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, TestProtocolDatabaseError *sqlError, TestProtocolDatabasePrimaryColors screenColor, NSArray/**/ *alternateColors, TestProtocolDatabaseExecuteSQLAsyncPrintColor printColor) { Ref resultObject = InspectorObject::create(); THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(columnNames, @"columnNames"); THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(notes, @"notes"); THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(values, @"values"); THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(payload, @"payload"); THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(sqlError, @"sqlError"); THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(alternateColors, @"alternateColors"); resultObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(columnNames)); resultObject->setString(ASCIILiteral("notes"), notes); resultObject->setDouble(ASCIILiteral("timestamp"), timestamp); resultObject->setObject(ASCIILiteral("values"), [values toInspectorObject]); resultObject->setValue(ASCIILiteral("payload"), [payload toInspectorObject]); resultObject->setInteger(ASCIILiteral("databaseId"), databaseId); resultObject->setObject(ASCIILiteral("sqlError"), [sqlError toInspectorObject]); resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(screenColor)); resultObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray(alternateColors)); resultObject->setString(ASCIILiteral("printColor"), toProtocolString(printColor)); backendDispatcher()->sendResponse(requestId, WTFMove(resultObject)); }; int o_in_databaseId = in_databaseId; NSString *o_in_query = in_query; [m_delegate executeSQLAsyncWithErrorCallback:errorCallback successCallback:successCallback databaseId:o_in_databaseId query:o_in_query]; } } // namespace Inspector ### End File: TestProtocolBackendDispatchers.mm ### Begin File: TestProtocolEventDispatchers.mm /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #import "config.h" #import "TestProtocolInternal.h" #import "TestProtocolTypeConversions.h" #import using namespace Inspector; ### End File: TestProtocolEventDispatchers.mm ### Begin File: TestProtocol.h /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #import #import @class TestProtocolDatabaseError; typedef NS_ENUM(NSInteger, TestProtocolDatabasePrimaryColors) { TestProtocolDatabasePrimaryColorsRed, TestProtocolDatabasePrimaryColorsGreen, TestProtocolDatabasePrimaryColorsBlue, }; typedef NS_ENUM(NSInteger, TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor) { TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorCyan, TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorMagenta, TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorYellow, TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorBlack, }; typedef NS_ENUM(NSInteger, TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor) { TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorCyan, TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorMagenta, TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorYellow, TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorBlack, }; typedef NS_ENUM(NSInteger, TestProtocolDatabaseExecuteSQLSyncPrintColor) { TestProtocolDatabaseExecuteSQLSyncPrintColorCyan, TestProtocolDatabaseExecuteSQLSyncPrintColorMagenta, TestProtocolDatabaseExecuteSQLSyncPrintColorYellow, TestProtocolDatabaseExecuteSQLSyncPrintColorBlack, }; typedef NS_ENUM(NSInteger, TestProtocolDatabaseExecuteSQLAsyncPrintColor) { TestProtocolDatabaseExecuteSQLAsyncPrintColorCyan, TestProtocolDatabaseExecuteSQLAsyncPrintColorMagenta, TestProtocolDatabaseExecuteSQLAsyncPrintColorYellow, TestProtocolDatabaseExecuteSQLAsyncPrintColorBlack, }; __attribute__((visibility ("default"))) @interface TestProtocolDatabaseError : RWIProtocolJSONObject - (instancetype)initWithPayload:(NSDictionary *)payload; - (instancetype)initWithJSONObject:(RWIProtocolJSONObject *)jsonObject; - (instancetype)initWithMessage:(NSString *)message code:(int)code; /* required */ @property (nonatomic, copy) NSString *message; /* required */ @property (nonatomic, assign) int code; @end @protocol TestProtocolDatabaseDomainHandler @required - (void)executeSQLSyncOptionalReturnValuesWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(NSArray/**/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, TestProtocolDatabaseError **sqlError, TestProtocolDatabasePrimaryColors *screenColor, NSArray/**/ **alternateColors, TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor *printColor))successCallback databaseId:(int)databaseId query:(NSString *)query; - (void)executeSQLAsyncOptionalReturnValuesWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(NSArray/**/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, TestProtocolDatabaseError **sqlError, TestProtocolDatabasePrimaryColors *screenColor, NSArray/**/ **alternateColors, TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor *printColor))successCallback databaseId:(int)databaseId query:(NSString *)query; - (void)executeSQLSyncWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(NSArray/**/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, TestProtocolDatabaseError *sqlError, NSArray/**/ *alternateColors, TestProtocolDatabasePrimaryColors screenColor, TestProtocolDatabaseExecuteSQLSyncPrintColor printColor))successCallback databaseId:(int)databaseId query:(NSString *)query; - (void)executeSQLAsyncWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(NSArray/**/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, TestProtocolDatabaseError *sqlError, TestProtocolDatabasePrimaryColors screenColor, NSArray/**/ *alternateColors, TestProtocolDatabaseExecuteSQLAsyncPrintColor printColor))successCallback databaseId:(int)databaseId query:(NSString *)query; @end ### End File: TestProtocol.h ### Begin File: TestProtocolInternal.h /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #import "TestProtocol.h" #import "TestProtocolJSONObjectPrivate.h" #import #import ### End File: TestProtocolInternal.h ### Begin File: TestProtocolTypeConversions.h /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #import "RWIProtocolArrayConversions.h" #import "TestProtocol.h" namespace Inspector { template ObjCEnumType fromProtocolString(const String& value); inline String toProtocolString(TestProtocolDatabasePrimaryColors value) { switch(value) { case TestProtocolDatabasePrimaryColorsRed: return ASCIILiteral("red"); case TestProtocolDatabasePrimaryColorsGreen: return ASCIILiteral("green"); case TestProtocolDatabasePrimaryColorsBlue: return ASCIILiteral("blue"); } } template<> inline TestProtocolDatabasePrimaryColors fromProtocolString(const String& value) { if (value == "red") return TestProtocolDatabasePrimaryColorsRed; if (value == "green") return TestProtocolDatabasePrimaryColorsGreen; if (value == "blue") return TestProtocolDatabasePrimaryColorsBlue; ASSERT_NOT_REACHED(); return TestProtocolDatabasePrimaryColorsRed; } inline String toProtocolString(TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor value) { switch(value) { case TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorCyan: return ASCIILiteral("cyan"); case TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorMagenta: return ASCIILiteral("magenta"); case TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorYellow: return ASCIILiteral("yellow"); case TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorBlack: return ASCIILiteral("black"); } } template<> inline TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor fromProtocolString(const String& value) { if (value == "cyan") return TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorCyan; if (value == "magenta") return TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorMagenta; if (value == "yellow") return TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorYellow; if (value == "black") return TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorBlack; ASSERT_NOT_REACHED(); return TestProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorCyan; } inline String toProtocolString(TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor value) { switch(value) { case TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorCyan: return ASCIILiteral("cyan"); case TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorMagenta: return ASCIILiteral("magenta"); case TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorYellow: return ASCIILiteral("yellow"); case TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorBlack: return ASCIILiteral("black"); } } template<> inline TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor fromProtocolString(const String& value) { if (value == "cyan") return TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorCyan; if (value == "magenta") return TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorMagenta; if (value == "yellow") return TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorYellow; if (value == "black") return TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorBlack; ASSERT_NOT_REACHED(); return TestProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorCyan; } inline String toProtocolString(TestProtocolDatabaseExecuteSQLSyncPrintColor value) { switch(value) { case TestProtocolDatabaseExecuteSQLSyncPrintColorCyan: return ASCIILiteral("cyan"); case TestProtocolDatabaseExecuteSQLSyncPrintColorMagenta: return ASCIILiteral("magenta"); case TestProtocolDatabaseExecuteSQLSyncPrintColorYellow: return ASCIILiteral("yellow"); case TestProtocolDatabaseExecuteSQLSyncPrintColorBlack: return ASCIILiteral("black"); } } template<> inline TestProtocolDatabaseExecuteSQLSyncPrintColor fromProtocolString(const String& value) { if (value == "cyan") return TestProtocolDatabaseExecuteSQLSyncPrintColorCyan; if (value == "magenta") return TestProtocolDatabaseExecuteSQLSyncPrintColorMagenta; if (value == "yellow") return TestProtocolDatabaseExecuteSQLSyncPrintColorYellow; if (value == "black") return TestProtocolDatabaseExecuteSQLSyncPrintColorBlack; ASSERT_NOT_REACHED(); return TestProtocolDatabaseExecuteSQLSyncPrintColorCyan; } inline String toProtocolString(TestProtocolDatabaseExecuteSQLAsyncPrintColor value) { switch(value) { case TestProtocolDatabaseExecuteSQLAsyncPrintColorCyan: return ASCIILiteral("cyan"); case TestProtocolDatabaseExecuteSQLAsyncPrintColorMagenta: return ASCIILiteral("magenta"); case TestProtocolDatabaseExecuteSQLAsyncPrintColorYellow: return ASCIILiteral("yellow"); case TestProtocolDatabaseExecuteSQLAsyncPrintColorBlack: return ASCIILiteral("black"); } } template<> inline TestProtocolDatabaseExecuteSQLAsyncPrintColor fromProtocolString(const String& value) { if (value == "cyan") return TestProtocolDatabaseExecuteSQLAsyncPrintColorCyan; if (value == "magenta") return TestProtocolDatabaseExecuteSQLAsyncPrintColorMagenta; if (value == "yellow") return TestProtocolDatabaseExecuteSQLAsyncPrintColorYellow; if (value == "black") return TestProtocolDatabaseExecuteSQLAsyncPrintColorBlack; ASSERT_NOT_REACHED(); return TestProtocolDatabaseExecuteSQLAsyncPrintColorCyan; } } // namespace Inspector ### End File: TestProtocolTypeConversions.h ### Begin File: TestProtocolTypeConversions.mm /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #import "config.h" #import "TestProtocolTypeConversions.h" #import "ProtocolTypeConversions.h" #import "TestProtocol.h" #import using namespace Inspector; @interface ProtocolTypeConversions (TestProtocol) + (void)_parseDatabaseId:(NSNumber **)outValue fromPayload:(id)payload; + (void)_parsePrimaryColors:(NSNumber **)outValue fromPayload:(id)payload; + (void)_parseColorList:(NSArray/**/ **)outValue fromPayload:(id)payload; + (void)_parseError:(TestProtocolDatabaseError **)outValue fromPayload:(id)payload; @end @implementation ProtocolTypeConversions (TestProtocol) + (void)_parseDatabaseId:(NSNumber **)outValue fromPayload:(id)payload { THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSNumber class]); *outValue = (NSNumber *)payload; } + (void)_parsePrimaryColors:(NSNumber **)outValue fromPayload:(id)payload { THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSString class]); *outValue = @(Inspector::fromProtocolString(payload)); } + (void)_parseColorList:(NSArray/**/ **)outValue fromPayload:(id)payload { THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSArray/**/ class]); *outValue = (NSArray/**/ *)payload; } + (void)_parseError:(TestProtocolDatabaseError **)outValue fromPayload:(id)payload { THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSDictionary class]); *outValue = [[TestProtocolDatabaseError alloc] initWithPayload:payload]; } @end ### End File: TestProtocolTypeConversions.mm ### Begin File: TestProtocolTypes.mm /* * Copyright (C) 2013 Google Inc. All rights reserved. * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * Copyright (C) 2014 University of Washington. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json // by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py #import "config.h" #import "TestProtocolInternal.h" #import "TestProtocolTypeConversions.h" #import #import #import using namespace Inspector; @implementation TestProtocolDatabaseError - (instancetype)initWithPayload:(nonnull NSDictionary *)payload { if (!(self = [super init])) return nil; THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(payload[@"message"], @"message"); self.message = payload[@"message"]; THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(payload[@"code"], @"code"); self.code = [payload[@"code"] integerValue]; return self; } - (instancetype)initWithJSONObject:(RWIProtocolJSONObject *)jsonObject { if (!(self = [super initWithInspectorObject:[jsonObject toInspectorObject].get()])) return nil; return self; } - (instancetype)initWithMessage:(NSString *)message code:(int)code; { if (!(self = [super init])) return nil; THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(message, @"message"); self.message = message; self.code = code; return self; } - (void)setMessage:(NSString *)message { [super setString:message forKey:@"message"]; } - (NSString *)message { return [super stringForKey:@"message"]; } - (void)setCode:(int)code { [super setInteger:code forKey:@"code"]; } - (int)code { return [super integerForKey:@"code"]; } @end ### End File: TestProtocolTypes.mm