enum-values.json-result [plain text]
### Begin File: InspectorBackendCommands.js.in
/*
* 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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
// TypeDomain
InspectorBackend.registerDomain("TypeDomain", null);
InspectorBackend.registerEnum("TypeDomain.Enum", {Shared: "shared", 1: "1", 2: "2"});
InspectorBackend.activateDomain("TypeDomain", null);
// CommandDomain
InspectorBackend.registerDomain("CommandDomain", null);
InspectorBackend.registerCommand("CommandDomain.command", null, [{"name": "enumRequired", "type": "string"}, {"name": "enumOptional", "type": "string", "optional": true}, {"name": "parameterRequired", "type": "string"}, {"name": "parameterOptional", "type": "string", "optional": true}], ["enumRequired", "enumOptional", "returnRequired", "returnOptional"]);
InspectorBackend.activateDomain("CommandDomain", null);
// EventDomain
InspectorBackend.registerDomain("EventDomain", null);
InspectorBackend.registerEnum("EventDomain.EventParameterRequired", {Shared: "shared", SharedRequired: "sharedRequired", Grey: "grey"});
InspectorBackend.registerEnum("EventDomain.EventParameterOptional", {Shared: "shared", SharedOptional: "sharedOptional", Green: "green"});
InspectorBackend.registerEvent("EventDomain.event", null, ["enumRequired", "enumOptional", "parameterRequired", "parameterOptional"]);
InspectorBackend.registerEventDomainDispatcher = InspectorBackend.registerDispatcher.bind(InspectorBackend, "EventDomain");
InspectorBackend.activateDomain("EventDomain", null);
### End File: InspectorBackendCommands.js.in
### 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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#pragma once
#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
#include "TestProtocolObjects.h"
#include <JavaScriptCore/InspectorBackendDispatcher.h>
#include <JavaScriptCore/InspectorFrontendRouter.h>
namespace Inspector {
class AlternateBackendDispatcher {
public:
void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
private:
RefPtr<BackendDispatcher> m_backendDispatcher;
};
class AlternateCommandDomainBackendDispatcher : public AlternateBackendDispatcher {
public:
virtual ~AlternateCommandDomainBackendDispatcher() { }
virtual void command(long protocol_requestId, const String& enumRequired, const String& opt_enumOptional, const String& parameterRequired, const String& opt_parameterOptional) = 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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#pragma once
#include "TestProtocolObjects.h"
#include <JavaScriptCore/InspectorBackendDispatcher.h>
#include <tuple>
#include <wtf/Expected.h>
#include <wtf/Optional.h>
#include <wtf/text/WTFString.h>
namespace Inspector {
#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
class AlternateCommandDomainBackendDispatcher;
#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
class CommandDomainBackendDispatcherHandler {
public:
virtual Protocol::ErrorStringOr<std::tuple<Protocol::TypeDomain::Enum /* enumRequired */, Optional<Protocol::TypeDomain::Enum> /* opt_enumOptional */, String /* returnRequired */, String /* opt_returnOptional */>> command(Protocol::TypeDomain::Enum enumRequired, Optional<Protocol::TypeDomain::Enum>&& opt_enumOptional, const String& parameterRequired, const String& opt_parameterOptional) = 0;
protected:
virtual ~CommandDomainBackendDispatcherHandler();
};
class CommandDomainBackendDispatcher final : public SupplementalBackendDispatcher {
public:
static Ref<CommandDomainBackendDispatcher> create(BackendDispatcher&, CommandDomainBackendDispatcherHandler*);
void dispatch(long protocol_requestId, const String& protocol_method, Ref<JSON::Object>&& protocol_message) final;
private:
void command(long protocol_requestId, RefPtr<JSON::Object>&& protocol_parameters);
#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
public:
void setAlternateDispatcher(AlternateCommandDomainBackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
private:
AlternateCommandDomainBackendDispatcher* m_alternateDispatcher { nullptr };
#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
private:
CommandDomainBackendDispatcher(BackendDispatcher&, CommandDomainBackendDispatcherHandler*);
CommandDomainBackendDispatcherHandler* 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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#include "config.h"
#include "TestBackendDispatchers.h"
#include <JavaScriptCore/InspectorFrontendRouter.h>
#include <wtf/NeverDestroyed.h>
#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
#include "TestAlternateBackendDispatchers.h"
#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
namespace Inspector {
CommandDomainBackendDispatcherHandler::~CommandDomainBackendDispatcherHandler() { }
Ref<CommandDomainBackendDispatcher> CommandDomainBackendDispatcher::create(BackendDispatcher& backendDispatcher, CommandDomainBackendDispatcherHandler* agent)
{
return adoptRef(*new CommandDomainBackendDispatcher(backendDispatcher, agent));
}
CommandDomainBackendDispatcher::CommandDomainBackendDispatcher(BackendDispatcher& backendDispatcher, CommandDomainBackendDispatcherHandler* agent)
: SupplementalBackendDispatcher(backendDispatcher)
, m_agent(agent)
{
m_backendDispatcher->registerDispatcherForDomain("CommandDomain"_s, this);
}
void CommandDomainBackendDispatcher::dispatch(long protocol_requestId, const String& protocol_method, Ref<JSON::Object>&& protocol_message)
{
Ref<CommandDomainBackendDispatcher> protect(*this);
auto protocol_parameters = protocol_message->getObject("params"_s);
if (protocol_method == "command"_s) {
command(protocol_requestId, WTFMove(protocol_parameters));
return;
}
m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString("'CommandDomain."_s, protocol_method, "' was not found"_s));
}
void CommandDomainBackendDispatcher::command(long protocol_requestId, RefPtr<JSON::Object>&& protocol_parameters)
{
auto in_enumRequired_json = m_backendDispatcher->getString(protocol_parameters.get(), "enumRequired"_s, true);
auto in_opt_enumOptional_json = m_backendDispatcher->getString(protocol_parameters.get(), "enumOptional"_s, false);
auto in_parameterRequired = m_backendDispatcher->getString(protocol_parameters.get(), "parameterRequired"_s, true);
auto in_opt_parameterOptional = m_backendDispatcher->getString(protocol_parameters.get(), "parameterOptional"_s, false);
if (m_backendDispatcher->hasProtocolErrors()) {
m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, "Some arguments of method 'CommandDomain.command' can't be processed"_s);
return;
}
#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
if (m_alternateDispatcher) {
m_alternateDispatcher->command(protocol_requestId, in_enumRequired_json, in_opt_enumOptional_json, in_parameterRequired, in_opt_parameterOptional);
return;
}
#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
auto in_enumRequired = Protocol::TestHelpers::parseEnumValueFromString<Protocol::TypeDomain::Enum>(in_enumRequired_json);
if (!in_enumRequired) {
m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, makeString("Unknown enumRequired: "_s, in_enumRequired_json));
return;
}
auto in_opt_enumOptional = Protocol::TestHelpers::parseEnumValueFromString<Protocol::TypeDomain::Enum>(in_opt_enumOptional_json);
auto result = m_agent->command(*in_enumRequired, WTFMove(in_opt_enumOptional), in_parameterRequired, in_opt_parameterOptional);
if (!result) {
ASSERT(!result.error().isEmpty());
m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, result.error());
return;
}
auto [out_enumRequired, out_opt_enumOptional, out_returnRequired, out_opt_returnOptional] = WTFMove(result.value());
auto protocol_jsonMessage = JSON::Object::create();
protocol_jsonMessage->setString("enumRequired"_s, Protocol::TestHelpers::getEnumConstantValue(out_enumRequired));
if (!!out_opt_enumOptional)
protocol_jsonMessage->setString("enumOptional"_s, Protocol::TestHelpers::getEnumConstantValue(*out_opt_enumOptional));
protocol_jsonMessage->setString("returnRequired"_s, out_returnRequired);
if (!!out_opt_returnOptional)
protocol_jsonMessage->setString("returnOptional"_s, out_opt_returnOptional);
m_backendDispatcher->sendResponse(protocol_requestId, WTFMove(protocol_jsonMessage), false);
}
} // 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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#pragma once
#include "TestProtocolObjects.h"
#include <wtf/JSONValues.h>
#include <wtf/Optional.h>
#include <wtf/text/WTFString.h>
namespace Inspector {
class FrontendRouter;
class EventDomainFrontendDispatcher {
WTF_MAKE_FAST_ALLOCATED;
public:
EventDomainFrontendDispatcher(FrontendRouter& frontendRouter) : m_frontendRouter(frontendRouter) { }
// Named after parameter 'parameterRequired' while generating command/event event.
enum class ParameterRequired {
Shared = 0,
SharedRequired = 3,
Grey = 4,
}; // enum class ParameterRequired
// Named after parameter 'parameterOptional' while generating command/event event.
enum class ParameterOptional {
Shared = 0,
SharedOptional = 5,
Green = 6,
}; // enum class ParameterOptional
void event(Protocol::TypeDomain::Enum enumRequired, Optional<Protocol::TypeDomain::Enum>&& opt_enumOptional, const String& parameterRequired, const String& opt_parameterOptional);
private:
FrontendRouter& m_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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#include "config.h"
#include "TestFrontendDispatchers.h"
#include <JavaScriptCore/InspectorFrontendRouter.h>
namespace Inspector {
void EventDomainFrontendDispatcher::event(Protocol::TypeDomain::Enum enumRequired, Optional<Protocol::TypeDomain::Enum>&& opt_enumOptional, const String& parameterRequired, const String& opt_parameterOptional)
{
auto protocol_jsonMessage = JSON::Object::create();
protocol_jsonMessage->setString("method"_s, "EventDomain.event"_s);
auto protocol_paramsObject = JSON::Object::create();
protocol_paramsObject->setString("enumRequired"_s, Protocol::TestHelpers::getEnumConstantValue(enumRequired));
if (!!opt_enumOptional)
protocol_paramsObject->setString("enumOptional"_s, Protocol::TestHelpers::getEnumConstantValue(*opt_enumOptional));
protocol_paramsObject->setString("parameterRequired"_s, parameterRequired);
if (!!opt_parameterOptional)
protocol_paramsObject->setString("parameterOptional"_s, opt_parameterOptional);
protocol_jsonMessage->setObject("params"_s, WTFMove(protocol_paramsObject));
m_frontendRouter.sendEvent(protocol_jsonMessage->toJSONString());
}
} // 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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#pragma once
#include <JavaScriptCore/InspectorProtocolTypes.h>
#include <wtf/JSONValues.h>
#include <wtf/Optional.h>
#include <wtf/text/WTFString.h>
namespace Inspector {
namespace Protocol {
// Forward declarations.
namespace TypeDomain {
enum class Enum;
} // TypeDomain
// End of forward declarations.
namespace TestHelpers {
String getEnumConstantValue(int code);
template<typename T> String getEnumConstantValue(T enumValue)
{
return getEnumConstantValue(static_cast<int>(enumValue));
}
} // namespace TestHelpers
namespace TypeDomain {
enum class Enum {
Shared = 0,
1 = 1,
2 = 2,
}; // enum class Enum
} // TypeDomain
namespace TestHelpers {
template<typename ProtocolEnumType>
Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
// Enums in the 'TypeDomain' Domain
template<>
Optional<Protocol::TypeDomain::Enum> parseEnumValueFromString<Protocol::TypeDomain::Enum>(const String&);
} // namespace TestHelpers
} // namespace Protocol
} // namespace Inspector
namespace WTF {
template<typename T> struct DefaultHash;
// Hash declarations in the 'TypeDomain' Domain
template<>
struct DefaultHash<Inspector::Protocol::TypeDomain::Enum> : IntHash<Inspector::Protocol::TypeDomain::Enum> { };
} // namespace WTF
### 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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#include "config.h"
#include "TestProtocolObjects.h"
#include <wtf/Assertions.h>
namespace Inspector {
namespace Protocol {
namespace TestHelpers {
static const ASCIILiteral enum_constant_values[] = {
"shared"_s,
"1"_s,
"2"_s,
"sharedRequired"_s,
"grey"_s,
"sharedOptional"_s,
"green"_s,
"black"_s,
"red"_s,
"white"_s,
"blue"_s,
};
String getEnumConstantValue(int code) {
return enum_constant_values[code];
}
// Enums in the 'TypeDomain' Domain
template<>
Optional<Protocol::TypeDomain::Enum> parseEnumValueFromString<Protocol::TypeDomain::Enum>(const String& protocolString)
{
static const size_t constantValues[] = {
(size_t)Protocol::TypeDomain::Enum::Shared,
(size_t)Protocol::TypeDomain::Enum::1,
(size_t)Protocol::TypeDomain::Enum::2,
};
for (size_t i = 0; i < 3; ++i)
if (protocolString == enum_constant_values[constantValues[i]])
return (Protocol::TypeDomain::Enum)constantValues[i];
return WTF::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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
#include <wtf/RetainPtr.h>
@protocol TestProtocolCommandDomainDomainHandler;
namespace Inspector {
class ObjCInspectorCommandDomainBackendDispatcher final : public AlternateCommandDomainBackendDispatcher {
WTF_MAKE_FAST_ALLOCATED;
public:
ObjCInspectorCommandDomainBackendDispatcher(id<TestProtocolCommandDomainDomainHandler> handler) { m_delegate = handler; }
void command(long protocol_requestId, const String& enumRequired, const String& opt_enumOptional, const String& parameterRequired, const String& opt_parameterOptional) final;
private:
RetainPtr<id<TestProtocolCommandDomainDomainHandler>> m_delegate;
};
} // namespace Inspector
### End File: TestProtocolBackendDispatchers.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 enum-values.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 <wtf/JSONValues.h>
namespace Inspector {
void ObjCInspectorCommandDomainBackendDispatcher::command(long protocol_requestId, const String& in_enumRequired, const String& in_opt_enumOptional, const String& in_parameterRequired, const String& in_opt_parameterOptional)
{
if (![m_delegate respondsToSelector:@selector(commandWithErrorCallback:successCallback:enumRequired:enumOptional:parameterRequired:parameterOptional:)]) {
backendDispatcher()->reportProtocolError(protocol_requestId, BackendDispatcher::MethodNotFound, "'CommandDomain.command' was not found"_s);
backendDispatcher()->sendPendingErrors();
return;
}
id errorCallback = ^(NSString *error) {
backendDispatcher()->reportProtocolError(protocol_requestId, BackendDispatcher::ServerError, error);
backendDispatcher()->sendPendingErrors();
};
id successCallback = ^(TestProtocolTypeDomainEnum out_enumRequired, TestProtocolTypeDomainEnum *out_opt_enumOptional, TestProtocolCommandDomain(anonymous) out_returnRequired, TestProtocolCommandDomain(anonymous) *out_opt_returnOptional) {
auto protocol_jsonMessage = JSON::Object::create();
protocol_jsonMessage->setString("enumRequired"_s, toProtocolString(out_enumRequired));
if (!!out_opt_enumOptional)
protocol_jsonMessage->setString("enumOptional"_s, toProtocolString(*out_opt_enumOptional));
protocol_jsonMessage->setString("returnRequired"_s, toProtocolString(out_returnRequired));
if (!!out_opt_returnOptional)
protocol_jsonMessage->setString("returnOptional"_s, toProtocolString(*out_opt_returnOptional));
backendDispatcher()->sendResponse(protocol_requestId, WTFMove(protocol_jsonMessage), false);
};
Optional<TestProtocolTypeDomainEnum> o_in_enumRequired = fromProtocolString<TestProtocolTypeDomainEnum>(in_enumRequired);
if (!o_in_enumRequired) {
backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, "Parameter 'enumRequired' of method 'CommandDomain.command' cannot be processed"_s);
return;
}
Optional<TestProtocolTypeDomainEnum> o_in_opt_enumOptional;
if (!!in_opt_enumOptional)
o_in_opt_enumOptional = fromProtocolString<TestProtocolTypeDomainEnum>(in_opt_enumOptional);
Optional<TestProtocolCommandDomain(anonymous)> o_in_parameterRequired = fromProtocolString<TestProtocolCommandDomain(anonymous)>(in_parameterRequired);
if (!o_in_parameterRequired) {
backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, "Parameter 'parameterRequired' of method 'CommandDomain.command' cannot be processed"_s);
return;
}
Optional<TestProtocolCommandDomain(anonymous)> o_in_opt_parameterOptional;
if (!!in_opt_parameterOptional)
o_in_opt_parameterOptional = fromProtocolString<TestProtocolCommandDomain(anonymous)>(in_opt_parameterOptional);
[m_delegate commandWithErrorCallback:errorCallback successCallback:successCallback enumRequired:o_in_enumRequired.value() enumOptional:(!!in_opt_enumOptional ? &o_in_opt_enumOptional.value() : nil) parameterRequired:o_in_parameterRequired.value() parameterOptional:(!!in_opt_parameterOptional ? &o_in_opt_parameterOptional.value() : nil)];
}
} // namespace Inspector
### End File: TestProtocolBackendDispatchers.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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#import <WebInspector/TestProtocol.h>
__attribute__((visibility ("default")))
@interface TestProtocolConfiguration : NSObject
@property (nonatomic, retain, setter=setCommandDomainHandler:) id<TestProtocolCommandDomainDomainHandler> commandDomainHandler;
@property (nonatomic, readonly) TestProtocolEventDomainDomainEventDispatcher *eventDomainEventDispatcher;
@end
### End File: TestProtocolConfiguration.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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#import "TestProtocolConfiguration.h"
#import "TestProtocolInternal.h"
#import "TestProtocolBackendDispatchers.h"
#import <JavaScriptCore/AlternateDispatchableAgent.h>
#import <JavaScriptCore/AugmentableInspectorController.h>
#import <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
#import <JavaScriptCore/InspectorBackendDispatchers.h>
using namespace Inspector;
@implementation TestProtocolConfiguration
{
AugmentableInspectorController* _controller;
id<TestProtocolCommandDomainDomainHandler> _commandDomainHandler;
TestProtocolEventDomainDomainEventDispatcher *_eventDomainEventDispatcher;
}
- (instancetype)initWithController:(AugmentableInspectorController*)controller
{
self = [super init];
if (!self)
return nil;
ASSERT(controller);
_controller = controller;
return self;
}
- (void)dealloc
{
[_commandDomainHandler release];
[_eventDomainEventDispatcher release];
[super dealloc];
}
- (void)setCommandDomainHandler:(id<TestProtocolCommandDomainDomainHandler>)handler
{
if (handler == _commandDomainHandler)
return;
[_commandDomainHandler release];
_commandDomainHandler = [handler retain];
auto alternateDispatcher = makeUnique<ObjCInspectorCommandDomainBackendDispatcher>(handler);
auto alternateAgent = makeUnique<AlternateDispatchableAgent<CommandDomainBackendDispatcher, AlternateCommandDomainBackendDispatcher>>("CommandDomain"_s, *_controller, WTFMove(alternateDispatcher));
_controller->registerAlternateAgent(WTFMove(alternateAgent));
}
- (id<TestProtocolCommandDomainDomainHandler>)commandDomainHandler
{
return _commandDomainHandler;
}
- (TestProtocolEventDomainDomainEventDispatcher *)eventDomainEventDispatcher
{
if (!_eventDomainEventDispatcher)
_eventDomainEventDispatcher = [[TestProtocolEventDomainDomainEventDispatcher alloc] initWithController:_controller];
return _eventDomainEventDispatcher;
}
@end
### End File: TestProtocolConfiguration.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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#import "TestProtocolInternal.h"
#import "TestProtocolTypeConversions.h"
#import <wtf/JSONValues.h>
using namespace Inspector;
@implementation TestProtocolEventDomainDomainEventDispatcher
{
AugmentableInspectorController* _controller;
}
- (instancetype)initWithController:(AugmentableInspectorController*)controller
{
self = [super init];
if (!self)
return nil;
ASSERT(controller);
_controller = controller;
return self;
}
- (void)eventWithEnumRequired:(TestProtocolTypeDomainEnum)enumRequired enumOptional:(TestProtocolTypeDomainEnum *)enumOptional parameterRequired:(TestProtocolEventDomain(anonymous))parameterRequired parameterOptional:(TestProtocolEventDomain(anonymous) *)parameterOptional
{
const FrontendRouter& router = _controller->frontendRouter();
auto protocol_jsonMessage = JSON::Object::create();
protocol_jsonMessage->setString("method"_s, "EventDomain.event"_s);
auto protocol_paramsObject = JSON::Object::create();
protocol_paramsObject->setString("enumRequired"_s, toProtocolString(enumRequired));
if (enumOptional)
protocol_paramsObject->setString("enumOptional"_s, toProtocolString((*enumOptional)));
protocol_paramsObject->setString("parameterRequired"_s, toProtocolString(parameterRequired));
if (parameterOptional)
protocol_paramsObject->setString("parameterOptional"_s, toProtocolString((*parameterOptional)));
protocol_jsonMessage->setObject("params"_s, WTFMove(protocol_paramsObject));
router.sendEvent(protocol_jsonMessage->toJSONString());
}
@end
### 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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#import <Foundation/Foundation.h>
#import <WebInspector/RWIProtocolJSONObject.h>
typedef NS_ENUM(NSInteger, TestProtocolTypeDomainEnum) {
TestProtocolTypeDomainEnumShared,
TestProtocolTypeDomainEnum1,
TestProtocolTypeDomainEnum2,
};
@protocol TestProtocolCommandDomainDomainHandler <NSObject>
@optional
- (void)commandWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(TestProtocolTypeDomainEnum enumRequired, TestProtocolTypeDomainEnum *enumOptional, TestProtocolCommandDomain(anonymous) returnRequired, TestProtocolCommandDomain(anonymous) *returnOptional))successCallback enumRequired:(TestProtocolTypeDomainEnum)enumRequired enumOptional:(TestProtocolTypeDomainEnum *)enumOptional parameterRequired:(TestProtocolCommandDomain(anonymous))parameterRequired parameterOptional:(TestProtocolCommandDomain(anonymous) *)parameterOptional;
@end
__attribute__((visibility ("default")))
@interface TestProtocolEventDomainDomainEventDispatcher : NSObject
- (void)eventWithEnumRequired:(TestProtocolTypeDomainEnum)enumRequired enumOptional:(TestProtocolTypeDomainEnum *)enumOptional parameterRequired:(TestProtocolEventDomain(anonymous))parameterRequired parameterOptional:(TestProtocolEventDomain(anonymous) *)parameterOptional;
@end
#import <WebInspector/RWIProtocolBuildCompatibilityObjects.h>
### 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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#import "TestProtocol.h"
#import "TestProtocolJSONObjectPrivate.h"
#import <JavaScriptCore/AugmentableInspectorController.h>
#import <wtf/JSONValues.h>
@interface TestProtocolEventDomainDomainEventDispatcher (Private)
- (instancetype)initWithController:(Inspector::AugmentableInspectorController*)controller;
@end
### 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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#import "TestProtocol.h"
#import <WebInspector/RWIProtocolArrayConversions.h>
namespace Inspector {
template<typename ObjCEnumType>
Optional<ObjCEnumType> fromProtocolString(const String& value);
inline String toProtocolString(TestProtocolTypeDomainEnum value)
{
switch(value) {
case TestProtocolTypeDomainEnumShared:
return "shared"_s;
case TestProtocolTypeDomainEnum1:
return "1"_s;
case TestProtocolTypeDomainEnum2:
return "2"_s;
}
}
template<>
inline Optional<TestProtocolTypeDomainEnum> fromProtocolString(const String& value)
{
if (value == "shared")
return TestProtocolTypeDomainEnumShared;
if (value == "1")
return TestProtocolTypeDomainEnum1;
if (value == "2")
return TestProtocolTypeDomainEnum2;
return WTF::nullopt;
}
} // 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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#import "TestProtocolTypeConversions.h"
#import "TestProtocol.h"
#import "TestProtocolTypeParser.h"
#import <WebInspector/RWIProtocolJSONObjectPrivate.h>
using namespace Inspector;
@interface TestProtocolTypeConversions (TypeDomainDomain)
+ (void)_parseEnum:(NSNumber **)outValue fromPayload:(id)payload;
@end
@implementation TestProtocolTypeConversions (TypeDomainDomain)
+ (void)_parseEnum:(NSNumber **)outValue fromPayload:(id)payload
{
THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSString class]);
Optional<TestProtocolTypeDomainEnum> result = Inspector::fromProtocolString<TestProtocolTypeDomainEnum>(payload);
THROW_EXCEPTION_FOR_BAD_ENUM_VALUE(result, @"Enum");
*outValue = @(result.value());
}
@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 enum-values.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
#import "TestProtocolInternal.h"
#import "TestProtocolTypeConversions.h"
#import <WebInspector/RWIProtocolJSONObjectPrivate.h>
#import <wtf/Assertions.h>
#import <wtf/JSONValues.h>
using namespace Inspector;
### End File: TestProtocolTypes.mm