|
Lines 32-40
a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp_sec1
|
| 32 |
|
32 |
|
| 33 |
#if ENABLE(WEB_REPLAY) |
33 |
#if ENABLE(WEB_REPLAY) |
| 34 |
#include "InternalNamespaceImplIncludeDummy.h" |
34 |
#include "InternalNamespaceImplIncludeDummy.h" |
|
|
35 |
#include "NondeterministicInput.h" |
| 36 |
#include "PlatformMouseEvent.h" |
| 35 |
#include <platform/ExternalNamespaceImplIncludeDummy.h> |
37 |
#include <platform/ExternalNamespaceImplIncludeDummy.h> |
| 36 |
#include <platform/PlatformMouseEvent.h> |
|
|
| 37 |
#include <replay/NondeterministicInput.h> |
| 38 |
|
38 |
|
| 39 |
namespace Test { |
39 |
namespace Test { |
| 40 |
SavedMouseButton::SavedMouseButton(MouseButton button) |
40 |
SavedMouseButton::SavedMouseButton(MouseButton button) |
|
Lines 57-129
const String& InputTraits<Test::SavedMouseButton>::type()
a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp_sec2
|
| 57 |
|
57 |
|
| 58 |
void InputTraits<Test::SavedMouseButton>::encode(EncodedValue& encodedValue, const Test::SavedMouseButton& input) |
58 |
void InputTraits<Test::SavedMouseButton>::encode(EncodedValue& encodedValue, const Test::SavedMouseButton& input) |
| 59 |
{ |
59 |
{ |
| 60 |
encodedValue.put<WebCore::MouseButton>(ASCIILiteral("button"), input.button()); |
60 |
encodedValue.put<Test::MouseButton>(ASCIILiteral("button"), input.button()); |
| 61 |
} |
61 |
} |
| 62 |
|
62 |
|
| 63 |
bool InputTraits<Test::SavedMouseButton>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::SavedMouseButton>& input) |
63 |
bool InputTraits<Test::SavedMouseButton>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::SavedMouseButton>& input) |
| 64 |
{ |
64 |
{ |
| 65 |
WebCore::MouseButton button; |
65 |
Test::MouseButton button; |
| 66 |
if (!encodedValue.get<WebCore::MouseButton>(ASCIILiteral("button"), button)) |
66 |
if (!encodedValue.get<Test::MouseButton>(ASCIILiteral("button"), button)) |
| 67 |
return false; |
67 |
return false; |
| 68 |
|
68 |
|
| 69 |
input = std::make_unique<Test::SavedMouseButton>(button); |
69 |
input = std::make_unique<Test::SavedMouseButton>(button); |
| 70 |
return true; |
70 |
return true; |
| 71 |
} |
71 |
} |
| 72 |
EncodedValue EncodingTraits<InputQueue>::encodeValue(const InputQueue& enumValue) |
72 |
EncodedValue EncodingTraits<Test::InputQueue>::encodeValue(const Test::InputQueue& enumValue) |
| 73 |
{ |
73 |
{ |
| 74 |
switch (enumValue) { |
74 |
switch (enumValue) { |
| 75 |
case InputQueue::EventLoopInput: return EncodedValue::createString("EventLoopInput"); |
75 |
case Test::InputQueue::EventLoopInput: return EncodedValue::createString("EventLoopInput"); |
| 76 |
case InputQueue::LoaderMemoizedData: return EncodedValue::createString("LoaderMemoizedData"); |
76 |
case Test::InputQueue::LoaderMemoizedData: return EncodedValue::createString("LoaderMemoizedData"); |
| 77 |
case InputQueue::ScriptMemoizedData: return EncodedValue::createString("ScriptMemoizedData"); |
77 |
case Test::InputQueue::ScriptMemoizedData: return EncodedValue::createString("ScriptMemoizedData"); |
| 78 |
default: ASSERT_NOT_REACHED(); return EncodedValue::createString("Error!"); |
78 |
default: ASSERT_NOT_REACHED(); return EncodedValue::createString("Error!"); |
| 79 |
} |
79 |
} |
| 80 |
} |
80 |
} |
| 81 |
|
81 |
|
| 82 |
bool EncodingTraits<InputQueue>::decodeValue(EncodedValue& encodedValue, InputQueue& enumValue) |
82 |
bool EncodingTraits<Test::InputQueue>::decodeValue(EncodedValue& encodedValue, Test::InputQueue& enumValue) |
| 83 |
{ |
83 |
{ |
| 84 |
String enumString = encodedValue.convertTo<String>(); |
84 |
String enumString = encodedValue.convertTo<String>(); |
| 85 |
if (enumString == "EventLoopInput") { |
85 |
if (enumString == "EventLoopInput") { |
| 86 |
enumValue = InputQueue::EventLoopInput; |
86 |
enumValue = Test::InputQueue::EventLoopInput; |
| 87 |
return true; |
87 |
return true; |
| 88 |
} |
88 |
} |
| 89 |
if (enumString == "LoaderMemoizedData") { |
89 |
if (enumString == "LoaderMemoizedData") { |
| 90 |
enumValue = InputQueue::LoaderMemoizedData; |
90 |
enumValue = Test::InputQueue::LoaderMemoizedData; |
| 91 |
return true; |
91 |
return true; |
| 92 |
} |
92 |
} |
| 93 |
if (enumString == "ScriptMemoizedData") { |
93 |
if (enumString == "ScriptMemoizedData") { |
| 94 |
enumValue = InputQueue::ScriptMemoizedData; |
94 |
enumValue = Test::InputQueue::ScriptMemoizedData; |
| 95 |
return true; |
95 |
return true; |
| 96 |
} |
96 |
} |
| 97 |
return false; |
97 |
return false; |
| 98 |
} |
98 |
} |
| 99 |
|
99 |
|
| 100 |
EncodedValue EncodingTraits<WebCore::MouseButton>::encodeValue(const WebCore::MouseButton& enumValue) |
100 |
EncodedValue EncodingTraits<Test::MouseButton>::encodeValue(const Test::MouseButton& enumValue) |
| 101 |
{ |
101 |
{ |
| 102 |
EncodedValue encodedValue = EncodedValue::createArray(); |
102 |
EncodedValue encodedValue = EncodedValue::createArray(); |
| 103 |
if (enumValue & WebCore::NoButton) { |
103 |
if (enumValue & Test::NoButton) { |
| 104 |
encodedValue.append<String>(ASCIILiteral("NoButton")); |
104 |
encodedValue.append<String>(ASCIILiteral("NoButton")); |
| 105 |
if (enumValue == WebCore::NoButton) |
105 |
if (enumValue == Test::NoButton) |
| 106 |
return encodedValue; |
106 |
return encodedValue; |
| 107 |
} |
107 |
} |
| 108 |
if (enumValue & WebCore::LeftButton) { |
108 |
if (enumValue & Test::LeftButton) { |
| 109 |
encodedValue.append<String>(ASCIILiteral("LeftButton")); |
109 |
encodedValue.append<String>(ASCIILiteral("LeftButton")); |
| 110 |
if (enumValue == WebCore::LeftButton) |
110 |
if (enumValue == Test::LeftButton) |
| 111 |
return encodedValue; |
111 |
return encodedValue; |
| 112 |
} |
112 |
} |
| 113 |
if (enumValue & WebCore::MiddleButton) { |
113 |
if (enumValue & Test::MiddleButton) { |
| 114 |
encodedValue.append<String>(ASCIILiteral("MiddleButton")); |
114 |
encodedValue.append<String>(ASCIILiteral("MiddleButton")); |
| 115 |
if (enumValue == WebCore::MiddleButton) |
115 |
if (enumValue == Test::MiddleButton) |
| 116 |
return encodedValue; |
116 |
return encodedValue; |
| 117 |
} |
117 |
} |
| 118 |
if (enumValue & WebCore::RightButton) { |
118 |
if (enumValue & Test::RightButton) { |
| 119 |
encodedValue.append<String>(ASCIILiteral("RightButton")); |
119 |
encodedValue.append<String>(ASCIILiteral("RightButton")); |
| 120 |
if (enumValue == WebCore::RightButton) |
120 |
if (enumValue == Test::RightButton) |
| 121 |
return encodedValue; |
121 |
return encodedValue; |
| 122 |
} |
122 |
} |
| 123 |
return encodedValue; |
123 |
return encodedValue; |
| 124 |
} |
124 |
} |
| 125 |
|
125 |
|
| 126 |
bool EncodingTraits<WebCore::MouseButton>::decodeValue(EncodedValue& encodedValue, WebCore::MouseButton& enumValue) |
126 |
bool EncodingTraits<Test::MouseButton>::decodeValue(EncodedValue& encodedValue, Test::MouseButton& enumValue) |
| 127 |
{ |
127 |
{ |
| 128 |
Vector<String> enumStrings; |
128 |
Vector<String> enumStrings; |
| 129 |
if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings)) |
129 |
if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings)) |
|
Lines 131-175
bool EncodingTraits<WebCore::MouseButton>::decodeValue(EncodedValue& encodedValu
a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp_sec3
|
| 131 |
|
131 |
|
| 132 |
for (const String& enumString : enumStrings) { |
132 |
for (const String& enumString : enumStrings) { |
| 133 |
if (enumString == "NoButton") |
133 |
if (enumString == "NoButton") |
| 134 |
enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::NoButton); |
134 |
enumValue = static_cast<Test::MouseButton>(enumValue | Test::NoButton); |
| 135 |
else if (enumString == "LeftButton") |
135 |
else if (enumString == "LeftButton") |
| 136 |
enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::LeftButton); |
136 |
enumValue = static_cast<Test::MouseButton>(enumValue | Test::LeftButton); |
| 137 |
else if (enumString == "MiddleButton") |
137 |
else if (enumString == "MiddleButton") |
| 138 |
enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::MiddleButton); |
138 |
enumValue = static_cast<Test::MouseButton>(enumValue | Test::MiddleButton); |
| 139 |
else if (enumString == "RightButton") |
139 |
else if (enumString == "RightButton") |
| 140 |
enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::RightButton); |
140 |
enumValue = static_cast<Test::MouseButton>(enumValue | Test::RightButton); |
| 141 |
} |
141 |
} |
| 142 |
|
142 |
|
| 143 |
return true; |
143 |
return true; |
| 144 |
} |
144 |
} |
| 145 |
|
145 |
|
| 146 |
EncodedValue EncodingTraits<WebCore::PlatformEvent::Type>::encodeValue(const WebCore::PlatformEvent::Type& enumValue) |
146 |
EncodedValue EncodingTraits<Test::PlatformEvent::Type>::encodeValue(const Test::PlatformEvent::Type& enumValue) |
| 147 |
{ |
147 |
{ |
| 148 |
EncodedValue encodedValue = EncodedValue::createArray(); |
148 |
EncodedValue encodedValue = EncodedValue::createArray(); |
| 149 |
if (enumValue & WebCore::PlatformEvent::Mouse) { |
149 |
if (enumValue & Test::PlatformEvent::Mouse) { |
| 150 |
encodedValue.append<String>(ASCIILiteral("Mouse")); |
150 |
encodedValue.append<String>(ASCIILiteral("Mouse")); |
| 151 |
if (enumValue == WebCore::PlatformEvent::Mouse) |
151 |
if (enumValue == Test::PlatformEvent::Mouse) |
| 152 |
return encodedValue; |
152 |
return encodedValue; |
| 153 |
} |
153 |
} |
| 154 |
if (enumValue & WebCore::PlatformEvent::Key) { |
154 |
if (enumValue & Test::PlatformEvent::Key) { |
| 155 |
encodedValue.append<String>(ASCIILiteral("Key")); |
155 |
encodedValue.append<String>(ASCIILiteral("Key")); |
| 156 |
if (enumValue == WebCore::PlatformEvent::Key) |
156 |
if (enumValue == Test::PlatformEvent::Key) |
| 157 |
return encodedValue; |
157 |
return encodedValue; |
| 158 |
} |
158 |
} |
| 159 |
if (enumValue & WebCore::PlatformEvent::Touch) { |
159 |
if (enumValue & Test::PlatformEvent::Touch) { |
| 160 |
encodedValue.append<String>(ASCIILiteral("Touch")); |
160 |
encodedValue.append<String>(ASCIILiteral("Touch")); |
| 161 |
if (enumValue == WebCore::PlatformEvent::Touch) |
161 |
if (enumValue == Test::PlatformEvent::Touch) |
| 162 |
return encodedValue; |
162 |
return encodedValue; |
| 163 |
} |
163 |
} |
| 164 |
if (enumValue & WebCore::PlatformEvent::Wheel) { |
164 |
if (enumValue & Test::PlatformEvent::Wheel) { |
| 165 |
encodedValue.append<String>(ASCIILiteral("Wheel")); |
165 |
encodedValue.append<String>(ASCIILiteral("Wheel")); |
| 166 |
if (enumValue == WebCore::PlatformEvent::Wheel) |
166 |
if (enumValue == Test::PlatformEvent::Wheel) |
| 167 |
return encodedValue; |
167 |
return encodedValue; |
| 168 |
} |
168 |
} |
| 169 |
return encodedValue; |
169 |
return encodedValue; |
| 170 |
} |
170 |
} |
| 171 |
|
171 |
|
| 172 |
bool EncodingTraits<WebCore::PlatformEvent::Type>::decodeValue(EncodedValue& encodedValue, WebCore::PlatformEvent::Type& enumValue) |
172 |
bool EncodingTraits<Test::PlatformEvent::Type>::decodeValue(EncodedValue& encodedValue, Test::PlatformEvent::Type& enumValue) |
| 173 |
{ |
173 |
{ |
| 174 |
Vector<String> enumStrings; |
174 |
Vector<String> enumStrings; |
| 175 |
if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings)) |
175 |
if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings)) |
|
Lines 177-189
bool EncodingTraits<WebCore::PlatformEvent::Type>::decodeValue(EncodedValue& enc
a/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp_sec4
|
| 177 |
|
177 |
|
| 178 |
for (const String& enumString : enumStrings) { |
178 |
for (const String& enumString : enumStrings) { |
| 179 |
if (enumString == "Mouse") |
179 |
if (enumString == "Mouse") |
| 180 |
enumValue = static_cast<WebCore::PlatformEvent::Type>(enumValue | WebCore::PlatformEvent::Mouse); |
180 |
enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Mouse); |
| 181 |
else if (enumString == "Key") |
181 |
else if (enumString == "Key") |
| 182 |
enumValue = static_cast<WebCore::PlatformEvent::Type>(enumValue | WebCore::PlatformEvent::Key); |
182 |
enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Key); |
| 183 |
else if (enumString == "Touch") |
183 |
else if (enumString == "Touch") |
| 184 |
enumValue = static_cast<WebCore::PlatformEvent::Type>(enumValue | WebCore::PlatformEvent::Touch); |
184 |
enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Touch); |
| 185 |
else if (enumString == "Wheel") |
185 |
else if (enumString == "Wheel") |
| 186 |
enumValue = static_cast<WebCore::PlatformEvent::Type>(enumValue | WebCore::PlatformEvent::Wheel); |
186 |
enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Wheel); |
| 187 |
} |
187 |
} |
| 188 |
|
188 |
|
| 189 |
return true; |
189 |
return true; |