diff options
Diffstat (limited to 'Source/JavaScriptCore/replay/scripts/tests/expected')
30 files changed, 1777 insertions, 0 deletions
diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-c-style-enum-no-storage.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-c-style-enum-no-storage.json-error new file mode 100644 index 000000000..9ef00c4aa --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-c-style-enum-no-storage.json-error @@ -0,0 +1 @@ +ERROR: Could not parse enumerable type MouseButton: C-style enum declarations not enclosed by a class must specify their storage type so they can be forward declared. diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-enum-type.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-enum-type.json-error new file mode 100644 index 000000000..ef750bf0e --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-enum-type.json-error @@ -0,0 +1 @@ +ERROR: Duplicate type with name: PlatformEvent::Type diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-input-names.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-input-names.json-error new file mode 100644 index 000000000..d31ec8023 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-input-names.json-error @@ -0,0 +1 @@ +ERROR: Duplicate input with name: GetCurrentTime diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-type-names.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-type-names.json-error new file mode 100644 index 000000000..d1e4c47bb --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-type-names.json-error @@ -0,0 +1 @@ +ERROR: Duplicate type with name: uint64_t diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-enum-type-missing-values.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-enum-type-missing-values.json-error new file mode 100644 index 000000000..b4a348cf6 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-enum-type-missing-values.json-error @@ -0,0 +1 @@ +ERROR: When parsing enum, required property missing: values diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-member-name.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-member-name.json-error new file mode 100644 index 000000000..0bb2869d2 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-member-name.json-error @@ -0,0 +1 @@ +ERROR: When parsing member, required property missing: name diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-name.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-name.json-error new file mode 100644 index 000000000..b599607a7 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-name.json-error @@ -0,0 +1 @@ +ERROR: When parsing input, required property missing: name diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-queue.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-queue.json-error new file mode 100644 index 000000000..c7919ab55 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-queue.json-error @@ -0,0 +1 @@ +ERROR: When parsing input, required property missing: queue diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-type-mode.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-type-mode.json-error new file mode 100644 index 000000000..6929f4f8a --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-type-mode.json-error @@ -0,0 +1 @@ +ERROR: When parsing type, required property missing: mode diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-type-name.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-type-name.json-error new file mode 100644 index 000000000..0aad90019 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-type-name.json-error @@ -0,0 +1 @@ +ERROR: When parsing type, required property missing: name diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-input-queue.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-input-queue.json-error new file mode 100644 index 000000000..acf469b68 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-input-queue.json-error @@ -0,0 +1 @@ +ERROR: Unknown input queue: SCRIPT_MEOIZED diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-member-type.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-member-type.json-error new file mode 100644 index 000000000..d31e454c6 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-member-type.json-error @@ -0,0 +1 @@ +ERROR: Unknown type 'double' referenced by member 'randomSeed' of input 'SetRandomSeed' diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-type-mode.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-type-mode.json-error new file mode 100644 index 000000000..952c69ec8 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-type-mode.json-error @@ -0,0 +1 @@ +ERROR: Unknown type mode: BONKERS diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp new file mode 100644 index 000000000..d5b15855b --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-enum-encoding-helpers-with-guarded-values.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#include "config.h" +#include "generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h" + +#if ENABLE(WEB_REPLAY) +#include "InternalNamespaceImplIncludeDummy.h" +#include <platform/ExternalNamespaceImplIncludeDummy.h> +#include <platform/PlatformMouseEvent.h> + +namespace Test { +SavedMouseButton::SavedMouseButton(MouseButton button) + : NondeterministicInput<SavedMouseButton>() + , m_button(button) +{ +} + +SavedMouseButton::~SavedMouseButton() +{ +} +} // namespace Test + +namespace JSC { +const String& InputTraits<Test::SavedMouseButton>::type() +{ + static NeverDestroyed<const String> type(ASCIILiteral("SavedMouseButton")); + return type; +} + +void InputTraits<Test::SavedMouseButton>::encode(EncodedValue& encodedValue, const Test::SavedMouseButton& input) +{ + encodedValue.put<WebCore::MouseButton>(ASCIILiteral("button"), input.button()); +} + +bool InputTraits<Test::SavedMouseButton>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::SavedMouseButton>& input) +{ + WebCore::MouseButton button; + if (!encodedValue.get<WebCore::MouseButton>(ASCIILiteral("button"), button)) + return false; + + input = std::make_unique<Test::SavedMouseButton>(button); + return true; +} + +} // namespace JSC + +#endif // ENABLE(WEB_REPLAY) diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h new file mode 100644 index 000000000..913fffb50 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-enum-encoding-helpers-with-guarded-values.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#pragma once + +#if ENABLE(WEB_REPLAY) +#include "InternalNamespaceHeaderIncludeDummy.h" +#include <platform/ExternalNamespaceHeaderIncludeDummy.h> + +namespace WebCore { +enum MouseButton : unsigned; +} + + +namespace Test { +class SavedMouseButton; +} // namespace Test + +namespace JSC { +template<> struct TEST_EXPORT_MACRO InputTraits<Test::SavedMouseButton> { + static InputQueue queue() { return InputQueue::ScriptMemoizedData; } + static const String& type(); + + static void encode(JSC::EncodedValue&, const Test::SavedMouseButton&); + static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::SavedMouseButton>&); +}; + +} // namespace JSC + +namespace Test { +class SavedMouseButton : public NondeterministicInput<SavedMouseButton> { +public: + TEST_EXPORT_MACRO SavedMouseButton(MouseButton button); + virtual ~SavedMouseButton(); + + MouseButton button() const { return m_button; } +private: + MouseButton m_button; +}; +} // namespace Test + +SPECIALIZE_TYPE_TRAITS_BEGIN(Test::SavedMouseButton) + static bool isType(const NondeterministicInputBase& input) { return input.type() == InputTraits<Test::SavedMouseButton>::type(); } +SPECIALIZE_TYPE_TRAITS_END() + +#define TEST_REPLAY_INPUT_NAMES_FOR_EACH(macro) \ + macro(SavedMouseButton) \ + \ +// end of TEST_REPLAY_INPUT_NAMES_FOR_EACH + +#endif // ENABLE(WEB_REPLAY) diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp new file mode 100644 index 000000000..4ed407ca3 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp @@ -0,0 +1,228 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-enum-encoding-helpers.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#include "config.h" +#include "generate-enum-encoding-helpers.json-TestReplayInputs.h" + +#if ENABLE(WEB_REPLAY) +#include "InternalNamespaceImplIncludeDummy.h" +#include "NondeterministicInput.h" +#include "PlatformMouseEvent.h" +#include <platform/ExternalNamespaceImplIncludeDummy.h> + +namespace Test { +SavedMouseButton::SavedMouseButton(MouseButton button) + : NondeterministicInput<SavedMouseButton>() + , m_button(button) +{ +} + +SavedMouseButton::~SavedMouseButton() +{ +} +} // namespace Test + +namespace JSC { +const String& InputTraits<Test::SavedMouseButton>::type() +{ + static NeverDestroyed<const String> type(ASCIILiteral("SavedMouseButton")); + return type; +} + +void InputTraits<Test::SavedMouseButton>::encode(EncodedValue& encodedValue, const Test::SavedMouseButton& input) +{ + encodedValue.put<Test::MouseButton>(ASCIILiteral("button"), input.button()); +} + +bool InputTraits<Test::SavedMouseButton>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::SavedMouseButton>& input) +{ + Test::MouseButton button; + if (!encodedValue.get<Test::MouseButton>(ASCIILiteral("button"), button)) + return false; + + input = std::make_unique<Test::SavedMouseButton>(button); + return true; +} +EncodedValue EncodingTraits<Test::InputQueue>::encodeValue(const Test::InputQueue& enumValue) +{ + switch (enumValue) { + case Test::InputQueue::EventLoopInput: return EncodedValue::createString("EventLoopInput"); + case Test::InputQueue::LoaderMemoizedData: return EncodedValue::createString("LoaderMemoizedData"); + case Test::InputQueue::ScriptMemoizedData: return EncodedValue::createString("ScriptMemoizedData"); + default: ASSERT_NOT_REACHED(); return EncodedValue::createString("Error!"); + } +} + +bool EncodingTraits<Test::InputQueue>::decodeValue(EncodedValue& encodedValue, Test::InputQueue& enumValue) +{ + String enumString = encodedValue.convertTo<String>(); + if (enumString == "EventLoopInput") { + enumValue = Test::InputQueue::EventLoopInput; + return true; + } + if (enumString == "LoaderMemoizedData") { + enumValue = Test::InputQueue::LoaderMemoizedData; + return true; + } + if (enumString == "ScriptMemoizedData") { + enumValue = Test::InputQueue::ScriptMemoizedData; + return true; + } + return false; +} + +EncodedValue EncodingTraits<Test::MouseButton>::encodeValue(const Test::MouseButton& enumValue) +{ + EncodedValue encodedValue = EncodedValue::createArray(); + if (enumValue & Test::NoButton) { + encodedValue.append<String>(ASCIILiteral("NoButton")); + if (enumValue == Test::NoButton) + return encodedValue; + } + if (enumValue & Test::LeftButton) { + encodedValue.append<String>(ASCIILiteral("LeftButton")); + if (enumValue == Test::LeftButton) + return encodedValue; + } + if (enumValue & Test::MiddleButton) { + encodedValue.append<String>(ASCIILiteral("MiddleButton")); + if (enumValue == Test::MiddleButton) + return encodedValue; + } + if (enumValue & Test::RightButton) { + encodedValue.append<String>(ASCIILiteral("RightButton")); + if (enumValue == Test::RightButton) + return encodedValue; + } + return encodedValue; +} + +bool EncodingTraits<Test::MouseButton>::decodeValue(EncodedValue& encodedValue, Test::MouseButton& enumValue) +{ + Vector<String> enumStrings; + if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings)) + return false; + + for (const String& enumString : enumStrings) { + if (enumString == "NoButton") + enumValue = static_cast<Test::MouseButton>(enumValue | Test::NoButton); + else if (enumString == "LeftButton") + enumValue = static_cast<Test::MouseButton>(enumValue | Test::LeftButton); + else if (enumString == "MiddleButton") + enumValue = static_cast<Test::MouseButton>(enumValue | Test::MiddleButton); + else if (enumString == "RightButton") + enumValue = static_cast<Test::MouseButton>(enumValue | Test::RightButton); + } + + return true; +} + +EncodedValue EncodingTraits<Test::PlatformEvent::OtherType>::encodeValue(const OptionSet<Test::PlatformEvent::OtherType>& enumValue) +{ + EncodedValue encodedValue = EncodedValue::createArray(); + if (enumValue.contains(Test::PlatformEvent::OtherType::Mouse)) + encodedValue.append<String>(ASCIILiteral("Mouse")); + if (enumValue.contains(Test::PlatformEvent::OtherType::Key)) + encodedValue.append<String>(ASCIILiteral("Key")); + if (enumValue.contains(Test::PlatformEvent::OtherType::Touch)) + encodedValue.append<String>(ASCIILiteral("Touch")); + if (enumValue.contains(Test::PlatformEvent::OtherType::Wheel)) + encodedValue.append<String>(ASCIILiteral("Wheel")); + + return encodedValue; +} + +bool EncodingTraits<Test::PlatformEvent::OtherType>::decodeValue(EncodedValue& encodedValue, OptionSet<Test::PlatformEvent::OtherType>& enumValue) +{ + Vector<String> enumStrings; + if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings)) + return false; + + for (const String& enumString : enumStrings) { + if (enumString == "Mouse") + enumValue |= Test::PlatformEvent::OtherType::Mouse; + else if (enumString == "Key") + enumValue |= Test::PlatformEvent::OtherType::Key; + else if (enumString == "Touch") + enumValue |= Test::PlatformEvent::OtherType::Touch; + else if (enumString == "Wheel") + enumValue |= Test::PlatformEvent::OtherType::Wheel; + } + + return true; +} + +EncodedValue EncodingTraits<Test::PlatformEvent::Type>::encodeValue(const Test::PlatformEvent::Type& enumValue) +{ + EncodedValue encodedValue = EncodedValue::createArray(); + if (enumValue & Test::PlatformEvent::Mouse) { + encodedValue.append<String>(ASCIILiteral("Mouse")); + if (enumValue == Test::PlatformEvent::Mouse) + return encodedValue; + } + if (enumValue & Test::PlatformEvent::Key) { + encodedValue.append<String>(ASCIILiteral("Key")); + if (enumValue == Test::PlatformEvent::Key) + return encodedValue; + } + if (enumValue & Test::PlatformEvent::Touch) { + encodedValue.append<String>(ASCIILiteral("Touch")); + if (enumValue == Test::PlatformEvent::Touch) + return encodedValue; + } + if (enumValue & Test::PlatformEvent::Wheel) { + encodedValue.append<String>(ASCIILiteral("Wheel")); + if (enumValue == Test::PlatformEvent::Wheel) + return encodedValue; + } + return encodedValue; +} + +bool EncodingTraits<Test::PlatformEvent::Type>::decodeValue(EncodedValue& encodedValue, Test::PlatformEvent::Type& enumValue) +{ + Vector<String> enumStrings; + if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings)) + return false; + + for (const String& enumString : enumStrings) { + if (enumString == "Mouse") + enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Mouse); + else if (enumString == "Key") + enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Key); + else if (enumString == "Touch") + enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Touch); + else if (enumString == "Wheel") + enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Wheel); + } + + return true; +} +} // namespace JSC + +#endif // ENABLE(WEB_REPLAY) diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h new file mode 100644 index 000000000..37bd92fef --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-enum-encoding-helpers.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#pragma once + +#if ENABLE(WEB_REPLAY) +#include "InternalNamespaceHeaderIncludeDummy.h" +#include "PlatformEvent.h" +#include <platform/ExternalNamespaceHeaderIncludeDummy.h> + +namespace Test { +enum MouseButton : unsigned; +enum class InputQueue; +} + + +namespace Test { +class SavedMouseButton; +} // namespace Test + +namespace JSC { +template<> struct TEST_EXPORT_MACRO InputTraits<Test::SavedMouseButton> { + static InputQueue queue() { return InputQueue::ScriptMemoizedData; } + static const String& type(); + + static void encode(JSC::EncodedValue&, const Test::SavedMouseButton&); + static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::SavedMouseButton>&); +}; +template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::InputQueue> { + typedef Test::InputQueue DecodedType; + + static EncodedValue encodeValue(const Test::InputQueue& value); + static bool decodeValue(EncodedValue&, Test::InputQueue& value); +}; + +template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::MouseButton> { + typedef Test::MouseButton DecodedType; + + static EncodedValue encodeValue(const Test::MouseButton& value); + static bool decodeValue(EncodedValue&, Test::MouseButton& value); +}; + +template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::PlatformEvent::OtherType> { + typedef OptionSet<Test::PlatformEvent::OtherType> DecodedType; + + static EncodedValue encodeValue(const OptionSet<Test::PlatformEvent::OtherType>& value); + static bool decodeValue(EncodedValue&, OptionSet<Test::PlatformEvent::OtherType>& value); +}; + +template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::PlatformEvent::Type> { + typedef Test::PlatformEvent::Type DecodedType; + + static EncodedValue encodeValue(const Test::PlatformEvent::Type& value); + static bool decodeValue(EncodedValue&, Test::PlatformEvent::Type& value); +}; +} // namespace JSC + +namespace Test { +class SavedMouseButton : public NondeterministicInput<SavedMouseButton> { +public: + TEST_EXPORT_MACRO SavedMouseButton(MouseButton button); + virtual ~SavedMouseButton(); + + MouseButton button() const { return m_button; } +private: + MouseButton m_button; +}; +} // namespace Test + +SPECIALIZE_TYPE_TRAITS_BEGIN(Test::SavedMouseButton) + static bool isType(const NondeterministicInputBase& input) { return input.type() == InputTraits<Test::SavedMouseButton>::type(); } +SPECIALIZE_TYPE_TRAITS_END() + +#define TEST_REPLAY_INPUT_NAMES_FOR_EACH(macro) \ + macro(SavedMouseButton) \ + \ +// end of TEST_REPLAY_INPUT_NAMES_FOR_EACH + +#endif // ENABLE(WEB_REPLAY) diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.cpp b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.cpp new file mode 100644 index 000000000..486756e96 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.cpp @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-enum-with-guard.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#include "config.h" +#include "generate-enum-with-guard.json-TestReplayInputs.h" + +#if ENABLE(WEB_REPLAY) +#include "InternalNamespaceImplIncludeDummy.h" +#include "PlatformWheelEvent.h" +#include <platform/ExternalNamespaceImplIncludeDummy.h> +#include <platform/PlatformWheelEvent.h> + +namespace Test { +HandleWheelEvent::HandleWheelEvent(std::unique_ptr<PlatformWheelEvent> platformEvent, PlatformWheelPhase phase) + : EventLoopInput<HandleWheelEvent>() + , m_platformEvent(WTFMove(platformEvent)) + , m_phase(phase) +{ +} + +HandleWheelEvent::~HandleWheelEvent() +{ +} +} // namespace Test + +namespace JSC { +const String& InputTraits<Test::HandleWheelEvent>::type() +{ + static NeverDestroyed<const String> type(ASCIILiteral("HandleWheelEvent")); + return type; +} + +void InputTraits<Test::HandleWheelEvent>::encode(EncodedValue& encodedValue, const Test::HandleWheelEvent& input) +{ + encodedValue.put<WebCore::PlatformWheelEvent>(ASCIILiteral("platformEvent"), input.platformEvent()); + encodedValue.put<Test::PlatformWheelPhase>(ASCIILiteral("phase"), input.phase()); +} + +bool InputTraits<Test::HandleWheelEvent>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::HandleWheelEvent>& input) +{ + std::unique_ptr<WebCore::PlatformWheelEvent> platformEvent; + if (!encodedValue.get<WebCore::PlatformWheelEvent>(ASCIILiteral("platformEvent"), platformEvent)) + return false; + + Test::PlatformWheelPhase phase; + if (!encodedValue.get<Test::PlatformWheelPhase>(ASCIILiteral("phase"), phase)) + return false; + + input = std::make_unique<Test::HandleWheelEvent>(WTFMove(platformEvent), phase); + return true; +} +#if ENABLE(DUMMY_FEATURE) +EncodedValue EncodingTraits<Test::PlatformWheelPhase>::encodeValue(const Test::PlatformWheelPhase& enumValue) +{ + EncodedValue encodedValue = EncodedValue::createArray(); + if (enumValue & Test::PlatformWheelEventPhaseNone) { + encodedValue.append<String>(ASCIILiteral("PlatformWheelEventPhaseNone")); + if (enumValue == Test::PlatformWheelEventPhaseNone) + return encodedValue; + } + return encodedValue; +} + +bool EncodingTraits<Test::PlatformWheelPhase>::decodeValue(EncodedValue& encodedValue, Test::PlatformWheelPhase& enumValue) +{ + Vector<String> enumStrings; + if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings)) + return false; + + for (const String& enumString : enumStrings) { + if (enumString == "PlatformWheelEventPhaseNone") + enumValue = static_cast<Test::PlatformWheelPhase>(enumValue | Test::PlatformWheelEventPhaseNone); + } + + return true; +} +#endif // ENABLE(DUMMY_FEATURE) +} // namespace JSC + +#endif // ENABLE(WEB_REPLAY) diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.h b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.h new file mode 100644 index 000000000..adab4b7db --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-enum-with-guard.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#pragma once + +#if ENABLE(WEB_REPLAY) +#include "InternalNamespaceHeaderIncludeDummy.h" +#include <platform/ExternalNamespaceHeaderIncludeDummy.h> + +namespace Test { +enum PlatformWheelPhase : uint64_t; +} + +namespace WebCore { +class PlatformWheelEvent; +} + + +namespace Test { +class HandleWheelEvent; +} // namespace Test + +namespace JSC { +template<> struct TEST_EXPORT_MACRO InputTraits<Test::HandleWheelEvent> { + static InputQueue queue() { return InputQueue::EventLoopInput; } + static const String& type(); + + static void encode(JSC::EncodedValue&, const Test::HandleWheelEvent&); + static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::HandleWheelEvent>&); +}; +#if ENABLE(DUMMY_FEATURE) +template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::PlatformWheelPhase> { + typedef Test::PlatformWheelPhase DecodedType; + + static EncodedValue encodeValue(const Test::PlatformWheelPhase& value); + static bool decodeValue(EncodedValue&, Test::PlatformWheelPhase& value); +}; +#endif // ENABLE(DUMMY_FEATURE) +} // namespace JSC + +namespace Test { +class HandleWheelEvent : public EventLoopInput<HandleWheelEvent> { +public: + TEST_EXPORT_MACRO HandleWheelEvent(std::unique_ptr<PlatformWheelEvent> platformEvent, PlatformWheelPhase phase); + virtual ~HandleWheelEvent(); + + // EventLoopInput API + virtual void dispatch(ReplayController&) final; + const PlatformWheelEvent& platformEvent() const { return *m_platformEvent; } + PlatformWheelPhase phase() const { return m_phase; } +private: + std::unique_ptr<PlatformWheelEvent> m_platformEvent; + PlatformWheelPhase m_phase; +}; +} // namespace Test + +SPECIALIZE_TYPE_TRAITS_BEGIN(Test::HandleWheelEvent) + static bool isType(const NondeterministicInputBase& input) { return input.type() == InputTraits<Test::HandleWheelEvent>::type(); } +SPECIALIZE_TYPE_TRAITS_END() + +#define TEST_REPLAY_INPUT_NAMES_FOR_EACH(macro) \ + macro(HandleWheelEvent) \ + \ +// end of TEST_REPLAY_INPUT_NAMES_FOR_EACH + +#endif // ENABLE(WEB_REPLAY) diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp new file mode 100644 index 000000000..a19644ffa --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp @@ -0,0 +1,144 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-enums-with-same-base-name.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#include "config.h" +#include "generate-enums-with-same-base-name.json-TestReplayInputs.h" + +#if ENABLE(WEB_REPLAY) +#include "InternalNamespaceImplIncludeDummy.h" +#include <platform/ExternalNamespaceImplIncludeDummy.h> + +namespace Test { +FormCombo::FormCombo(PlatformEvent1::Type eventType1, PlatformEvent2::Type eventType2, FormData1::Type formType1, FormData2::Type formType2) + : NondeterministicInput<FormCombo>() + , m_eventType1(eventType1) + , m_eventType2(eventType2) + , m_formType1(formType1) + , m_formType2(formType2) +{ +} + +FormCombo::~FormCombo() +{ +} +} // namespace Test + +namespace JSC { +const String& InputTraits<Test::FormCombo>::type() +{ + static NeverDestroyed<const String> type(ASCIILiteral("FormCombo")); + return type; +} + +void InputTraits<Test::FormCombo>::encode(EncodedValue& encodedValue, const Test::FormCombo& input) +{ + encodedValue.put<PlatformEvent1::Type>(ASCIILiteral("eventType1"), input.eventType1()); + encodedValue.put<PlatformEvent2::Type>(ASCIILiteral("eventType2"), input.eventType2()); + encodedValue.put<Test::FormData1::Type>(ASCIILiteral("formType1"), input.formType1()); + encodedValue.put<Test::FormData2::Type>(ASCIILiteral("formType2"), input.formType2()); +} + +bool InputTraits<Test::FormCombo>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::FormCombo>& input) +{ + PlatformEvent1::Type eventType1; + if (!encodedValue.get<PlatformEvent1::Type>(ASCIILiteral("eventType1"), eventType1)) + return false; + + PlatformEvent2::Type eventType2; + if (!encodedValue.get<PlatformEvent2::Type>(ASCIILiteral("eventType2"), eventType2)) + return false; + + Test::FormData1::Type formType1; + if (!encodedValue.get<Test::FormData1::Type>(ASCIILiteral("formType1"), formType1)) + return false; + + Test::FormData2::Type formType2; + if (!encodedValue.get<Test::FormData2::Type>(ASCIILiteral("formType2"), formType2)) + return false; + + input = std::make_unique<Test::FormCombo>(eventType1, eventType2, formType1, formType2); + return true; +} +EncodedValue EncodingTraits<Test::FormData1::Type>::encodeValue(const Test::FormData1::Type& enumValue) +{ + EncodedValue encodedValue = EncodedValue::createArray(); + if (enumValue & Test::FormData1::Text) { + encodedValue.append<String>(ASCIILiteral("Text")); + if (enumValue == Test::FormData1::Text) + return encodedValue; + } + if (enumValue & Test::FormData1::Blob) { + encodedValue.append<String>(ASCIILiteral("Blob")); + if (enumValue == Test::FormData1::Blob) + return encodedValue; + } + return encodedValue; +} + +bool EncodingTraits<Test::FormData1::Type>::decodeValue(EncodedValue& encodedValue, Test::FormData1::Type& enumValue) +{ + Vector<String> enumStrings; + if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings)) + return false; + + for (const String& enumString : enumStrings) { + if (enumString == "Text") + enumValue = static_cast<Test::FormData1::Type>(enumValue | Test::FormData1::Text); + else if (enumString == "Blob") + enumValue = static_cast<Test::FormData1::Type>(enumValue | Test::FormData1::Blob); + } + + return true; +} + +EncodedValue EncodingTraits<Test::FormData2::Type>::encodeValue(const Test::FormData2::Type& enumValue) +{ + switch (enumValue) { + case Test::FormData2::Type::Text: return EncodedValue::createString("Text"); + case Test::FormData2::Type::Blob: return EncodedValue::createString("Blob"); + default: ASSERT_NOT_REACHED(); return EncodedValue::createString("Error!"); + } +} + +bool EncodingTraits<Test::FormData2::Type>::decodeValue(EncodedValue& encodedValue, Test::FormData2::Type& enumValue) +{ + String enumString = encodedValue.convertTo<String>(); + if (enumString == "Text") { + enumValue = Test::FormData2::Type::Text; + return true; + } + if (enumString == "Blob") { + enumValue = Test::FormData2::Type::Blob; + return true; + } + return false; +} +} // namespace JSC + +#endif // ENABLE(WEB_REPLAY) diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.h b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.h new file mode 100644 index 000000000..86d43be47 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.h @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-enums-with-same-base-name.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#pragma once + +#if ENABLE(WEB_REPLAY) +#include "FormData1.h" +#include "FormData2.h" +#include "InternalNamespaceHeaderIncludeDummy.h" +#include <platform/ExternalNamespaceHeaderIncludeDummy.h> +#include <replay/PlatformEvent.h> + + + +namespace Test { +class FormCombo; +} // namespace Test + +namespace JSC { +template<> struct TEST_EXPORT_MACRO InputTraits<Test::FormCombo> { + static InputQueue queue() { return InputQueue::ScriptMemoizedData; } + static const String& type(); + + static void encode(JSC::EncodedValue&, const Test::FormCombo&); + static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::FormCombo>&); +}; +template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::FormData1::Type> { + typedef Test::FormData1::Type DecodedType; + + static EncodedValue encodeValue(const Test::FormData1::Type& value); + static bool decodeValue(EncodedValue&, Test::FormData1::Type& value); +}; + +template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::FormData2::Type> { + typedef Test::FormData2::Type DecodedType; + + static EncodedValue encodeValue(const Test::FormData2::Type& value); + static bool decodeValue(EncodedValue&, Test::FormData2::Type& value); +}; +} // namespace JSC + +namespace Test { +class FormCombo : public NondeterministicInput<FormCombo> { +public: + TEST_EXPORT_MACRO FormCombo(PlatformEvent1::Type eventType1, PlatformEvent2::Type eventType2, FormData1::Type formType1, FormData2::Type formType2); + virtual ~FormCombo(); + + PlatformEvent1::Type eventType1() const { return m_eventType1; } + PlatformEvent2::Type eventType2() const { return m_eventType2; } + FormData1::Type formType1() const { return m_formType1; } + FormData2::Type formType2() const { return m_formType2; } +private: + PlatformEvent1::Type m_eventType1; + PlatformEvent2::Type m_eventType2; + FormData1::Type m_formType1; + FormData2::Type m_formType2; +}; +} // namespace Test + +SPECIALIZE_TYPE_TRAITS_BEGIN(Test::FormCombo) + static bool isType(const NondeterministicInputBase& input) { return input.type() == InputTraits<Test::FormCombo>::type(); } +SPECIALIZE_TYPE_TRAITS_END() + +#define TEST_REPLAY_INPUT_NAMES_FOR_EACH(macro) \ + macro(FormCombo) \ + \ +// end of TEST_REPLAY_INPUT_NAMES_FOR_EACH + +#endif // ENABLE(WEB_REPLAY) diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-event-loop-shape-types.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-event-loop-shape-types.json-error new file mode 100644 index 000000000..90a4176bf --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-event-loop-shape-types.json-error @@ -0,0 +1 @@ +ERROR: Unknown type mode: MAP diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp new file mode 100644 index 000000000..9cbb7af33 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-input-with-guard.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#include "config.h" +#include "generate-input-with-guard.json-TestReplayInputs.h" + +#if ENABLE(WEB_REPLAY) +#include "InternalNamespaceImplIncludeDummy.h" +#include <platform/ExternalNamespaceImplIncludeDummy.h> + +namespace Test { +#if ENABLE(DUMMY_FEATURE) +GetCurrentTime::GetCurrentTime(double currentTime) + : NondeterministicInput<GetCurrentTime>() + , m_currentTime(currentTime) +{ +} + +GetCurrentTime::~GetCurrentTime() +{ +} +#endif // ENABLE(DUMMY_FEATURE) + +SetRandomSeed::SetRandomSeed(uint64_t randomSeed) + : NondeterministicInput<SetRandomSeed>() + , m_randomSeed(randomSeed) +{ +} + +SetRandomSeed::~SetRandomSeed() +{ +} +} // namespace Test + +namespace JSC { +#if ENABLE(DUMMY_FEATURE) +const String& InputTraits<Test::GetCurrentTime>::type() +{ + static NeverDestroyed<const String> type(ASCIILiteral("GetCurrentTime")); + return type; +} + +void InputTraits<Test::GetCurrentTime>::encode(EncodedValue& encodedValue, const Test::GetCurrentTime& input) +{ + encodedValue.put<double>(ASCIILiteral("currentTime"), input.currentTime()); +} + +bool InputTraits<Test::GetCurrentTime>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::GetCurrentTime>& input) +{ + double currentTime; + if (!encodedValue.get<double>(ASCIILiteral("currentTime"), currentTime)) + return false; + + input = std::make_unique<Test::GetCurrentTime>(currentTime); + return true; +} +#endif // ENABLE(DUMMY_FEATURE) + +const String& InputTraits<Test::SetRandomSeed>::type() +{ + static NeverDestroyed<const String> type(ASCIILiteral("SetRandomSeed")); + return type; +} + +void InputTraits<Test::SetRandomSeed>::encode(EncodedValue& encodedValue, const Test::SetRandomSeed& input) +{ + encodedValue.put<uint64_t>(ASCIILiteral("randomSeed"), input.randomSeed()); +} + +bool InputTraits<Test::SetRandomSeed>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::SetRandomSeed>& input) +{ + uint64_t randomSeed; + if (!encodedValue.get<uint64_t>(ASCIILiteral("randomSeed"), randomSeed)) + return false; + + input = std::make_unique<Test::SetRandomSeed>(randomSeed); + return true; +} + +} // namespace JSC + +#endif // ENABLE(WEB_REPLAY) diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h new file mode 100644 index 000000000..6d9346ef5 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-input-with-guard.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#pragma once + +#if ENABLE(WEB_REPLAY) +#include "InternalNamespaceHeaderIncludeDummy.h" +#include <platform/ExternalNamespaceHeaderIncludeDummy.h> + + + +namespace Test { +#if ENABLE(DUMMY_FEATURE) +class GetCurrentTime; +#endif // ENABLE(DUMMY_FEATURE) +class SetRandomSeed; +} // namespace Test + +namespace JSC { +#if ENABLE(DUMMY_FEATURE) +template<> struct TEST_EXPORT_MACRO InputTraits<Test::GetCurrentTime> { + static InputQueue queue() { return InputQueue::ScriptMemoizedData; } + static const String& type(); + + static void encode(JSC::EncodedValue&, const Test::GetCurrentTime&); + static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::GetCurrentTime>&); +}; +#endif // ENABLE(DUMMY_FEATURE) + +template<> struct TEST_EXPORT_MACRO InputTraits<Test::SetRandomSeed> { + static InputQueue queue() { return InputQueue::ScriptMemoizedData; } + static const String& type(); + + static void encode(JSC::EncodedValue&, const Test::SetRandomSeed&); + static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::SetRandomSeed>&); +}; + +} // namespace JSC + +namespace Test { +#if ENABLE(DUMMY_FEATURE) +class GetCurrentTime : public NondeterministicInput<GetCurrentTime> { +public: + TEST_EXPORT_MACRO GetCurrentTime(double currentTime); + virtual ~GetCurrentTime(); + + double currentTime() const { return m_currentTime; } +private: + double m_currentTime; +}; +#endif // ENABLE(DUMMY_FEATURE) + +class SetRandomSeed : public NondeterministicInput<SetRandomSeed> { +public: + TEST_EXPORT_MACRO SetRandomSeed(uint64_t randomSeed); + virtual ~SetRandomSeed(); + + uint64_t randomSeed() const { return m_randomSeed; } +private: + uint64_t m_randomSeed; +}; +} // namespace Test + +#if ENABLE(DUMMY_FEATURE) +SPECIALIZE_TYPE_TRAITS_BEGIN(Test::GetCurrentTime) + static bool isType(const NondeterministicInputBase& input) { return input.type() == InputTraits<Test::GetCurrentTime>::type(); } +SPECIALIZE_TYPE_TRAITS_END() +#endif // ENABLE(DUMMY_FEATURE) + +SPECIALIZE_TYPE_TRAITS_BEGIN(Test::SetRandomSeed) + static bool isType(const NondeterministicInputBase& input) { return input.type() == InputTraits<Test::SetRandomSeed>::type(); } +SPECIALIZE_TYPE_TRAITS_END() + +#define TEST_REPLAY_INPUT_NAMES_FOR_EACH(macro) \ + macro(GetCurrentTime) \ + macro(SetRandomSeed) \ + \ +// end of TEST_REPLAY_INPUT_NAMES_FOR_EACH + +#endif // ENABLE(WEB_REPLAY) diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp new file mode 100644 index 000000000..f2f962a19 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-input-with-vector-members.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#include "config.h" +#include "generate-input-with-vector-members.json-TestReplayInputs.h" + +#if ENABLE(WEB_REPLAY) +#include "InternalNamespaceImplIncludeDummy.h" +#include <platform/ExternalNamespaceImplIncludeDummy.h> +#include <things/JSThing.h> +#include <things/WebThing.h> + +namespace Test { +ArrayOfThings::ArrayOfThings(Vector<double>& doubles, Vector<JSThing>& jsthings, Vector<WebThing>& webthings) + : NondeterministicInput<ArrayOfThings>() + , m_doubles(doubles) + , m_jsthings(jsthings) + , m_webthings(webthings) +{ +} + +ArrayOfThings::~ArrayOfThings() +{ +} + +SavedHistory::SavedHistory(Vector<RefPtr<HistoryItem>>& entries) + : NondeterministicInput<SavedHistory>() + , m_entries(entries) +{ +} + +SavedHistory::~SavedHistory() +{ +} +} // namespace Test + +namespace JSC { +const String& InputTraits<Test::ArrayOfThings>::type() +{ + static NeverDestroyed<const String> type(ASCIILiteral("ArrayOfThings")); + return type; +} + +void InputTraits<Test::ArrayOfThings>::encode(EncodedValue& encodedValue, const Test::ArrayOfThings& input) +{ + encodedValue.put<Vector<double>>(ASCIILiteral("doubles"), input.doubles()); + encodedValue.put<Vector<JSThing>>(ASCIILiteral("jsthings"), input.jsthings()); + encodedValue.put<Vector<WebCore::WebThing>>(ASCIILiteral("webthings"), input.webthings()); +} + +bool InputTraits<Test::ArrayOfThings>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::ArrayOfThings>& input) +{ + Vector<double> doubles; + if (!encodedValue.get<Vector<double>>(ASCIILiteral("doubles"), doubles)) + return false; + + Vector<JSThing> jsthings; + if (!encodedValue.get<Vector<JSThing>>(ASCIILiteral("jsthings"), jsthings)) + return false; + + Vector<WebCore::WebThing> webthings; + if (!encodedValue.get<Vector<WebCore::WebThing>>(ASCIILiteral("webthings"), webthings)) + return false; + + input = std::make_unique<Test::ArrayOfThings>(doubles, jsthings, webthings); + return true; +} + +const String& InputTraits<Test::SavedHistory>::type() +{ + static NeverDestroyed<const String> type(ASCIILiteral("SavedHistory")); + return type; +} + +void InputTraits<Test::SavedHistory>::encode(EncodedValue& encodedValue, const Test::SavedHistory& input) +{ + encodedValue.put<Vector<WebCore::HistoryItem>>(ASCIILiteral("entries"), input.entries()); +} + +bool InputTraits<Test::SavedHistory>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::SavedHistory>& input) +{ + Vector<RefPtr<WebCore::HistoryItem>> entries; + if (!encodedValue.get<Vector<WebCore::HistoryItem>>(ASCIILiteral("entries"), entries)) + return false; + + input = std::make_unique<Test::SavedHistory>(entries); + return true; +} + +} // namespace JSC + +#endif // ENABLE(WEB_REPLAY) diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h new file mode 100644 index 000000000..9f184faac --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-input-with-vector-members.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#pragma once + +#if ENABLE(WEB_REPLAY) +#include "InternalNamespaceHeaderIncludeDummy.h" +#include <history/HistoryItem.h> +#include <platform/ExternalNamespaceHeaderIncludeDummy.h> + +namespace WebCore { +class HistoryItem; +} + + +namespace Test { +class ArrayOfThings; +class SavedHistory; +} // namespace Test + +namespace JSC { +template<> struct TEST_EXPORT_MACRO InputTraits<Test::ArrayOfThings> { + static InputQueue queue() { return InputQueue::ScriptMemoizedData; } + static const String& type(); + + static void encode(JSC::EncodedValue&, const Test::ArrayOfThings&); + static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::ArrayOfThings>&); +}; + +template<> struct TEST_EXPORT_MACRO InputTraits<Test::SavedHistory> { + static InputQueue queue() { return InputQueue::ScriptMemoizedData; } + static const String& type(); + + static void encode(JSC::EncodedValue&, const Test::SavedHistory&); + static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::SavedHistory>&); +}; + +} // namespace JSC + +namespace Test { +class ArrayOfThings : public NondeterministicInput<ArrayOfThings> { +public: + TEST_EXPORT_MACRO ArrayOfThings(Vector<double>& doubles, Vector<JSThing>& jsthings, Vector<WebThing>& webthings); + virtual ~ArrayOfThings(); + + const Vector<double>& doubles() const { return m_doubles; } + const Vector<JSThing>& jsthings() const { return m_jsthings; } + const Vector<WebThing>& webthings() const { return m_webthings; } +private: + Vector<double> m_doubles; + Vector<JSThing> m_jsthings; + Vector<WebThing> m_webthings; +}; + +class SavedHistory : public NondeterministicInput<SavedHistory> { +public: + TEST_EXPORT_MACRO SavedHistory(Vector<RefPtr<HistoryItem>>& entries); + virtual ~SavedHistory(); + + const Vector<RefPtr<HistoryItem>>& entries() const { return m_entries; } +private: + Vector<RefPtr<HistoryItem>> m_entries; +}; +} // namespace Test + +SPECIALIZE_TYPE_TRAITS_BEGIN(Test::ArrayOfThings) + static bool isType(const NondeterministicInputBase& input) { return input.type() == InputTraits<Test::ArrayOfThings>::type(); } +SPECIALIZE_TYPE_TRAITS_END() + +SPECIALIZE_TYPE_TRAITS_BEGIN(Test::SavedHistory) + static bool isType(const NondeterministicInputBase& input) { return input.type() == InputTraits<Test::SavedHistory>::type(); } +SPECIALIZE_TYPE_TRAITS_END() + +#define TEST_REPLAY_INPUT_NAMES_FOR_EACH(macro) \ + macro(ArrayOfThings) \ + macro(SavedHistory) \ + \ +// end of TEST_REPLAY_INPUT_NAMES_FOR_EACH + +#endif // ENABLE(WEB_REPLAY) diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.cpp b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.cpp new file mode 100644 index 000000000..821f4d0fc --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.cpp @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-inputs-with-flags.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#include "config.h" +#include "generate-inputs-with-flags.json-TestReplayInputs.h" + +#if ENABLE(WEB_REPLAY) +#include "InternalNamespaceImplIncludeDummy.h" +#include <platform/ExternalNamespaceImplIncludeDummy.h> + +namespace Test { +ScalarInput1::ScalarInput1(ScalarType data) + : NondeterministicInput<ScalarInput1>() + , m_data(data) +{ +} + +ScalarInput1::~ScalarInput1() +{ +} + +ScalarInput2::ScalarInput2(ScalarType data) + : NondeterministicInput<ScalarInput2>() + , m_data(data) +{ +} + +ScalarInput2::~ScalarInput2() +{ +} +} // namespace Test + +namespace JSC { +const String& InputTraits<Test::ScalarInput1>::type() +{ + static NeverDestroyed<const String> type(ASCIILiteral("ScalarInput1")); + return type; +} + +void InputTraits<Test::ScalarInput1>::encode(EncodedValue& encodedValue, const Test::ScalarInput1& input) +{ + encodedValue.put<ScalarType>(ASCIILiteral("data"), input.data()); +} + +bool InputTraits<Test::ScalarInput1>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::ScalarInput1>& input) +{ + ScalarType data; + if (!encodedValue.get<ScalarType>(ASCIILiteral("data"), data)) + return false; + + input = std::make_unique<Test::ScalarInput1>(data); + return true; +} + +const String& InputTraits<Test::ScalarInput2>::type() +{ + static NeverDestroyed<const String> type(ASCIILiteral("ScalarInput2")); + return type; +} + +void InputTraits<Test::ScalarInput2>::encode(EncodedValue& encodedValue, const Test::ScalarInput2& input) +{ + encodedValue.put<ScalarType>(ASCIILiteral("data"), input.data()); +} + +bool InputTraits<Test::ScalarInput2>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::ScalarInput2>& input) +{ + ScalarType data; + if (!encodedValue.get<ScalarType>(ASCIILiteral("data"), data)) + return false; + + input = std::make_unique<Test::ScalarInput2>(data); + return true; +} + +} // namespace JSC + +#endif // ENABLE(WEB_REPLAY) diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h new file mode 100644 index 000000000..761ea900e --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-inputs-with-flags.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#pragma once + +#if ENABLE(WEB_REPLAY) +#include "InternalNamespaceHeaderIncludeDummy.h" +#include <platform/ExternalNamespaceHeaderIncludeDummy.h> + + + +namespace Test { +class ScalarInput1; +class ScalarInput2; +} // namespace Test + +namespace JSC { +template<> struct TEST_EXPORT_MACRO InputTraits<Test::ScalarInput1> { + static InputQueue queue() { return InputQueue::ScriptMemoizedData; } + static const String& type(); + + static void encode(JSC::EncodedValue&, const Test::ScalarInput1&); + static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::ScalarInput1>&); +}; + +template<> struct TEST_EXPORT_MACRO InputTraits<Test::ScalarInput2> { + static InputQueue queue() { return InputQueue::ScriptMemoizedData; } + static const String& type(); + + static void encode(JSC::EncodedValue&, const Test::ScalarInput2&); + static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::ScalarInput2>&); +}; + +} // namespace JSC + +namespace Test { +class ScalarInput1 : public NondeterministicInput<ScalarInput1> { +public: + TEST_EXPORT_MACRO ScalarInput1(ScalarType data); + virtual ~ScalarInput1(); + + ScalarType data() const { return m_data; } +private: + ScalarType m_data; +}; + +class ScalarInput2 : public NondeterministicInput<ScalarInput2> { +public: + TEST_EXPORT_MACRO ScalarInput2(ScalarType data); + virtual ~ScalarInput2(); + + ScalarType data() const { return m_data; } +private: + ScalarType m_data; +}; +} // namespace Test + +SPECIALIZE_TYPE_TRAITS_BEGIN(Test::ScalarInput1) + static bool isType(const NondeterministicInputBase& input) { return input.type() == InputTraits<Test::ScalarInput1>::type(); } +SPECIALIZE_TYPE_TRAITS_END() + +SPECIALIZE_TYPE_TRAITS_BEGIN(Test::ScalarInput2) + static bool isType(const NondeterministicInputBase& input) { return input.type() == InputTraits<Test::ScalarInput2>::type(); } +SPECIALIZE_TYPE_TRAITS_END() + +#define TEST_REPLAY_INPUT_NAMES_FOR_EACH(macro) \ + macro(ScalarInput1) \ + macro(ScalarInput2) \ + \ +// end of TEST_REPLAY_INPUT_NAMES_FOR_EACH + +#endif // ENABLE(WEB_REPLAY) diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp new file mode 100644 index 000000000..b67a9e921 --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-memoized-type-modes.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#include "config.h" +#include "generate-memoized-type-modes.json-TestReplayInputs.h" + +#if ENABLE(WEB_REPLAY) +#include "InternalNamespaceImplIncludeDummy.h" +#include <platform/ExternalNamespaceImplIncludeDummy.h> + +namespace Test { +ScalarInput::ScalarInput(ScalarType data) + : NondeterministicInput<ScalarInput>() + , m_data(data) +{ +} + +ScalarInput::~ScalarInput() +{ +} + +MapInput::MapInput(std::unique_ptr<MapType> data) + : NondeterministicInput<MapInput>() + , m_data(WTFMove(data)) +{ +} + +MapInput::~MapInput() +{ +} +} // namespace Test + +namespace JSC { +const String& InputTraits<Test::ScalarInput>::type() +{ + static NeverDestroyed<const String> type(ASCIILiteral("ScalarInput")); + return type; +} + +void InputTraits<Test::ScalarInput>::encode(EncodedValue& encodedValue, const Test::ScalarInput& input) +{ + encodedValue.put<ScalarType>(ASCIILiteral("data"), input.data()); +} + +bool InputTraits<Test::ScalarInput>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::ScalarInput>& input) +{ + ScalarType data; + if (!encodedValue.get<ScalarType>(ASCIILiteral("data"), data)) + return false; + + input = std::make_unique<Test::ScalarInput>(data); + return true; +} + +const String& InputTraits<Test::MapInput>::type() +{ + static NeverDestroyed<const String> type(ASCIILiteral("MapInput")); + return type; +} + +void InputTraits<Test::MapInput>::encode(EncodedValue& encodedValue, const Test::MapInput& input) +{ + encodedValue.put<MapType>(ASCIILiteral("data"), input.data()); +} + +bool InputTraits<Test::MapInput>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::MapInput>& input) +{ + std::unique_ptr<MapType> data; + if (!encodedValue.get<MapType>(ASCIILiteral("data"), data)) + return false; + + input = std::make_unique<Test::MapInput>(WTFMove(data)); + return true; +} + +} // namespace JSC + +#endif // ENABLE(WEB_REPLAY) diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h new file mode 100644 index 000000000..ddac7070d --- /dev/null +++ b/Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2014 Apple Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * HOLDER OR 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 generate-memoized-type-modes.json +// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py + +#pragma once + +#if ENABLE(WEB_REPLAY) +#include "InternalNamespaceHeaderIncludeDummy.h" +#include <platform/ExternalNamespaceHeaderIncludeDummy.h> + + + +namespace Test { +class ScalarInput; +class MapInput; +} // namespace Test + +namespace JSC { +template<> struct TEST_EXPORT_MACRO InputTraits<Test::ScalarInput> { + static InputQueue queue() { return InputQueue::ScriptMemoizedData; } + static const String& type(); + + static void encode(JSC::EncodedValue&, const Test::ScalarInput&); + static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::ScalarInput>&); +}; + +template<> struct TEST_EXPORT_MACRO InputTraits<Test::MapInput> { + static InputQueue queue() { return InputQueue::ScriptMemoizedData; } + static const String& type(); + + static void encode(JSC::EncodedValue&, const Test::MapInput&); + static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::MapInput>&); +}; + +} // namespace JSC + +namespace Test { +class ScalarInput : public NondeterministicInput<ScalarInput> { +public: + TEST_EXPORT_MACRO ScalarInput(ScalarType data); + virtual ~ScalarInput(); + + ScalarType data() const { return m_data; } +private: + ScalarType m_data; +}; + +class MapInput : public NondeterministicInput<MapInput> { +public: + TEST_EXPORT_MACRO MapInput(std::unique_ptr<MapType> data); + virtual ~MapInput(); + + const MapType& data() const { return *m_data; } +private: + std::unique_ptr<MapType> m_data; +}; +} // namespace Test + +SPECIALIZE_TYPE_TRAITS_BEGIN(Test::ScalarInput) + static bool isType(const NondeterministicInputBase& input) { return input.type() == InputTraits<Test::ScalarInput>::type(); } +SPECIALIZE_TYPE_TRAITS_END() + +SPECIALIZE_TYPE_TRAITS_BEGIN(Test::MapInput) + static bool isType(const NondeterministicInputBase& input) { return input.type() == InputTraits<Test::MapInput>::type(); } +SPECIALIZE_TYPE_TRAITS_END() + +#define TEST_REPLAY_INPUT_NAMES_FOR_EACH(macro) \ + macro(ScalarInput) \ + macro(MapInput) \ + \ +// end of TEST_REPLAY_INPUT_NAMES_FOR_EACH + +#endif // ENABLE(WEB_REPLAY) |