Title: [174113] trunk/Source
Revision
174113
Author
[email protected]
Date
2014-09-30 12:21:25 -0700 (Tue, 30 Sep 2014)

Log Message

Web Replay: use static Strings instead of AtomicStrings for replay input type tags
https://bugs.webkit.org/show_bug.cgi?id=137086

Reviewed by Joseph Pecoraro.

Source/_javascript_Core:

This pattern doesn't work when we want to define some inputs in WebKit2.
The ReplayInputTypes class was generated from WebCore inputs only. This
patch moves all input traits to use static local Strings as type tags.

* replay/scripts/CodeGeneratorReplayInputs.py: Remove configuration of how
type tags are generated, since all framework targets now generate the same code.

* replay/NondeterministicInput.h:
* replay/scripts/CodeGeneratorReplayInputs.py: Simplify and rebase test results.
(Generator.generate_input_trait_implementation):
* replay/scripts/CodeGeneratorReplayInputsTemplates.py: Simplify templates.

* replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::SavedMouseButton>::type):
* replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h:
* replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::SavedMouseButton>::type):
* replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h:
* replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::HandleWheelEvent>::type):
* replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.h:
* replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::FormCombo>::type):
* replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.h:
* replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::GetCurrentTime>::type):
(JSC::InputTraits<Test::SetRandomSeed>::type):
* replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h:
* replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::ArrayOfThings>::type):
(JSC::InputTraits<Test::SavedHistory>::type):
* replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h:
* replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::ScalarInput1>::type):
(JSC::InputTraits<Test::ScalarInput2>::type):
* replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h:
* replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp:
(JSC::InputTraits<Test::ScalarInput>::type):
(JSC::InputTraits<Test::MapInput>::type):
* replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h:

Source/WebCore:

This pattern doesn't work when we want to define some inputs in WebKit2,
since the ReplayInputTypes class is generated from WebCore inputs only.

Replace tag-checking uses of ReplayInputTypes with InputTraits<T>::type().
Remove thread-local input types, and switch to using a plain const String instead
of const AtomicString.

No new tests, no behavior changed.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* inspector/InspectorReplayAgent.cpp:
(WebCore::SerializeInputToJSONFunctor::operator()):
* platform/ThreadGlobalData.cpp:
(WebCore::ThreadGlobalData::ThreadGlobalData):
(WebCore::ThreadGlobalData::destroy):
* platform/ThreadGlobalData.h:
(WebCore::ThreadGlobalData::inputTypes): Deleted.
* replay/AllReplayInputs.h:
* replay/EventLoopInput.h:
* replay/EventLoopInputDispatcher.cpp:
(WebCore::EventLoopInputDispatcher::dispatchInput):
* replay/MemoizedDOMResult.cpp:
(WebCore::MemoizedDOMResultBase::type):
(JSC::InputTraits<MemoizedDOMResultBase>::type):
* replay/MemoizedDOMResult.h:
* replay/ReplayInputTypes.cpp: Removed.
* replay/ReplayInputTypes.h: Removed.
* replay/ReplayingInputCursor.cpp:
(WebCore::ReplayingInputCursor::loadInput):
* replay/SegmentedInputStorage.cpp:
(WebCore::SegmentedInputStorage::load):
(WebCore::SegmentedInputStorage::store):
* replay/SerializationMethods.cpp:
(JSC::EncodingTraits<NondeterministicInputBase>::encodeValue):
(JSC::EncodingTraits<NondeterministicInputBase>::decodeValue):

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (174112 => 174113)


--- trunk/Source/_javascript_Core/ChangeLog	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-09-30 19:21:25 UTC (rev 174113)
@@ -1,3 +1,51 @@
+2014-09-30  Brian J. Burg  <[email protected]>
+
+        Web Replay: use static Strings instead of AtomicStrings for replay input type tags
+        https://bugs.webkit.org/show_bug.cgi?id=137086
+
+        Reviewed by Joseph Pecoraro.
+
+        This pattern doesn't work when we want to define some inputs in WebKit2.
+        The ReplayInputTypes class was generated from WebCore inputs only. This
+        patch moves all input traits to use static local Strings as type tags.
+
+        * replay/scripts/CodeGeneratorReplayInputs.py: Remove configuration of how
+        type tags are generated, since all framework targets now generate the same code.
+
+        * replay/NondeterministicInput.h:
+        * replay/scripts/CodeGeneratorReplayInputs.py: Simplify and rebase test results.
+        (Generator.generate_input_trait_implementation):
+        * replay/scripts/CodeGeneratorReplayInputsTemplates.py: Simplify templates.
+
+        * replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp:
+        (JSC::InputTraits<Test::SavedMouseButton>::type):
+        * replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h:
+        * replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp:
+        (JSC::InputTraits<Test::SavedMouseButton>::type):
+        * replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h:
+        * replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.cpp:
+        (JSC::InputTraits<Test::HandleWheelEvent>::type):
+        * replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.h:
+        * replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp:
+        (JSC::InputTraits<Test::FormCombo>::type):
+        * replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.h:
+        * replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp:
+        (JSC::InputTraits<Test::GetCurrentTime>::type):
+        (JSC::InputTraits<Test::SetRandomSeed>::type):
+        * replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h:
+        * replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp:
+        (JSC::InputTraits<Test::ArrayOfThings>::type):
+        (JSC::InputTraits<Test::SavedHistory>::type):
+        * replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h:
+        * replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.cpp:
+        (JSC::InputTraits<Test::ScalarInput1>::type):
+        (JSC::InputTraits<Test::ScalarInput2>::type):
+        * replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h:
+        * replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp:
+        (JSC::InputTraits<Test::ScalarInput>::type):
+        (JSC::InputTraits<Test::MapInput>::type):
+        * replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h:
+
 2014-09-30  Daniel Bates  <[email protected]>
 
         REGRESSION (r172532): JSBase.h declares NSMapTable functions that are SPI

Modified: trunk/Source/_javascript_Core/replay/NondeterministicInput.h (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/NondeterministicInput.h	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/NondeterministicInput.h	2014-09-30 19:21:25 UTC (rev 174113)
@@ -47,7 +47,7 @@
 template<typename InputType>
 struct JS_EXPORT_PRIVATE InputTraits {
     static InputQueue queue();
-    static AtomicString& type();
+    static String& type();
 
     static void encode(EncodedValue& encodedInput, InputType& decodedInput);
     static bool decode(EncodedValue& encodedInput, std::unique_ptr<InputType>& decodedInput);
@@ -59,13 +59,13 @@
     NondeterministicInputBase() { }
     virtual ~NondeterministicInputBase() { }
 
-    virtual const AtomicString& type() const = 0;
+    virtual const String& type() const = 0;
     virtual InputQueue queue() const = 0;
 };
 
 template<typename InputType>
 class NondeterministicInput : public NondeterministicInputBase {
-    virtual const AtomicString& type() const override
+    virtual const String& type() const override
     {
         return InputTraits<InputType>::type();
     }

Modified: trunk/Source/_javascript_Core/replay/scripts/CodeGeneratorReplayInputs.py (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/CodeGeneratorReplayInputs.py	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/CodeGeneratorReplayInputs.py	2014-09-30 19:21:25 UTC (rev 174113)
@@ -72,20 +72,14 @@
 
     "implIncludes": [
         (["WebCore"],
-            ("WebCore", "replay/ReplayInputTypes.h")
-        ),
-        (["WebCore"],
             ("WebCore", "replay/SerializationMethods.h")
         ),
         (["WebCore", "_javascript_Core"],
             ("_javascript_Core", "inspector/InspectorValues.h")
         ),
-        (["_javascript_Core"],
+        (["WebCore", "_javascript_Core"],
             ("WTF", "wtf/NeverDestroyed.h")
         ),
-        (["_javascript_Core"],
-            ("WTF", "wtf/text/AtomicString.h")
-        ),
 
         # Testing fixtures.
         (["Test"],
@@ -111,18 +105,15 @@
         "prefix": "JS",
         "namespace": "JSC",
         "exportMacro": "JS_EXPORT_PRIVATE",
-        "inputTypeTemplate": Templates.InputTypeFromStaticLocal,
     },
     "WebCore": {
         "prefix": "Web",
         "namespace": "WebCore",
-        "inputTypeTemplate": Templates.InputTypeFromThreadLocal,
     },
     # Used for bindings tests.
     "Test": {
         "prefix": "Test",
         "namespace": "Test",
-        "inputTypeTemplate": Templates.InputTypeFromStaticLocal,
     }
 }
 
@@ -874,7 +865,7 @@
     def generate_input_trait_implementation(self, _input):
         template_arguments = {
             'inputsNamespace': self.target_framework.setting('namespace'),
-            'inputTypeImplementation': Template(self.setting('inputTypeTemplate')).substitute(None, inputName=_input.name),
+            'inputNameStringLiteral': '"%s"' % _input.name,
             'qualifiedInputName': self.qualified_input_name(_input),
             'constructorArguments': self.generate_constructor_arguments_list(_input),
             'constructorFormalsList': self.generate_constructor_formals_list(_input),

Modified: trunk/Source/_javascript_Core/replay/scripts/CodeGeneratorReplayInputsTemplates.py (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/CodeGeneratorReplayInputsTemplates.py	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/CodeGeneratorReplayInputsTemplates.py	2014-09-30 19:21:25 UTC (rev 174113)
@@ -98,7 +98,7 @@
     InputTraitsDeclaration = (
     """template<> ${structOrClass} InputTraits<${qualifiedInputName}> {
     static InputQueue queue() { return InputQueue::${queueType}; }
-    static const AtomicString& type();
+    static const String& type();
 
     static void encode(JSC::EncodedValue&, const ${qualifiedInputName}&);
     static bool decode(JSC::EncodedValue&, std::unique_ptr<${qualifiedInputName}>&);
@@ -152,9 +152,10 @@
 """)
 
     InputTraitsImplementation = (
-    """const AtomicString& InputTraits<${qualifiedInputName}>::type()
+    """const String& InputTraits<${qualifiedInputName}>::type()
 {
-$inputTypeImplementation
+    static NeverDestroyed<const String> type(ASCIILiteral(${inputNameStringLiteral}));
+    return type;
 }
 
 void InputTraits<${qualifiedInputName}>::encode(EncodedValue& encodedValue, const ${qualifiedInputName}& input)
@@ -226,12 +227,6 @@
     """        if (enumString == "${enumStringValue}")
             enumValue = static_cast<${qualifiedEnumName}>(enumValue | ${qualifiedEnumValue});""")
 
-    InputTypeFromStaticLocal = (
-    """    static NeverDestroyed<const AtomicString> type("${inputName}", AtomicString::ConstructFromLiteral);
-    return type;""")
-
-    InputTypeFromThreadLocal = "    return WebCore::inputTypes().${inputName};"
-
     InputClassImplementation = (
     """${inputName}::${inputName}(${constructorFormalsList})
 ${initializerList}

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -48,9 +48,9 @@
 } // namespace Test
 
 namespace JSC {
-const AtomicString& InputTraits<Test::SavedMouseButton>::type()
+const String& InputTraits<Test::SavedMouseButton>::type()
 {
-    static NeverDestroyed<const AtomicString> type("SavedMouseButton", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<const String> type(ASCIILiteral("SavedMouseButton"));
     return type;
 }
 

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h	2014-09-30 19:21:25 UTC (rev 174113)
@@ -46,7 +46,7 @@
 namespace JSC {
 template<> struct InputTraits<Test::SavedMouseButton> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
-    static const AtomicString& type();
+    static const String& type();
 
     static void encode(JSC::EncodedValue&, const Test::SavedMouseButton&);
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::SavedMouseButton>&);

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -49,9 +49,9 @@
 } // namespace Test
 
 namespace JSC {
-const AtomicString& InputTraits<Test::SavedMouseButton>::type()
+const String& InputTraits<Test::SavedMouseButton>::type()
 {
-    static NeverDestroyed<const AtomicString> type("SavedMouseButton", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<const String> type(ASCIILiteral("SavedMouseButton"));
     return type;
 }
 

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h	2014-09-30 19:21:25 UTC (rev 174113)
@@ -50,7 +50,7 @@
 namespace JSC {
 template<> struct InputTraits<Test::SavedMouseButton> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
-    static const AtomicString& type();
+    static const String& type();
 
     static void encode(JSC::EncodedValue&, const Test::SavedMouseButton&);
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::SavedMouseButton>&);

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.cpp (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -48,9 +48,9 @@
 } // namespace Test
 
 namespace JSC {
-const AtomicString& InputTraits<Test::HandleWheelEvent>::type()
+const String& InputTraits<Test::HandleWheelEvent>::type()
 {
-    static NeverDestroyed<const AtomicString> type("HandleWheelEvent", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<const String> type(ASCIILiteral("HandleWheelEvent"));
     return type;
 }
 

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.h (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.h	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.h	2014-09-30 19:21:25 UTC (rev 174113)
@@ -47,7 +47,7 @@
 namespace JSC {
 template<> struct InputTraits<Test::HandleWheelEvent> {
     static InputQueue queue() { return InputQueue::EventLoopInput; }
-    static const AtomicString& type();
+    static const String& type();
 
     static void encode(JSC::EncodedValue&, const Test::HandleWheelEvent&);
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::HandleWheelEvent>&);

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -50,9 +50,9 @@
 } // namespace Test
 
 namespace JSC {
-const AtomicString& InputTraits<Test::FormCombo>::type()
+const String& InputTraits<Test::FormCombo>::type()
 {
-    static NeverDestroyed<const AtomicString> type("FormCombo", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<const String> type(ASCIILiteral("FormCombo"));
     return type;
 }
 

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.h (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.h	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.h	2014-09-30 19:21:25 UTC (rev 174113)
@@ -46,7 +46,7 @@
 namespace JSC {
 template<> struct InputTraits<Test::FormCombo> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
-    static const AtomicString& type();
+    static const String& type();
 
     static void encode(JSC::EncodedValue&, const Test::FormCombo&);
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::FormCombo>&);

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -60,9 +60,9 @@
 
 namespace JSC {
 #if ENABLE(DUMMY_FEATURE)
-const AtomicString& InputTraits<Test::GetCurrentTime>::type()
+const String& InputTraits<Test::GetCurrentTime>::type()
 {
-    static NeverDestroyed<const AtomicString> type("GetCurrentTime", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<const String> type(ASCIILiteral("GetCurrentTime"));
     return type;
 }
 
@@ -82,9 +82,9 @@
 }
 #endif // ENABLE(DUMMY_FEATURE)
 
-const AtomicString& InputTraits<Test::SetRandomSeed>::type()
+const String& InputTraits<Test::SetRandomSeed>::type()
 {
-    static NeverDestroyed<const AtomicString> type("SetRandomSeed", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<const String> type(ASCIILiteral("SetRandomSeed"));
     return type;
 }
 

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h	2014-09-30 19:21:25 UTC (rev 174113)
@@ -47,7 +47,7 @@
 #if ENABLE(DUMMY_FEATURE)
 template<> struct InputTraits<Test::GetCurrentTime> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
-    static const AtomicString& type();
+    static const String& type();
 
     static void encode(JSC::EncodedValue&, const Test::GetCurrentTime&);
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::GetCurrentTime>&);
@@ -56,7 +56,7 @@
 
 template<> struct InputTraits<Test::SetRandomSeed> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
-    static const AtomicString& type();
+    static const String& type();
 
     static void encode(JSC::EncodedValue&, const Test::SetRandomSeed&);
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::SetRandomSeed>&);

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -61,9 +61,9 @@
 } // namespace Test
 
 namespace JSC {
-const AtomicString& InputTraits<Test::ArrayOfThings>::type()
+const String& InputTraits<Test::ArrayOfThings>::type()
 {
-    static NeverDestroyed<const AtomicString> type("ArrayOfThings", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<const String> type(ASCIILiteral("ArrayOfThings"));
     return type;
 }
 
@@ -92,9 +92,9 @@
     return true;
 }
 
-const AtomicString& InputTraits<Test::SavedHistory>::type()
+const String& InputTraits<Test::SavedHistory>::type()
 {
-    static NeverDestroyed<const AtomicString> type("SavedHistory", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<const String> type(ASCIILiteral("SavedHistory"));
     return type;
 }
 

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h	2014-09-30 19:21:25 UTC (rev 174113)
@@ -48,7 +48,7 @@
 namespace JSC {
 template<> struct InputTraits<Test::ArrayOfThings> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
-    static const AtomicString& type();
+    static const String& type();
 
     static void encode(JSC::EncodedValue&, const Test::ArrayOfThings&);
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::ArrayOfThings>&);
@@ -56,7 +56,7 @@
 
 template<> struct InputTraits<Test::SavedHistory> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
-    static const AtomicString& type();
+    static const String& type();
 
     static void encode(JSC::EncodedValue&, const Test::SavedHistory&);
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::SavedHistory>&);

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.cpp (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -57,9 +57,9 @@
 } // namespace Test
 
 namespace JSC {
-const AtomicString& InputTraits<Test::ScalarInput1>::type()
+const String& InputTraits<Test::ScalarInput1>::type()
 {
-    static NeverDestroyed<const AtomicString> type("ScalarInput1", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<const String> type(ASCIILiteral("ScalarInput1"));
     return type;
 }
 
@@ -78,9 +78,9 @@
     return true;
 }
 
-const AtomicString& InputTraits<Test::ScalarInput2>::type()
+const String& InputTraits<Test::ScalarInput2>::type()
 {
-    static NeverDestroyed<const AtomicString> type("ScalarInput2", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<const String> type(ASCIILiteral("ScalarInput2"));
     return type;
 }
 

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h	2014-09-30 19:21:25 UTC (rev 174113)
@@ -44,7 +44,7 @@
 namespace JSC {
 template<> struct InputTraits<Test::ScalarInput1> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
-    static const AtomicString& type();
+    static const String& type();
 
     static void encode(JSC::EncodedValue&, const Test::ScalarInput1&);
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::ScalarInput1>&);
@@ -52,7 +52,7 @@
 
 template<> struct InputTraits<Test::ScalarInput2> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
-    static const AtomicString& type();
+    static const String& type();
 
     static void encode(JSC::EncodedValue&, const Test::ScalarInput2&);
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::ScalarInput2>&);

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -57,9 +57,9 @@
 } // namespace Test
 
 namespace JSC {
-const AtomicString& InputTraits<Test::ScalarInput>::type()
+const String& InputTraits<Test::ScalarInput>::type()
 {
-    static NeverDestroyed<const AtomicString> type("ScalarInput", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<const String> type(ASCIILiteral("ScalarInput"));
     return type;
 }
 
@@ -78,9 +78,9 @@
     return true;
 }
 
-const AtomicString& InputTraits<Test::MapInput>::type()
+const String& InputTraits<Test::MapInput>::type()
 {
-    static NeverDestroyed<const AtomicString> type("MapInput", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<const String> type(ASCIILiteral("MapInput"));
     return type;
 }
 

Modified: trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h (174112 => 174113)


--- trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/_javascript_Core/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h	2014-09-30 19:21:25 UTC (rev 174113)
@@ -44,7 +44,7 @@
 namespace JSC {
 template<> struct InputTraits<Test::ScalarInput> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
-    static const AtomicString& type();
+    static const String& type();
 
     static void encode(JSC::EncodedValue&, const Test::ScalarInput&);
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::ScalarInput>&);
@@ -52,7 +52,7 @@
 
 template<> struct InputTraits<Test::MapInput> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
-    static const AtomicString& type();
+    static const String& type();
 
     static void encode(JSC::EncodedValue&, const Test::MapInput&);
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::MapInput>&);

Modified: trunk/Source/WebCore/CMakeLists.txt (174112 => 174113)


--- trunk/Source/WebCore/CMakeLists.txt	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/CMakeLists.txt	2014-09-30 19:21:25 UTC (rev 174113)
@@ -3129,7 +3129,6 @@
         replay/ReplayingInputCursor.cpp
         replay/ReplayInputCreationMethods.cpp
         replay/ReplayInputDispatchMethods.cpp
-        replay/ReplayInputTypes.cpp
         replay/ReplaySession.cpp
         replay/ReplaySessionSegment.cpp
         replay/SegmentedInputStorage.cpp

Modified: trunk/Source/WebCore/ChangeLog (174112 => 174113)


--- trunk/Source/WebCore/ChangeLog	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/ChangeLog	2014-09-30 19:21:25 UTC (rev 174113)
@@ -1,3 +1,47 @@
+2014-09-30  Brian J. Burg  <[email protected]>
+
+        Web Replay: use static Strings instead of AtomicStrings for replay input type tags
+        https://bugs.webkit.org/show_bug.cgi?id=137086
+
+        Reviewed by Joseph Pecoraro.
+
+        This pattern doesn't work when we want to define some inputs in WebKit2,
+        since the ReplayInputTypes class is generated from WebCore inputs only.
+
+        Replace tag-checking uses of ReplayInputTypes with InputTraits<T>::type().
+        Remove thread-local input types, and switch to using a plain const String instead
+        of const AtomicString.
+
+        No new tests, no behavior changed.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * inspector/InspectorReplayAgent.cpp:
+        (WebCore::SerializeInputToJSONFunctor::operator()):
+        * platform/ThreadGlobalData.cpp:
+        (WebCore::ThreadGlobalData::ThreadGlobalData):
+        (WebCore::ThreadGlobalData::destroy):
+        * platform/ThreadGlobalData.h:
+        (WebCore::ThreadGlobalData::inputTypes): Deleted.
+        * replay/AllReplayInputs.h:
+        * replay/EventLoopInput.h:
+        * replay/EventLoopInputDispatcher.cpp:
+        (WebCore::EventLoopInputDispatcher::dispatchInput):
+        * replay/MemoizedDOMResult.cpp:
+        (WebCore::MemoizedDOMResultBase::type):
+        (JSC::InputTraits<MemoizedDOMResultBase>::type):
+        * replay/MemoizedDOMResult.h:
+        * replay/ReplayInputTypes.cpp: Removed.
+        * replay/ReplayInputTypes.h: Removed.
+        * replay/ReplayingInputCursor.cpp:
+        (WebCore::ReplayingInputCursor::loadInput):
+        * replay/SegmentedInputStorage.cpp:
+        (WebCore::SegmentedInputStorage::load):
+        (WebCore::SegmentedInputStorage::store):
+        * replay/SerializationMethods.cpp:
+        (JSC::EncodingTraits<NondeterministicInputBase>::encodeValue):
+        (JSC::EncodingTraits<NondeterministicInputBase>::decodeValue):
+
 2014-09-30  Eric Carlson  <[email protected]>
 
         [Mac] MediaPlayerPrivateQTKit should not use FrameView

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (174112 => 174113)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-09-30 19:21:25 UTC (rev 174113)
@@ -3597,8 +3597,6 @@
 		98CE4326129E00BD005821DC /* LinkLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 98CE4325129E00BD005821DC /* LinkLoader.cpp */; };
 		98CE432A129E00E5005821DC /* LinkLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 98CE4329129E00E5005821DC /* LinkLoader.h */; };
 		98EB1F951313FE0500D0E1EA /* NotImplemented.h in Headers */ = {isa = PBXBuildFile; fileRef = 98EB1F941313FE0500D0E1EA /* NotImplemented.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		990A1A0418ADA48400183FD1 /* ReplayInputTypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 990A19F418ADA48400183FD1 /* ReplayInputTypes.cpp */; };
-		990A1A0518ADA48400183FD1 /* ReplayInputTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 990A19F518ADA48400183FD1 /* ReplayInputTypes.h */; };
 		9920398218B95BC600B39AF9 /* UserInputBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9920398018B95BC600B39AF9 /* UserInputBridge.cpp */; };
 		9920398318B95BC600B39AF9 /* UserInputBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 9920398118B95BC600B39AF9 /* UserInputBridge.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		996231F318D18AC300C03FDA /* InspectorWebBackendCommands.js in Headers */ = {isa = PBXBuildFile; fileRef = 996231F118D189BD00C03FDA /* InspectorWebBackendCommands.js */; };
@@ -10756,8 +10754,6 @@
 		98CE4325129E00BD005821DC /* LinkLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LinkLoader.cpp; sourceTree = "<group>"; };
 		98CE4329129E00E5005821DC /* LinkLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkLoader.h; sourceTree = "<group>"; };
 		98EB1F941313FE0500D0E1EA /* NotImplemented.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotImplemented.h; sourceTree = "<group>"; };
-		990A19F418ADA48400183FD1 /* ReplayInputTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReplayInputTypes.cpp; sourceTree = "<group>"; };
-		990A19F518ADA48400183FD1 /* ReplayInputTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReplayInputTypes.h; sourceTree = "<group>"; };
 		9920398018B95BC600B39AF9 /* UserInputBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserInputBridge.cpp; sourceTree = "<group>"; };
 		9920398118B95BC600B39AF9 /* UserInputBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserInputBridge.h; sourceTree = "<group>"; };
 		996231F118D189BD00C03FDA /* InspectorWebBackendCommands.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = InspectorWebBackendCommands.js; sourceTree = "<group>"; };
@@ -18361,8 +18357,6 @@
 				99CC0B4118BE9849006CEBCC /* ReplayingInputCursor.h */,
 				99CC0B4218BE9849006CEBCC /* ReplayInputCreationMethods.cpp */,
 				99CC0B4318BE9849006CEBCC /* ReplayInputDispatchMethods.cpp */,
-				990A19F418ADA48400183FD1 /* ReplayInputTypes.cpp */,
-				990A19F518ADA48400183FD1 /* ReplayInputTypes.h */,
 				99CC0B4418BE9849006CEBCC /* ReplaySession.cpp */,
 				99CC0B4518BE9849006CEBCC /* ReplaySession.h */,
 				99CC0B4618BE9849006CEBCC /* ReplaySessionSegment.cpp */,
@@ -25717,7 +25711,6 @@
 				93309E0A099E64920056E581 /* ReplaceSelectionCommand.h in Headers */,
 				99CC0B5418BE9849006CEBCC /* ReplayController.h in Headers */,
 				99CC0B5618BE984A006CEBCC /* ReplayingInputCursor.h in Headers */,
-				990A1A0518ADA48400183FD1 /* ReplayInputTypes.h in Headers */,
 				99CC0B5A18BE984A006CEBCC /* ReplaySession.h in Headers */,
 				99CC0B5C18BE984A006CEBCC /* ReplaySessionSegment.h in Headers */,
 				4998AEC613F9D0EA0090B1AA /* RequestAnimationFrameCallback.h in Headers */,
@@ -29169,7 +29162,6 @@
 				99CC0B5518BE9849006CEBCC /* ReplayingInputCursor.cpp in Sources */,
 				99CC0B5718BE984A006CEBCC /* ReplayInputCreationMethods.cpp in Sources */,
 				99CC0B5818BE984A006CEBCC /* ReplayInputDispatchMethods.cpp in Sources */,
-				990A1A0418ADA48400183FD1 /* ReplayInputTypes.cpp in Sources */,
 				99CC0B5918BE984A006CEBCC /* ReplaySession.cpp in Sources */,
 				99CC0B5B18BE984A006CEBCC /* ReplaySessionSegment.cpp in Sources */,
 				F55B3DCF1251F12D003EF269 /* ResetInputType.cpp in Sources */,

Modified: trunk/Source/WebCore/inspector/InspectorReplayAgent.cpp (174112 => 174113)


--- trunk/Source/WebCore/inspector/InspectorReplayAgent.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/inspector/InspectorReplayAgent.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -119,7 +119,7 @@
 
     void operator()(size_t index, const NondeterministicInputBase* input)
     {
-        LOG(WebReplay, "%-25s Writing %5zu: %s\n", "[SerializeInput]", index, input->type().string().ascii().data());
+        LOG(WebReplay, "%-25s Writing %5zu: %s\n", "[SerializeInput]", index, input->type().ascii().data());
 
         if (RefPtr<Inspector::Protocol::Replay::ReplayInput> serializedInput = buildInspectorObjectForInput(*input, index))
             m_inputs->addItem(serializedInput.release());

Modified: trunk/Source/WebCore/platform/ThreadGlobalData.cpp (174112 => 174113)


--- trunk/Source/WebCore/platform/ThreadGlobalData.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/platform/ThreadGlobalData.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -41,10 +41,6 @@
 #include "TextCodeCMac.h"
 #endif
 
-#if ENABLE(WEB_REPLAY)
-#include "ReplayInputTypes.h"
-#endif
-
 namespace WebCore {
 
 ThreadSpecific<ThreadGlobalData>* ThreadGlobalData::staticData;
@@ -56,9 +52,6 @@
     : m_cachedResourceRequestInitiators(adoptPtr(new CachedResourceRequestInitiators))
     , m_eventNames(adoptPtr(new EventNames))
     , m_threadTimers(adoptPtr(new ThreadTimers))
-#if ENABLE(WEB_REPLAY)
-    , m_inputTypes(std::make_unique<ReplayInputTypes>())
-#endif
 #ifndef NDEBUG
     , m_isMainThread(isMainThread())
 #endif
@@ -87,10 +80,6 @@
 
     m_cachedConverterICU.clear();
 
-#if ENABLE(WEB_REPLAY)
-    m_inputTypes = nullptr;
-#endif
-
     m_eventNames.clear();
     m_threadTimers.clear();
 }

Modified: trunk/Source/WebCore/platform/ThreadGlobalData.h (174112 => 174113)


--- trunk/Source/WebCore/platform/ThreadGlobalData.h	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/platform/ThreadGlobalData.h	2014-09-30 19:21:25 UTC (rev 174113)
@@ -40,7 +40,6 @@
 namespace WebCore {
 
     class EventNames;
-    class ReplayInputTypes;
     class ThreadTimers;
 
     struct CachedResourceRequestInitiators;
@@ -57,9 +56,6 @@
         const CachedResourceRequestInitiators& cachedResourceRequestInitiators() { return *m_cachedResourceRequestInitiators; }
         EventNames& eventNames() { return *m_eventNames; }
         ThreadTimers& threadTimers() { return *m_threadTimers; }
-#if ENABLE(WEB_REPLAY)
-        ReplayInputTypes& inputTypes() { return *m_inputTypes; }
-#endif
 
         ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; }
 
@@ -76,10 +72,6 @@
         OwnPtr<EventNames> m_eventNames;
         OwnPtr<ThreadTimers> m_threadTimers;
 
-#if ENABLE(WEB_REPLAY)
-        std::unique_ptr<ReplayInputTypes> m_inputTypes;
-#endif
-
 #ifndef NDEBUG
         bool m_isMainThread;
 #endif

Modified: trunk/Source/WebCore/replay/AllReplayInputs.h (174112 => 174113)


--- trunk/Source/WebCore/replay/AllReplayInputs.h	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/replay/AllReplayInputs.h	2014-09-30 19:21:25 UTC (rev 174113)
@@ -29,8 +29,6 @@
 // Note that there is not an exact correspondence between the two, since
 // Some input types reside in the same file.
 
-// Make sure that this stays in sync with ReplayInputTypes.h for custom inputs.
-
 #ifndef AllReplayInputs_h
 #define AllReplayInputs_h
 

Modified: trunk/Source/WebCore/replay/EventLoopInput.h (174112 => 174113)


--- trunk/Source/WebCore/replay/EventLoopInput.h	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/replay/EventLoopInput.h	2014-09-30 19:21:25 UTC (rev 174113)
@@ -64,7 +64,7 @@
 
 template <typename InputType>
 class EventLoopInput : public EventLoopInputBase {
-    virtual const AtomicString& type() const override final
+    virtual const String& type() const override final
     {
         return InputTraits<InputType>::type();
     }

Modified: trunk/Source/WebCore/replay/EventLoopInputDispatcher.cpp (174112 => 174113)


--- trunk/Source/WebCore/replay/EventLoopInputDispatcher.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/replay/EventLoopInputDispatcher.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -31,8 +31,8 @@
 #if ENABLE(WEB_REPLAY)
 
 #include "Page.h"
-#include "ReplayInputTypes.h"
 #include "ReplayingInputCursor.h"
+#include "WebReplayInputs.h"
 #include <wtf/TemporaryChange.h>
 
 #if !LOG_DISABLED
@@ -140,7 +140,7 @@
     String jsonString = encodedInput.asObject()->toJSONString();
 
     LOG(WebReplay, "%-20s ----------------------------------------------", "ReplayEvents");
-    LOG(WebReplay, "%-20s >DISPATCH: %s %s\n", "ReplayEvents", m_currentWork.input->type().string().utf8().data(), jsonString.utf8().data());
+    LOG(WebReplay, "%-20s >DISPATCH: %s %s\n", "ReplayEvents", m_currentWork.input->type().utf8().data(), jsonString.utf8().data());
 #endif
 
     m_client->willDispatchInput(*m_currentWork.input);
@@ -158,7 +158,7 @@
 
     // Notify clients that the event was dispatched.
     m_client->didDispatchInput(*dispatchedInput);
-    if (dispatchedInput->type() == inputTypes().EndSegmentSentinel) {
+    if (dispatchedInput->type() == InputTraits<EndSegmentSentinel>::type()) {
         m_running = false;
         m_dispatching = false;
         m_client->didDispatchFinalInput();

Modified: trunk/Source/WebCore/replay/MemoizedDOMResult.cpp (174112 => 174113)


--- trunk/Source/WebCore/replay/MemoizedDOMResult.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/replay/MemoizedDOMResult.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -29,15 +29,15 @@
 
 #if ENABLE(WEB_REPLAY)
 
-#include "ReplayInputTypes.h"
 #include "SerializationMethods.h"
 #include "WebReplayInputs.h"
+#include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
 
-const AtomicString& MemoizedDOMResultBase::type() const
+const String& MemoizedDOMResultBase::type() const
 {
-    return inputTypes().MemoizedDOMResult;
+    return InputTraits<MemoizedDOMResultBase>::type();
 }
 
 std::unique_ptr<MemoizedDOMResultBase> MemoizedDOMResultBase::createFromEncodedResult(const String& attribute, EncodedCType ctype, EncodedValue encodedValue, ExceptionCode exceptionCode)
@@ -69,9 +69,10 @@
 using WebCore::MemoizedDOMResult;
 using WebCore::SerializedScriptValue;
 
-const AtomicString& InputTraits<MemoizedDOMResultBase>::type()
+const String& InputTraits<MemoizedDOMResultBase>::type()
 {
-    return WebCore::inputTypes().MemoizedDOMResult;
+    static NeverDestroyed<const String> type(ASCIILiteral("MemoizedDOMResult"));
+    return type;
 }
 
 void InputTraits<MemoizedDOMResultBase>::encode(EncodedValue& encodedValue, const MemoizedDOMResultBase& input)

Modified: trunk/Source/WebCore/replay/MemoizedDOMResult.h (174112 => 174113)


--- trunk/Source/WebCore/replay/MemoizedDOMResult.h	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/replay/MemoizedDOMResult.h	2014-09-30 19:21:25 UTC (rev 174113)
@@ -76,7 +76,7 @@
 
     virtual EncodedValue encodedResult() const = 0;
     virtual InputQueue queue() const final override { return InputQueue::ScriptMemoizedData; }
-    virtual const AtomicString& type() const final override;
+    virtual const String& type() const final override;
 
     const String& attribute() const { return m_attribute; }
     EncodedCType ctype() const { return m_ctype; }
@@ -146,7 +146,7 @@
 template<>
 struct InputTraits<MemoizedDOMResultBase> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
-    static const AtomicString& type();
+    static const String& type();
 
     static void encode(EncodedValue&, const MemoizedDOMResultBase& input);
     static bool decode(EncodedValue&, std::unique_ptr<MemoizedDOMResultBase>& input);

Deleted: trunk/Source/WebCore/replay/ReplayInputTypes.cpp (174112 => 174113)


--- trunk/Source/WebCore/replay/ReplayInputTypes.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/replay/ReplayInputTypes.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2013 University of Washington. All rights reserved.
- * Copyright (C) 2014 Apple Inc. All rights resernved.
- *
- * 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.
- */
-
-#include "config.h"
-#include "ReplayInputTypes.h"
-
-#if ENABLE(WEB_REPLAY)
-
-namespace WebCore {
-
-#define INITIALIZE_INPUT_TYPE(name) \
-    , name(#name, AtomicString::ConstructFromLiteral)
-
-ReplayInputTypes::ReplayInputTypes()
-    : dummy(0)
-JS_REPLAY_INPUT_NAMES_FOR_EACH(INITIALIZE_INPUT_TYPE)
-WEB_REPLAY_INPUT_NAMES_FOR_EACH(INITIALIZE_INPUT_TYPE)
-INITIALIZE_INPUT_TYPE(MemoizedDOMResult)
-{
-    UNUSED_PARAM(dummy);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_REPLAY)

Deleted: trunk/Source/WebCore/replay/ReplayInputTypes.h (174112 => 174113)


--- trunk/Source/WebCore/replay/ReplayInputTypes.h	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/replay/ReplayInputTypes.h	2014-09-30 19:21:25 UTC (rev 174113)
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2013 University of Washington. All rights reserved.
- * Copyright (C) 2014 Apple Inc. All rights resernved.
- *
- * 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.
- */
-
-#ifndef ReplayInputTypes_h
-#define ReplayInputTypes_h
-
-#if ENABLE(WEB_REPLAY)
-
-#include "ThreadGlobalData.h"
-#include "WebReplayInputs.h"
-#include <_javascript_Core/JSReplayInputs.h>
-#include <wtf/text/AtomicString.h>
-
-namespace WebCore {
-
-class ReplayInputTypes {
-    WTF_MAKE_NONCOPYABLE(ReplayInputTypes); WTF_MAKE_FAST_ALLOCATED;
-    int dummy; // Needed to make initialization macro work.
-public:
-    ReplayInputTypes();
-
-#define DECLARE_REPLAY_INPUT_TYPES(name) AtomicString name;
-    JS_REPLAY_INPUT_NAMES_FOR_EACH(DECLARE_REPLAY_INPUT_TYPES)
-    WEB_REPLAY_INPUT_NAMES_FOR_EACH(DECLARE_REPLAY_INPUT_TYPES)
-    DECLARE_REPLAY_INPUT_TYPES(MemoizedDOMResult);
-#undef DECLARE_REPLAY_INPUT_TYPES
-};
-
-inline ReplayInputTypes& inputTypes()
-{
-    return threadGlobalData().inputTypes();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_REPLAY)
-
-#endif // ReplayInputTypes_h

Modified: trunk/Source/WebCore/replay/ReplayingInputCursor.cpp (174112 => 174113)


--- trunk/Source/WebCore/replay/ReplayingInputCursor.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/replay/ReplayingInputCursor.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -67,7 +67,7 @@
     NondeterministicInputBase* input = uncheckedLoadInput(queue);
 
     if (input->type() != type) {
-        LOG_ERROR("%-25s ERROR: Expected replay input of type %s, but got type %s\n", "[ReplayingInputCursor]", type.string().ascii().data(), input->type().string().ascii().data());
+        LOG_ERROR("%-25s ERROR: Expected replay input of type %s, but got type %s\n", "[ReplayingInputCursor]", type.string().ascii().data(), input->type().ascii().data());
         return nullptr;
     }
 

Modified: trunk/Source/WebCore/replay/SegmentedInputStorage.cpp (174112 => 174113)


--- trunk/Source/WebCore/replay/SegmentedInputStorage.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/replay/SegmentedInputStorage.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -93,7 +93,7 @@
     NondeterministicInputBase* input = queue(inputQueue).at(offset).get();
     ASSERT(input);
 
-    LOG(WebReplay, "%-20s %s: %s %s\n", "ReplayEvents", queueTypeToLogPrefix(inputQueue, true), input->type().string().utf8().data(), jsonStringForInput(*input).utf8().data());
+    LOG(WebReplay, "%-20s %s: %s %s\n", "ReplayEvents", queueTypeToLogPrefix(inputQueue, true), input->type().utf8().data(), jsonStringForInput(*input).utf8().data());
 
     return input;
 }
@@ -103,7 +103,7 @@
     ASSERT(input);
     ASSERT(input->queue() < InputQueue::Count);
 
-    LOG(WebReplay, "%-14s#%-5u %s: %s %s\n", "ReplayEvents", m_inputCount++, queueTypeToLogPrefix(input->queue(), false), input->type().string().utf8().data(), jsonStringForInput(*input).utf8().data());
+    LOG(WebReplay, "%-14s#%-5u %s: %s %s\n", "ReplayEvents", m_inputCount++, queueTypeToLogPrefix(input->queue(), false), input->type().utf8().data(), jsonStringForInput(*input).utf8().data());
 
     m_queues.at(offsetForInputQueue(input->queue()))->append(WTF::move(input));
 }

Modified: trunk/Source/WebCore/replay/SerializationMethods.cpp (174112 => 174113)


--- trunk/Source/WebCore/replay/SerializationMethods.cpp	2014-09-30 19:11:48 UTC (rev 174112)
+++ trunk/Source/WebCore/replay/SerializationMethods.cpp	2014-09-30 19:21:25 UTC (rev 174113)
@@ -40,7 +40,6 @@
 #include "PlatformMouseEvent.h"
 #include "PlatformWheelEvent.h"
 #include "PluginData.h"
-#include "ReplayInputTypes.h"
 #include "SecurityOrigin.h"
 #include "URL.h"
 #include <wtf/text/Base64.h>
@@ -57,7 +56,6 @@
 using WebCore::PluginInfo;
 using WebCore::SecurityOrigin;
 using WebCore::URL;
-using WebCore::inputTypes;
 
 #if PLATFORM(COCOA)
 using WebCore::KeypressCommand;
@@ -167,12 +165,10 @@
 EncodedValue EncodingTraits<NondeterministicInputBase>::encodeValue(const NondeterministicInputBase& input)
 {
     EncodedValue encodedValue = EncodedValue::createObject();
-    const AtomicString& type = input.type();
+    ENCODE_TYPE_WITH_KEY(encodedValue, String, type, input.type());
 
-    ENCODE_TYPE_WITH_KEY(encodedValue, String, type, type.string());
-
 #define ENCODE_IF_TYPE_TAG_MATCHES(name) \
-    if (type == inputTypes().name) { \
+    if (input.type() == InputTraits<name>::type()) { \
         InputTraits<name>::encode(encodedValue, static_cast<const name&>(input)); \
         return encodedValue; \
     } \
@@ -182,7 +178,7 @@
 #undef ENCODE_IF_TYPE_TAG_MATCHES
 
     // The macro won't work here because of the class template argument.
-    if (type == inputTypes().MemoizedDOMResult) {
+    if (input.type() == InputTraits<MemoizedDOMResultBase>::type()) {
         InputTraits<MemoizedDOMResultBase>::encode(encodedValue, static_cast<const MemoizedDOMResultBase&>(input));
         return encodedValue;
     }
@@ -196,7 +192,7 @@
     DECODE_TYPE_WITH_KEY(encodedValue, String, type);
 
 #define DECODE_IF_TYPE_TAG_MATCHES(name) \
-    if (type == inputTypes().name) { \
+    if (type == InputTraits<name>::type()) { \
         std::unique_ptr<name> decodedInput; \
         if (!InputTraits<name>::decode(encodedValue, decodedInput)) \
             return false; \
@@ -209,7 +205,7 @@
     WEB_REPLAY_INPUT_NAMES_FOR_EACH(DECODE_IF_TYPE_TAG_MATCHES)
 #undef DECODE_IF_TYPE_TAG_MATCHES
 
-    if (type == inputTypes().MemoizedDOMResult) {
+    if (type == InputTraits<MemoizedDOMResultBase>::type()) {
         std::unique_ptr<MemoizedDOMResultBase> decodedInput;
         if (!InputTraits<MemoizedDOMResultBase>::decode(encodedValue, decodedInput))
             return false;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to