Web Replay: code generator should take supplemental specifications and allow cross...
authorburg@cs.washington.edu <burg@cs.washington.edu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Jan 2015 16:52:18 +0000 (16:52 +0000)
committerburg@cs.washington.edu <burg@cs.washington.edu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Jan 2015 16:52:18 +0000 (16:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136312

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

Some types are shared between replay inputs from different frameworks.
Previously, these type declarations were duplicated in every input
specification file in which they were used. This caused some type encoding
traits to be emitted twice if used from WebCore inputs and WebKit2 inputs.

This patch teaches the replay inputs code generator to accept multiple
input specification files. Inputs can freely reference types from other
frameworks without duplicating declarations.

On the code generation side, the model could contain types and inputs from
frameworks that are not the target framework. Only generate code for the
target framework.

To properly generate cross-framework type encoding traits, use
Type.encoding_type_argument in more places, and add the export macro for WebCore
and the Test framework.

Adjust some tests so that enum coverage is preserved by moving the enum types
into "Test" (the target framework for tests).

* JavaScriptCore.vcxproj/copy-files.cmd:
For Windows, copy over JSInputs.json as if it were a private header.

* JavaScriptCore.xcodeproj/project.pbxproj: Make JSInputs.json a private header.
* replay/JSInputs.json:
Put all primitive types and WTF types in this specification file.

* replay/scripts/CodeGeneratorReplayInputs.py:
(Input.__init__):
(InputsModel.__init__): Keep track of the input's framework.
(InputsModel.parse_specification): Parse the framework here. Adjust to new format,
and allow either types or inputs to be missing from a single file.

(InputsModel.parse_type_with_framework):
(InputsModel.parse_input_with_framework):
(Generator.should_generate_item): Added helper method.
(Generator.generate_header): Filter inputs to generate.
(Generator.generate_implementation): Filter inputs to generate.
(Generator.generate_enum_trait_declaration): Filter enums to generate.
Add WEBCORE_EXPORT macro to enum encoding traits.

(Generator.generate_for_each_macro): Filter inputs to generate.
(Generator.generate_enum_trait_implementation): Filter enums to generate.
(generate_from_specifications): Added.
(generate_from_specifications.parse_json_from_file):
(InputsModel.parse_toplevel): Deleted.
(InputsModel.parse_type_with_framework_name): Deleted.
(InputsModel.parse_input): Deleted.
(generate_from_specification): Deleted.
* replay/scripts/CodeGeneratorReplayInputsTemplates.py:
* replay/scripts/tests/expected/fail-on-no-inputs.json-error: Removed.
* replay/scripts/tests/expected/fail-on-no-types.json-error: Removed.
* replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp:
* 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:
* replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h:
* replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.cpp:
* replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.h:
* replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp:
* replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.h:
* replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h:
* replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h:
* replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h:
* replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h:
* replay/scripts/tests/fail-on-c-style-enum-no-storage.json:
* replay/scripts/tests/fail-on-duplicate-enum-type.json:
* replay/scripts/tests/fail-on-duplicate-input-names.json:
* replay/scripts/tests/fail-on-duplicate-type-names.json:
* replay/scripts/tests/fail-on-enum-type-missing-values.json:
* replay/scripts/tests/fail-on-missing-input-member-name.json:
* replay/scripts/tests/fail-on-missing-input-name.json:
* replay/scripts/tests/fail-on-missing-input-queue.json:
* replay/scripts/tests/fail-on-missing-type-mode.json:
* replay/scripts/tests/fail-on-missing-type-name.json:
* replay/scripts/tests/fail-on-no-inputs.json:
Removed, no longer required to be in a single file.

* replay/scripts/tests/fail-on-no-types.json:
Removed, no longer required to be in a single file.

* replay/scripts/tests/fail-on-unknown-input-queue.json:
* replay/scripts/tests/fail-on-unknown-member-type.json:
* replay/scripts/tests/fail-on-unknown-type-mode.json:
* replay/scripts/tests/generate-enum-encoding-helpers-with-guarded-values.json:
* replay/scripts/tests/generate-enum-encoding-helpers.json:
* replay/scripts/tests/generate-enum-with-guard.json:
Include enums that are and are not generated.

* replay/scripts/tests/generate-enums-with-same-base-name.json:
* replay/scripts/tests/generate-event-loop-shape-types.json:
* replay/scripts/tests/generate-input-with-guard.json:
* replay/scripts/tests/generate-input-with-vector-members.json:
* replay/scripts/tests/generate-inputs-with-flags.json:
* replay/scripts/tests/generate-memoized-type-modes.json:

Source/WebCore:

Changes covered by existing input generator tests.

* DerivedSources.make: Add JSInputs.json as supplemental specification.
* replay/WebInputs.json: Moved common types to JSInputs.json.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178714 268f45cc-cd09-0410-ab3c-d52691b4dbfc

47 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.vcxproj/copy-files.cmd
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/replay/JSInputs.json
Source/JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py
Source/JavaScriptCore/replay/scripts/CodeGeneratorReplayInputsTemplates.py
Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-no-inputs.json-error [deleted file]
Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-no-types.json-error [deleted file]
Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp
Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h
Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp
Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h
Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.cpp
Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.h
Source/JavaScriptCore/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp
Source/JavaScriptCore/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.h
Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h
Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h
Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h
Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h
Source/JavaScriptCore/replay/scripts/tests/fail-on-c-style-enum-no-storage.json
Source/JavaScriptCore/replay/scripts/tests/fail-on-duplicate-enum-type.json
Source/JavaScriptCore/replay/scripts/tests/fail-on-duplicate-input-names.json
Source/JavaScriptCore/replay/scripts/tests/fail-on-duplicate-type-names.json
Source/JavaScriptCore/replay/scripts/tests/fail-on-enum-type-missing-values.json
Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-member-name.json
Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-name.json
Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-queue.json
Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-type-mode.json
Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-type-name.json
Source/JavaScriptCore/replay/scripts/tests/fail-on-no-inputs.json [deleted file]
Source/JavaScriptCore/replay/scripts/tests/fail-on-no-types.json [deleted file]
Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-input-queue.json
Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-member-type.json
Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-type-mode.json
Source/JavaScriptCore/replay/scripts/tests/generate-enum-encoding-helpers-with-guarded-values.json
Source/JavaScriptCore/replay/scripts/tests/generate-enum-encoding-helpers.json
Source/JavaScriptCore/replay/scripts/tests/generate-enum-with-guard.json
Source/JavaScriptCore/replay/scripts/tests/generate-enums-with-same-base-name.json
Source/JavaScriptCore/replay/scripts/tests/generate-event-loop-shape-types.json
Source/JavaScriptCore/replay/scripts/tests/generate-input-with-guard.json
Source/JavaScriptCore/replay/scripts/tests/generate-input-with-vector-members.json
Source/JavaScriptCore/replay/scripts/tests/generate-inputs-with-flags.json
Source/JavaScriptCore/replay/scripts/tests/generate-memoized-type-modes.json
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/replay/WebInputs.json

index c85fe16..836734f 100644 (file)
@@ -1,3 +1,105 @@
+2015-01-19  Brian J. Burg  <burg@cs.washington.edu>
+
+        Web Replay: code generator should take supplemental specifications and allow cross-framework references
+        https://bugs.webkit.org/show_bug.cgi?id=136312
+
+        Reviewed by Joseph Pecoraro.
+
+        Some types are shared between replay inputs from different frameworks.
+        Previously, these type declarations were duplicated in every input
+        specification file in which they were used. This caused some type encoding
+        traits to be emitted twice if used from WebCore inputs and WebKit2 inputs.
+
+        This patch teaches the replay inputs code generator to accept multiple
+        input specification files. Inputs can freely reference types from other
+        frameworks without duplicating declarations.
+
+        On the code generation side, the model could contain types and inputs from
+        frameworks that are not the target framework. Only generate code for the
+        target framework.
+
+        To properly generate cross-framework type encoding traits, use
+        Type.encoding_type_argument in more places, and add the export macro for WebCore
+        and the Test framework.
+
+        Adjust some tests so that enum coverage is preserved by moving the enum types
+        into "Test" (the target framework for tests).
+
+        * JavaScriptCore.vcxproj/copy-files.cmd:
+        For Windows, copy over JSInputs.json as if it were a private header.
+
+        * JavaScriptCore.xcodeproj/project.pbxproj: Make JSInputs.json a private header.
+        * replay/JSInputs.json:
+        Put all primitive types and WTF types in this specification file.
+
+        * replay/scripts/CodeGeneratorReplayInputs.py:
+        (Input.__init__):
+        (InputsModel.__init__): Keep track of the input's framework.
+        (InputsModel.parse_specification): Parse the framework here. Adjust to new format,
+        and allow either types or inputs to be missing from a single file.
+
+        (InputsModel.parse_type_with_framework):
+        (InputsModel.parse_input_with_framework):
+        (Generator.should_generate_item): Added helper method.
+        (Generator.generate_header): Filter inputs to generate.
+        (Generator.generate_implementation): Filter inputs to generate.
+        (Generator.generate_enum_trait_declaration): Filter enums to generate.
+        Add WEBCORE_EXPORT macro to enum encoding traits.
+
+        (Generator.generate_for_each_macro): Filter inputs to generate.
+        (Generator.generate_enum_trait_implementation): Filter enums to generate.
+        (generate_from_specifications): Added.
+        (generate_from_specifications.parse_json_from_file):
+        (InputsModel.parse_toplevel): Deleted.
+        (InputsModel.parse_type_with_framework_name): Deleted.
+        (InputsModel.parse_input): Deleted.
+        (generate_from_specification): Deleted.
+        * replay/scripts/CodeGeneratorReplayInputsTemplates.py:
+        * replay/scripts/tests/expected/fail-on-no-inputs.json-error: Removed.
+        * replay/scripts/tests/expected/fail-on-no-types.json-error: Removed.
+        * replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp:
+        * 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:
+        * replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h:
+        * replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.cpp:
+        * replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.h:
+        * replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp:
+        * replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.h:
+        * replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h:
+        * replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h:
+        * replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h:
+        * replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h:
+        * replay/scripts/tests/fail-on-c-style-enum-no-storage.json:
+        * replay/scripts/tests/fail-on-duplicate-enum-type.json:
+        * replay/scripts/tests/fail-on-duplicate-input-names.json:
+        * replay/scripts/tests/fail-on-duplicate-type-names.json:
+        * replay/scripts/tests/fail-on-enum-type-missing-values.json:
+        * replay/scripts/tests/fail-on-missing-input-member-name.json:
+        * replay/scripts/tests/fail-on-missing-input-name.json:
+        * replay/scripts/tests/fail-on-missing-input-queue.json:
+        * replay/scripts/tests/fail-on-missing-type-mode.json:
+        * replay/scripts/tests/fail-on-missing-type-name.json:
+        * replay/scripts/tests/fail-on-no-inputs.json:
+        Removed, no longer required to be in a single file.
+
+        * replay/scripts/tests/fail-on-no-types.json:
+        Removed, no longer required to be in a single file.
+
+        * replay/scripts/tests/fail-on-unknown-input-queue.json:
+        * replay/scripts/tests/fail-on-unknown-member-type.json:
+        * replay/scripts/tests/fail-on-unknown-type-mode.json:
+        * replay/scripts/tests/generate-enum-encoding-helpers-with-guarded-values.json:
+        * replay/scripts/tests/generate-enum-encoding-helpers.json:
+        * replay/scripts/tests/generate-enum-with-guard.json:
+        Include enums that are and are not generated.
+
+        * replay/scripts/tests/generate-enums-with-same-base-name.json:
+        * replay/scripts/tests/generate-event-loop-shape-types.json:
+        * replay/scripts/tests/generate-input-with-guard.json:
+        * replay/scripts/tests/generate-input-with-vector-members.json:
+        * replay/scripts/tests/generate-inputs-with-flags.json:
+        * replay/scripts/tests/generate-memoized-type-modes.json:
+
 2015-01-20  Tomas Popela  <tpopela@redhat.com>
 
         [GTK] Cannot compile 2.7.3 on PowerPC machines
index 4612900..bc69cbf 100755 (executable)
@@ -86,9 +86,12 @@ for %%d in (
 echo Copying Web Replay generated headers as if they were private headers...\r
 xcopy /y "%DerivedSourcesDirectory%\JSReplayInputs.h" "%PrivateHeadersDirectory%" >NUL\r
 \r
+echo Copying Web Replay specification files as if they were private headers...\r
+xcopy /y /d ..\replay\*.json "%PrivateHeadersDirectory%" >NUL\r
+\r
 echo Copying builtins header as if it were a private header...\r
 xcopy /y "%DerivedSourcesDirectory%\JSCBuiltins.h" "%PrivateHeadersDirectory%" >NUL\r
-xcopy /y "%DerivedSourcesDirectory%\Bytecodes.h" "%PrivateHeadersDirectory%" >NUL
+xcopy /y "%DerivedSourcesDirectory%\Bytecodes.h" "%PrivateHeadersDirectory%" >NUL\r
 \r
 echo Copying resources...\r
 mkdir "%ResourcesDirectory%" 2>NUL\r
index 493966f..e79d7c1 100644 (file)
                C2FCAE1217A9C24E0034C735 /* BytecodeLivenessAnalysis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2FCAE0E17A9C24E0034C735 /* BytecodeLivenessAnalysis.cpp */; };
                C2FCAE1317A9C24E0034C735 /* BytecodeLivenessAnalysis.h in Headers */ = {isa = PBXBuildFile; fileRef = C2FCAE0F17A9C24E0034C735 /* BytecodeLivenessAnalysis.h */; settings = {ATTRIBUTES = (Private, ); }; };
                C2FE18A416BAEC4000AF3061 /* StructureRareData.h in Headers */ = {isa = PBXBuildFile; fileRef = C2FE18A316BAEC4000AF3061 /* StructureRareData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               C442CB251A6CDB8C005D3D7C /* JSInputs.json in Headers */ = {isa = PBXBuildFile; fileRef = 9928FF3D18AC4B1C00B8CF12 /* JSInputs.json */; settings = {ATTRIBUTES = (Private, ); }; };
                C4703CC0192844960013FBEA /* generate-inspector-protocol-bindings.py in Headers */ = {isa = PBXBuildFile; fileRef = C4703CBF192844960013FBEA /* generate-inspector-protocol-bindings.py */; settings = {ATTRIBUTES = (Private, ); }; };
                C4703CCE192844CC0013FBEA /* generate_js_backend_commands.py in Headers */ = {isa = PBXBuildFile; fileRef = C4703CC3192844CC0013FBEA /* generate_js_backend_commands.py */; settings = {ATTRIBUTES = (Private, ); }; };
                C4703CD5192844CC0013FBEA /* generator_templates.py in Headers */ = {isa = PBXBuildFile; fileRef = C4703CCA192844CC0013FBEA /* generator_templates.py */; settings = {ATTRIBUTES = (Private, ); }; };
                                0F6B1CB91861244C00845D97 /* ArityCheckMode.h in Headers */,
                                A1A009C11831A26E00CF8711 /* ARM64Assembler.h in Headers */,
                                86D3B2C410156BDE002865E7 /* ARMAssembler.h in Headers */,
+                               C442CB251A6CDB8C005D3D7C /* JSInputs.json in Headers */,
                                52678F911A04177C006A306D /* ControlFlowProfiler.h in Headers */,
                                52678F8F1A031009006A306D /* BasicBlockLocation.h in Headers */,
                                A5EA710E19F6DF810098F5EC /* InspectorAlternateBackendDispatchers.h in Headers */,
index 7394d94..fa5c004 100644 (file)
@@ -1,27 +1,49 @@
 {
     "types": {
         "Global": [
+            { "name": "bool", "mode": "SCALAR" },
             { "name": "double", "mode": "SCALAR" },
-            { "name": "uint64_t", "mode": "SCALAR" }
+            { "name": "uint32_t", "mode": "SCALAR", "description": "Unsigned 32-bit integer." },
+            { "name": "uint64_t", "mode": "SCALAR", "description": "Unsigned 64-bit integer." },
+            { "name": "int32_t", "mode": "SCALAR", "description": "Signed 32-bit integer." },
+            { "name": "int64_t", "mode": "SCALAR", "description": "Signed 64-bit integer." }
+        ],
+
+        "WTF": [
+            {
+                "name": "String", "mode": "HEAVY_SCALAR",
+                "header": "wtf/text/WTFString.h"
+            }
+        ],
+
+        "JavaScriptCore": [
+            {
+                "name": "InputQueue", "mode": "SCALAR", "storage": "uint8_t",
+                "flags": ["ENUM_CLASS"],
+                "values": ["EventLoopInput", "LoaderMemoizedData", "ScriptMemoizedData", "Count"],
+                "header": "replay/NondeterministicInput.h"
+            }
         ]
     },
 
-    "inputs": [
-        {
-            "name": "GetCurrentTime",
-            "description": "Supplies the system time to Date.now() and new Date().",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "currentTime", "type": "double" }
-            ]
-        },
-        {
-            "name": "SetRandomSeed",
-            "description": "Sets the PRNG seed used by Math.random().",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "randomSeed", "type": "uint64_t" }
-            ]
-        }
-    ]
+    "inputs": {
+        "JavaScriptCore": [
+            {
+                "name": "GetCurrentTime",
+                "description": "Supplies the system time to Date.now() and new Date().",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "currentTime", "type": "double" }
+                ]
+            },
+            {
+                "name": "SetRandomSeed",
+                "description": "Sets the PRNG seed used by Math.random().",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "randomSeed", "type": "uint64_t" }
+                ]
+            }
+        ]
+    }
 }
index db8f76b..d838ae5 100644 (file)
@@ -112,11 +112,13 @@ FRAMEWORK_CONFIG_MAP = {
     "WebCore": {
         "prefix": "Web",
         "namespace": "WebCore",
+        "exportMacro": "WEBCORE_EXPORT"
     },
     # Used for bindings tests.
     "Test": {
         "prefix": "Test",
         "namespace": "Test",
+        "exportMacro": "TEST_EXPORT_MACRO"
     }
 }
 
@@ -215,9 +217,10 @@ class InputQueues:
 
 
 class Input:
-    def __init__(self, name, description, queueString, flags, guard=None):
+    def __init__(self, name, description, framework, queueString, flags, guard=None):
         self.name = name
         self.description = description
+        self.framework = framework
         self.queue = InputQueue.fromString(queueString)
         self._flags = flags
         self.guard = guard
@@ -397,7 +400,7 @@ class VectorType(Type):
 
 
 class InputsModel:
-    def __init__(self, parsed_json):
+    def __init__(self):
         self.inputs = []
         self.types = []
 
@@ -406,8 +409,6 @@ class InputsModel:
         self.types_by_name = {}
         self.inputs_by_name = {}
 
-        self.parse_toplevel(parsed_json)
-
     def enum_types(self):
         _enums = filter(lambda x: x.is_enum() or x.is_enum_class(), self.types)
         return sorted(_enums, key=lambda _enum: _enum.type_name())
@@ -418,27 +419,33 @@ class InputsModel:
         else:
             return self.types_by_name.get(member.typeName)
 
-    def parse_toplevel(self, json):
-        check_for_required_properties(['types', 'inputs'], json, 'toplevel')
-        if not isinstance(json['types'], dict):
-            raise ParseException("Malformed specification: types is not a dict of framework->type list")
+    def parse_specification(self, json):
+        if 'types' in json:
+            if not isinstance(json['types'], dict):
+                raise ParseException("Malformed specification: types is not a dict of framework->type list")
+
+            for framework_name, type_list in json['types'].iteritems():
+                if not isinstance(type_list, list):
+                    raise ParseException("Malformed specification: type list for framework %s is not a list" % framework_name)
 
-        if not isinstance(json['inputs'], list):
-            raise ParseException("Malformed specification: inputs is not an array")
+                framework = Framework.fromString(framework_name)
+                for _type in type_list:
+                    self.parse_type_with_framework(_type, framework)
 
-        for type_framework_name, type_list in json['types'].iteritems():
-            if not isinstance(type_list, list):
-                raise ParseException("Malformed specification: type list for framework %s is not a list" % type_framework_name)
+        if 'inputs' in json:
+            if not isinstance(json['inputs'], dict):
+                raise ParseException("Malformed specification: inputs is not a dict of framework->input list")
 
-            for _type in type_list:
-                self.parse_type_with_framework_name(_type, type_framework_name)
+            for framework_name, input_list in json['inputs'].iteritems():
+                if not isinstance(input_list, list):
+                    raise ParseException("Malformed specification: input list for framework %s is not a list" % framework_name)
 
-        for val in json['inputs']:
-            self.parse_input(val)
+                framework = Framework.fromString(framework_name)
+                for _input in input_list:
+                    self.parse_input_with_framework(_input, framework)
 
-    def parse_type_with_framework_name(self, json, framework_name):
+    def parse_type_with_framework(self, json, framework):
         check_for_required_properties(['name', 'mode'], json, 'type')
-        framework = Framework.fromString(framework_name)
         if framework is not Frameworks.Global:
             check_for_required_properties(['header'], json, 'non-global type')
 
@@ -462,9 +469,9 @@ class InputsModel:
 
         self.types.append(_type)
 
-    def parse_input(self, json):
+    def parse_input_with_framework(self, json, framework):
         check_for_required_properties(['name', 'description', 'queue', 'members'], json, 'input')
-        _input = Input(json['name'], json['description'], json['queue'], json.get('flags', []), json.get('guard'))
+        _input = Input(json['name'], json['description'], framework, json['queue'], json.get('flags', []), json.get('guard'))
         if isinstance(json['members'], list):
             for member in json['members']:
                 check_for_required_properties(['name', 'type'], member, 'member')
@@ -563,6 +570,9 @@ class Generator:
     def setting(self, key, default=''):
         return self.target_framework.setting(key, GLOBAL_CONFIG.get(key, default))
 
+    def should_generate_item(self, item):
+        return item.framework is self.target_framework
+
     # This does not account for any filename mangling performed on behalf of the test harness.
     def output_filename(self, extension=None):
         components = []
@@ -587,6 +597,9 @@ class Generator:
         implementation_file.close()
 
     def generate_header(self):
+        enums_to_generate = filter(self.should_generate_item, self._model.enum_types())
+        inputs_to_generate = filter(self.should_generate_item, self._model.inputs)
+
         template_arguments = {
             'licenseBlock': self.generate_license(),
             'headerGuard': re.sub('[-./]', '_', self.output_filename() + ".h"),
@@ -596,17 +609,20 @@ class Generator:
             'inputsNamespace': self.target_framework.setting('namespace'),
             'includes': self.generate_includes(defaults=self.setting('headerIncludes')),
             'typeForwardDeclarations': self.generate_type_forward_declarations(),
-            'inputForwardDeclarations': "\n".join([wrap_with_guard("class %s;", _input.guard) % _input.name for _input in self._model.inputs]),
-            'inputClassDeclarations': "\n\n".join([self.generate_class_declaration(_input) for _input in self._model.inputs]),
-            'inputTraitDeclarations': "\n\n".join([self.generate_input_trait_declaration(_input) for _input in self._model.inputs]),
-            'inputTypeTraitDeclarations': "\n\n".join([self.generate_input_type_trait_declaration(_input) for _input in self._model.inputs]),
-            'enumTraitDeclarations': "\n\n".join([wrap_with_guard(self.generate_enum_trait_declaration(_type), _type.guard) for _type in self._model.enum_types()]),
+            'inputForwardDeclarations': "\n".join([wrap_with_guard("class %s;", _input.guard) % _input.name for _input in inputs_to_generate]),
+            'inputClassDeclarations': "\n\n".join([self.generate_class_declaration(_input) for _input in inputs_to_generate]),
+            'inputTraitDeclarations': "\n\n".join([self.generate_input_trait_declaration(_input) for _input in inputs_to_generate]),
+            'inputTypeTraitDeclarations': "\n\n".join([self.generate_input_type_trait_declaration(_input) for _input in inputs_to_generate]),
+            'enumTraitDeclarations': "\n\n".join([wrap_with_guard(self.generate_enum_trait_declaration(_type), _type.guard) for _type in enums_to_generate]),
             'forEachMacro': self.generate_for_each_macro(),
         }
 
         return Template(Templates.HeaderSkeleton).substitute(template_arguments)
 
     def generate_implementation(self):
+        enums_to_generate = filter(self.should_generate_item, self._model.enum_types())
+        inputs_to_generate = filter(self.should_generate_item, self._model.inputs)
+
         template_arguments = {
             'licenseBlock': self.generate_license(),
             'filename': self.output_filename(),
@@ -614,9 +630,9 @@ class Generator:
             'traitsNamespace': self.traits_framework.setting('namespace'),
             'inputsNamespace': self.target_framework.setting('namespace'),
             'includes': self.generate_includes(defaults=self.setting('implIncludes'), includes_for_types=True),
-            'inputClassImplementations': "\n\n".join([self.generate_class_implementation(_input) for _input in self._model.inputs]),
-            'inputTraitImplementations': "\n\n".join([self.generate_input_trait_implementation(_input) for _input in self._model.inputs]),
-            'enumTraitImplementations': "\n\n".join([wrap_with_guard(self.generate_enum_trait_implementation(_type), _type.guard) for _type in self._model.enum_types()]),
+            'inputClassImplementations': "\n\n".join([self.generate_class_implementation(_input) for _input in inputs_to_generate]),
+            'inputTraitImplementations': "\n\n".join([self.generate_input_trait_implementation(_input) for _input in inputs_to_generate]),
+            'enumTraitImplementations': "\n\n".join([wrap_with_guard(self.generate_enum_trait_implementation(_type), _type.guard) for _type in enums_to_generate]),
         }
 
         return Template(Templates.ImplementationSkeleton).substitute(template_arguments)
@@ -778,18 +794,26 @@ class Generator:
         return wrap_with_guard(Template(Templates.InputTypeTraitsDeclaration).substitute(template_arguments), _input.guard)
 
     def generate_enum_trait_declaration(self, _type):
+        decl_type = ['struct']
+        if len(self.setting('exportMacro')) > 0:
+            decl_type.append(self.setting('exportMacro'))
+
         should_qualify_type = _type.framework != self.traits_framework
         template = Templates.EnumTraitDeclaration if _type.is_enum() else Templates.EnumClassTraitDeclaration
         template_arguments = {
-            'enumName': _type.type_name(qualified=should_qualify_type),
+            'encodingTypeArgument': _type.encoding_type_argument(qualified=should_qualify_type),
+            'enumType': _type.type_name(qualified=should_qualify_type),
+            'structOrClass': " ".join(decl_type)
         }
         return Template(template).substitute(template_arguments)
 
     def generate_for_each_macro(self):
+        inputs_to_generate = filter(self.should_generate_item, self._model.inputs)
+
         macro_name = "%s_REPLAY_INPUT_NAMES_FOR_EACH" % self.setting('prefix').upper()
         lines = []
         lines.append("#define %s(macro) \\" % macro_name)
-        lines.extend(["    macro(%s) \\" % _input.name for _input in self._model.inputs])
+        lines.extend(["    macro(%s) \\" % _input.name for _input in inputs_to_generate])
         lines.append("    \\")
         lines.append("// end of %s" % macro_name)
         return "\n".join(lines)
@@ -869,7 +893,8 @@ class Generator:
             decodeLines.append(wrap_with_guard("\n".join(guardedLines), guard))
 
         template_arguments = {
-            'enumName': _type.type_name(qualified=should_qualify_type),
+            'encodingTypeArgument': _type.encoding_type_argument(qualified=should_qualify_type),
+            'enumType': _type.type_name(qualified=should_qualify_type),
             'encodeCases': "\n".join(encodeLines),
             'decodeCases': "\n".join(decodeLines)
         }
@@ -959,19 +984,29 @@ class Generator:
         return ", ".join([self.generate_member_move_expression(_member) for _member in _input.members])
 
 
-def generate_from_specification(input_filepath=None, output_prefix="", output_dirpath=None, framework_name=None, force_output=False):
-    try:
-        with open(input_filepath, "r") as input_file:
-            parsed_json = json.load(input_file)
-    except ValueError as e:
-        raise Exception("Error parsing valid JSON in file: " + input_filepath)
+def generate_from_specifications(input_filepaths=[], output_prefix="", output_dirpath=None, framework_name=None, force_output=False):
 
     if not framework_name in FRAMEWORK_CONFIG_MAP:
         raise ParseException("Unknown or unsupported framework name supplied: " + framework_name)
 
-    model = InputsModel(parsed_json)
+    if len(input_filepaths) == 0:
+        raise ParseException("Must provide at least one specification file, none were provided.")
+
+    def parse_json_from_file(input_filepath):
+        try:
+            with open(input_filepath, "r") as input_file:
+                return json.load(input_file)
+        except ValueError as e:
+            raise Exception("Error parsing valid JSON in file: " + input_filepath)
+
+    specifications = map(parse_json_from_file, input_filepaths)
+
+    model = InputsModel()
+    for spec in specifications:
+        model.parse_specification(spec)
+
     model.resolve_types()
-    generator = Generator(model, framework_name, input_filepath, output_prefix)
+    generator = Generator(model, framework_name, input_filepaths[0], output_prefix)
 
     generator.write_output_files(output_dirpath, force_output)
 
@@ -979,7 +1014,7 @@ def generate_from_specification(input_filepath=None, output_prefix="", output_di
 if __name__ == '__main__':
     allowed_framework_names = FRAMEWORK_CONFIG_MAP.keys()
 
-    cli_parser = optparse.OptionParser(usage="usage: %prog [options] <Inputs.json>")
+    cli_parser = optparse.OptionParser(usage="usage: %prog [options] <Inputs.json> [, <MoreInputs.json> ]")
     cli_parser.add_option("-o", "--outputDir", help="Directory where generated files should be written.")
     cli_parser.add_option("--framework", type="choice", choices=allowed_framework_names, help="The framework these inputs belong to.")  # JavaScriptCore, WebCore
     cli_parser.add_option("--force", action="store_true", help="Force output of generated scripts, even if nothing changed.")
@@ -989,8 +1024,6 @@ if __name__ == '__main__':
     options = None
 
     arg_options, arg_values = cli_parser.parse_args()
-    if (len(arg_values) < 1):
-        raise ParseException("At least one plain argument expected")
 
     if not arg_options.outputDir:
         raise ParseException("Missing output directory")
@@ -999,7 +1032,7 @@ if __name__ == '__main__':
         log.setLevel(logging.DEBUG)
 
     options = {
-        'input_filepath': arg_values[0],
+        'input_filepaths': arg_values,
         'output_dirpath': arg_options.outputDir,
         'output_prefix': os.path.basename(arg_values[0]) if arg_options.test else "",
         'framework_name': arg_options.framework,
@@ -1007,7 +1040,7 @@ if __name__ == '__main__':
     }
 
     try:
-        generate_from_specification(**options)
+        generate_from_specifications(**options)
     except (ParseException, TypecheckException) as e:
         if arg_options.test:
             log.error(e.message)
index a9bc652..6d8112b 100644 (file)
@@ -112,19 +112,19 @@ ${forEachMacro}
 SPECIALIZE_TYPE_TRAITS_END()""")
 
     EnumTraitDeclaration = (
-    """template<> struct EncodingTraits<${enumName}> {
-    typedef ${enumName} DecodedType;
+    """template<> ${structOrClass} EncodingTraits<${encodingTypeArgument}> {
+    typedef ${enumType} DecodedType;
 
-    static EncodedValue encodeValue(const ${enumName}& value);
-    static bool decodeValue(EncodedValue&, ${enumName}& value);
+    static EncodedValue encodeValue(const ${enumType}& value);
+    static bool decodeValue(EncodedValue&, ${enumType}& value);
 };""")
 
     EnumClassTraitDeclaration = (
-    """template<> struct EncodingTraits<${enumName}> {
-    typedef ${enumName} DecodedType;
+    """template<> ${structOrClass} EncodingTraits<${encodingTypeArgument}> {
+    typedef ${enumType} DecodedType;
 
-    static EncodedValue encodeValue(const ${enumName}& value);
-    static bool decodeValue(EncodedValue&, ${enumName}& value);
+    static EncodedValue encodeValue(const ${enumType}& value);
+    static bool decodeValue(EncodedValue&, ${enumType}& value);
 };""")
 
     InputClassDeclaration = (
@@ -178,7 +178,7 @@ ${decodeSteps}
 }""")
 
     EnumClassTraitImplementation = (
-    """EncodedValue EncodingTraits<${enumName}>::encodeValue(const ${enumName}& enumValue)
+    """EncodedValue EncodingTraits<${encodingTypeArgument}>::encodeValue(const ${enumType}& enumValue)
 {
     switch (enumValue) {
 ${encodeCases}
@@ -186,7 +186,7 @@ ${encodeCases}
     }
 }
 
-bool EncodingTraits<${enumName}>::decodeValue(EncodedValue& encodedValue, ${enumName}& enumValue)
+bool EncodingTraits<${encodingTypeArgument}>::decodeValue(EncodedValue& encodedValue, ${enumType}& enumValue)
 {
     String enumString = encodedValue.convertTo<String>();
 ${decodeCases}
@@ -203,14 +203,14 @@ ${decodeCases}
     }""")
 
     EnumTraitImplementation = (
-    """EncodedValue EncodingTraits<${enumName}>::encodeValue(const ${enumName}& enumValue)
+    """EncodedValue EncodingTraits<${encodingTypeArgument}>::encodeValue(const ${enumType}& enumValue)
 {
     EncodedValue encodedValue = EncodedValue::createArray();
 ${encodeCases}
     return encodedValue;
 }
 
-bool EncodingTraits<${enumName}>::decodeValue(EncodedValue& encodedValue, ${enumName}& enumValue)
+bool EncodingTraits<${encodingTypeArgument}>::decodeValue(EncodedValue& encodedValue, ${enumType}& enumValue)
 {
     Vector<String> enumStrings;
     if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings))
diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-no-inputs.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-no-inputs.json-error
deleted file mode 100644 (file)
index f95ace7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-ERROR: When parsing toplevel, required property missing: inputs
diff --git a/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-no-types.json-error b/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-no-types.json-error
deleted file mode 100644 (file)
index 6231c8d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-ERROR: When parsing toplevel, required property missing: types
index 30837ed..d5b1585 100644 (file)
@@ -68,80 +68,7 @@ bool InputTraits<Test::SavedMouseButton>::decode(EncodedValue& encodedValue, std
     input = std::make_unique<Test::SavedMouseButton>(button);
     return true;
 }
-EncodedValue EncodingTraits<WebCore::MouseButton>::encodeValue(const WebCore::MouseButton& enumValue)
-{
-    EncodedValue encodedValue = EncodedValue::createArray();
-    if (enumValue & WebCore::NoButton) {
-        encodedValue.append<String>(ASCIILiteral("NoButton"));
-        if (enumValue == WebCore::NoButton)
-            return encodedValue;
-    }
-    if (enumValue & WebCore::LeftButton) {
-        encodedValue.append<String>(ASCIILiteral("LeftButton"));
-        if (enumValue == WebCore::LeftButton)
-            return encodedValue;
-    }
-    if (enumValue & WebCore::MiddleButton) {
-        encodedValue.append<String>(ASCIILiteral("MiddleButton"));
-        if (enumValue == WebCore::MiddleButton)
-            return encodedValue;
-    }
-    if (enumValue & WebCore::RightButton) {
-        encodedValue.append<String>(ASCIILiteral("RightButton"));
-        if (enumValue == WebCore::RightButton)
-            return encodedValue;
-    }
-#if ENABLE(SIDE_BUTTONS)
-    if (enumValue & WebCore::LeftSideButton) {
-        encodedValue.append<String>(ASCIILiteral("LeftSideButton"));
-        if (enumValue == WebCore::LeftSideButton)
-            return encodedValue;
-    }
-    if (enumValue & WebCore::RightSideButton) {
-        encodedValue.append<String>(ASCIILiteral("RightSideButton"));
-        if (enumValue == WebCore::RightSideButton)
-            return encodedValue;
-    }
-#endif // ENABLE(SIDE_BUTTONS)
-#if PLATFORM(WINDOWS)
-    if (enumValue & WebCore::WindowsButton) {
-        encodedValue.append<String>(ASCIILiteral("WindowsButton"));
-        if (enumValue == WebCore::WindowsButton)
-            return encodedValue;
-    }
-#endif // PLATFORM(WINDOWS)
-    return encodedValue;
-}
-
-bool EncodingTraits<WebCore::MouseButton>::decodeValue(EncodedValue& encodedValue, WebCore::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<WebCore::MouseButton>(enumValue | WebCore::NoButton);
-        else if (enumString == "LeftButton")
-            enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::LeftButton);
-        else if (enumString == "MiddleButton")
-            enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::MiddleButton);
-        else if (enumString == "RightButton")
-            enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::RightButton);
-#if ENABLE(SIDE_BUTTONS)
-        if (enumString == "LeftSideButton")
-            enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::LeftSideButton);
-        else if (enumString == "RightSideButton")
-            enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::RightSideButton);
-#endif // ENABLE(SIDE_BUTTONS)
-#if PLATFORM(WINDOWS)
-        if (enumString == "WindowsButton")
-            enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::WindowsButton);
-#endif // PLATFORM(WINDOWS)
-    }
 
-    return true;
-}
 } // namespace JSC
 
 #endif // ENABLE(WEB_REPLAY)
index fb02fca..a9f0673 100644 (file)
@@ -44,25 +44,20 @@ class SavedMouseButton;
 } // namespace Test
 
 namespace JSC {
-template<> struct InputTraits<Test::SavedMouseButton> {
+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 EncodingTraits<WebCore::MouseButton> {
-    typedef WebCore::MouseButton DecodedType;
 
-    static EncodedValue encodeValue(const WebCore::MouseButton& value);
-    static bool decodeValue(EncodedValue&, WebCore::MouseButton& value);
-};
 } // namespace JSC
 
 namespace Test {
 class SavedMouseButton : public NondeterministicInput<SavedMouseButton> {
 public:
-    SavedMouseButton(MouseButton button);
+    TEST_EXPORT_MACRO SavedMouseButton(MouseButton button);
     virtual ~SavedMouseButton();
 
     MouseButton button() const { return m_button; }
index d9f2c1d..02df572 100644 (file)
@@ -32,9 +32,9 @@
 
 #if ENABLE(WEB_REPLAY)
 #include "InternalNamespaceImplIncludeDummy.h"
+#include "NondeterministicInput.h"
+#include "PlatformMouseEvent.h"
 #include <platform/ExternalNamespaceImplIncludeDummy.h>
-#include <platform/PlatformMouseEvent.h>
-#include <replay/NondeterministicInput.h>
 
 namespace Test {
 SavedMouseButton::SavedMouseButton(MouseButton button)
@@ -57,73 +57,73 @@ const String& InputTraits<Test::SavedMouseButton>::type()
 
 void InputTraits<Test::SavedMouseButton>::encode(EncodedValue& encodedValue, const Test::SavedMouseButton& input)
 {
-    encodedValue.put<WebCore::MouseButton>(ASCIILiteral("button"), input.button());
+    encodedValue.put<Test::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))
+    Test::MouseButton button;
+    if (!encodedValue.get<Test::MouseButton>(ASCIILiteral("button"), button))
         return false;
 
     input = std::make_unique<Test::SavedMouseButton>(button);
     return true;
 }
-EncodedValue EncodingTraits<InputQueue>::encodeValue(const InputQueue& enumValue)
+EncodedValue EncodingTraits<Test::InputQueue>::encodeValue(const Test::InputQueue& enumValue)
 {
     switch (enumValue) {
-    case InputQueue::EventLoopInput: return EncodedValue::createString("EventLoopInput");
-    case InputQueue::LoaderMemoizedData: return EncodedValue::createString("LoaderMemoizedData");
-    case InputQueue::ScriptMemoizedData: return EncodedValue::createString("ScriptMemoizedData");
+    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<InputQueue>::decodeValue(EncodedValue& encodedValue, InputQueue& enumValue)
+bool EncodingTraits<Test::InputQueue>::decodeValue(EncodedValue& encodedValue, Test::InputQueue& enumValue)
 {
     String enumString = encodedValue.convertTo<String>();
     if (enumString == "EventLoopInput") {
-        enumValue = InputQueue::EventLoopInput;
+        enumValue = Test::InputQueue::EventLoopInput;
         return true;
     }
     if (enumString == "LoaderMemoizedData") {
-        enumValue = InputQueue::LoaderMemoizedData;
+        enumValue = Test::InputQueue::LoaderMemoizedData;
         return true;
     }
     if (enumString == "ScriptMemoizedData") {
-        enumValue = InputQueue::ScriptMemoizedData;
+        enumValue = Test::InputQueue::ScriptMemoizedData;
         return true;
     }
     return false;
 }
 
-EncodedValue EncodingTraits<WebCore::MouseButton>::encodeValue(const WebCore::MouseButton& enumValue)
+EncodedValue EncodingTraits<Test::MouseButton>::encodeValue(const Test::MouseButton& enumValue)
 {
     EncodedValue encodedValue = EncodedValue::createArray();
-    if (enumValue & WebCore::NoButton) {
+    if (enumValue & Test::NoButton) {
         encodedValue.append<String>(ASCIILiteral("NoButton"));
-        if (enumValue == WebCore::NoButton)
+        if (enumValue == Test::NoButton)
             return encodedValue;
     }
-    if (enumValue & WebCore::LeftButton) {
+    if (enumValue & Test::LeftButton) {
         encodedValue.append<String>(ASCIILiteral("LeftButton"));
-        if (enumValue == WebCore::LeftButton)
+        if (enumValue == Test::LeftButton)
             return encodedValue;
     }
-    if (enumValue & WebCore::MiddleButton) {
+    if (enumValue & Test::MiddleButton) {
         encodedValue.append<String>(ASCIILiteral("MiddleButton"));
-        if (enumValue == WebCore::MiddleButton)
+        if (enumValue == Test::MiddleButton)
             return encodedValue;
     }
-    if (enumValue & WebCore::RightButton) {
+    if (enumValue & Test::RightButton) {
         encodedValue.append<String>(ASCIILiteral("RightButton"));
-        if (enumValue == WebCore::RightButton)
+        if (enumValue == Test::RightButton)
             return encodedValue;
     }
     return encodedValue;
 }
 
-bool EncodingTraits<WebCore::MouseButton>::decodeValue(EncodedValue& encodedValue, WebCore::MouseButton& enumValue)
+bool EncodingTraits<Test::MouseButton>::decodeValue(EncodedValue& encodedValue, Test::MouseButton& enumValue)
 {
     Vector<String> enumStrings;
     if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings))
@@ -131,45 +131,45 @@ bool EncodingTraits<WebCore::MouseButton>::decodeValue(EncodedValue& encodedValu
 
     for (const String& enumString : enumStrings) {
         if (enumString == "NoButton")
-            enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::NoButton);
+            enumValue = static_cast<Test::MouseButton>(enumValue | Test::NoButton);
         else if (enumString == "LeftButton")
-            enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::LeftButton);
+            enumValue = static_cast<Test::MouseButton>(enumValue | Test::LeftButton);
         else if (enumString == "MiddleButton")
-            enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::MiddleButton);
+            enumValue = static_cast<Test::MouseButton>(enumValue | Test::MiddleButton);
         else if (enumString == "RightButton")
-            enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::RightButton);
+            enumValue = static_cast<Test::MouseButton>(enumValue | Test::RightButton);
     }
 
     return true;
 }
 
-EncodedValue EncodingTraits<WebCore::PlatformEvent::Type>::encodeValue(const WebCore::PlatformEvent::Type& enumValue)
+EncodedValue EncodingTraits<Test::PlatformEvent::Type>::encodeValue(const Test::PlatformEvent::Type& enumValue)
 {
     EncodedValue encodedValue = EncodedValue::createArray();
-    if (enumValue & WebCore::PlatformEvent::Mouse) {
+    if (enumValue & Test::PlatformEvent::Mouse) {
         encodedValue.append<String>(ASCIILiteral("Mouse"));
-        if (enumValue == WebCore::PlatformEvent::Mouse)
+        if (enumValue == Test::PlatformEvent::Mouse)
             return encodedValue;
     }
-    if (enumValue & WebCore::PlatformEvent::Key) {
+    if (enumValue & Test::PlatformEvent::Key) {
         encodedValue.append<String>(ASCIILiteral("Key"));
-        if (enumValue == WebCore::PlatformEvent::Key)
+        if (enumValue == Test::PlatformEvent::Key)
             return encodedValue;
     }
-    if (enumValue & WebCore::PlatformEvent::Touch) {
+    if (enumValue & Test::PlatformEvent::Touch) {
         encodedValue.append<String>(ASCIILiteral("Touch"));
-        if (enumValue == WebCore::PlatformEvent::Touch)
+        if (enumValue == Test::PlatformEvent::Touch)
             return encodedValue;
     }
-    if (enumValue & WebCore::PlatformEvent::Wheel) {
+    if (enumValue & Test::PlatformEvent::Wheel) {
         encodedValue.append<String>(ASCIILiteral("Wheel"));
-        if (enumValue == WebCore::PlatformEvent::Wheel)
+        if (enumValue == Test::PlatformEvent::Wheel)
             return encodedValue;
     }
     return encodedValue;
 }
 
-bool EncodingTraits<WebCore::PlatformEvent::Type>::decodeValue(EncodedValue& encodedValue, WebCore::PlatformEvent::Type& enumValue)
+bool EncodingTraits<Test::PlatformEvent::Type>::decodeValue(EncodedValue& encodedValue, Test::PlatformEvent::Type& enumValue)
 {
     Vector<String> enumStrings;
     if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings))
@@ -177,13 +177,13 @@ bool EncodingTraits<WebCore::PlatformEvent::Type>::decodeValue(EncodedValue& enc
 
     for (const String& enumString : enumStrings) {
         if (enumString == "Mouse")
-            enumValue = static_cast<WebCore::PlatformEvent::Type>(enumValue | WebCore::PlatformEvent::Mouse);
+            enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Mouse);
         else if (enumString == "Key")
-            enumValue = static_cast<WebCore::PlatformEvent::Type>(enumValue | WebCore::PlatformEvent::Key);
+            enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Key);
         else if (enumString == "Touch")
-            enumValue = static_cast<WebCore::PlatformEvent::Type>(enumValue | WebCore::PlatformEvent::Touch);
+            enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Touch);
         else if (enumString == "Wheel")
-            enumValue = static_cast<WebCore::PlatformEvent::Type>(enumValue | WebCore::PlatformEvent::Wheel);
+            enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Wheel);
     }
 
     return true;
index 29ee8e7..d38cee7 100644 (file)
 
 #if ENABLE(WEB_REPLAY)
 #include "InternalNamespaceHeaderIncludeDummy.h"
+#include "PlatformEvent.h"
 #include <platform/ExternalNamespaceHeaderIncludeDummy.h>
-#include <platform/PlatformEvent.h>
 
-namespace WebCore {
+namespace Test {
 enum MouseButton : unsigned;
-}
-
-namespace JSC {
 enum class InputQueue;
 }
 
@@ -49,39 +46,39 @@ class SavedMouseButton;
 } // namespace Test
 
 namespace JSC {
-template<> struct InputTraits<Test::SavedMouseButton> {
+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 EncodingTraits<InputQueue> {
-    typedef InputQueue DecodedType;
+template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::InputQueue> {
+    typedef Test::InputQueue DecodedType;
 
-    static EncodedValue encodeValue(const InputQueue& value);
-    static bool decodeValue(EncodedValue&, InputQueue& value);
+    static EncodedValue encodeValue(const Test::InputQueue& value);
+    static bool decodeValue(EncodedValue&, Test::InputQueue& value);
 };
 
-template<> struct EncodingTraits<WebCore::MouseButton> {
-    typedef WebCore::MouseButton DecodedType;
+template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::MouseButton> {
+    typedef Test::MouseButton DecodedType;
 
-    static EncodedValue encodeValue(const WebCore::MouseButton& value);
-    static bool decodeValue(EncodedValue&, WebCore::MouseButton& value);
+    static EncodedValue encodeValue(const Test::MouseButton& value);
+    static bool decodeValue(EncodedValue&, Test::MouseButton& value);
 };
 
-template<> struct EncodingTraits<WebCore::PlatformEvent::Type> {
-    typedef WebCore::PlatformEvent::Type DecodedType;
+template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::PlatformEvent::Type> {
+    typedef Test::PlatformEvent::Type DecodedType;
 
-    static EncodedValue encodeValue(const WebCore::PlatformEvent::Type& value);
-    static bool decodeValue(EncodedValue&, WebCore::PlatformEvent::Type& value);
+    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:
-    SavedMouseButton(MouseButton button);
+    TEST_EXPORT_MACRO SavedMouseButton(MouseButton button);
     virtual ~SavedMouseButton();
 
     MouseButton button() const { return m_button; }
index df57171..0aa7820 100644 (file)
 
 #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)
+HandleWheelEvent::HandleWheelEvent(std::unique_ptr<PlatformWheelEvent> platformEvent, PlatformWheelPhase phase)
     : EventLoopInput<HandleWheelEvent>()
     , m_platformEvent(WTF::move(platformEvent))
+    , m_phase(phase)
 {
 }
 
@@ -57,6 +59,7 @@ const String& InputTraits<Test::HandleWheelEvent>::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)
@@ -65,22 +68,26 @@ bool InputTraits<Test::HandleWheelEvent>::decode(EncodedValue& encodedValue, std
     if (!encodedValue.get<WebCore::PlatformWheelEvent>(ASCIILiteral("platformEvent"), platformEvent))
         return false;
 
-    input = std::make_unique<Test::HandleWheelEvent>(WTF::move(platformEvent));
+    Test::PlatformWheelPhase phase;
+    if (!encodedValue.get<Test::PlatformWheelPhase>(ASCIILiteral("phase"), phase))
+        return false;
+
+    input = std::make_unique<Test::HandleWheelEvent>(WTF::move(platformEvent), phase);
     return true;
 }
 #if ENABLE(DUMMY_FEATURE)
-EncodedValue EncodingTraits<WebCore::PlatformWheelEventPhase>::encodeValue(const WebCore::PlatformWheelEventPhase& enumValue)
+EncodedValue EncodingTraits<Test::PlatformWheelPhase>::encodeValue(const Test::PlatformWheelPhase& enumValue)
 {
     EncodedValue encodedValue = EncodedValue::createArray();
-    if (enumValue & WebCore::PlatformWheelEventPhaseNone) {
+    if (enumValue & Test::PlatformWheelEventPhaseNone) {
         encodedValue.append<String>(ASCIILiteral("PlatformWheelEventPhaseNone"));
-        if (enumValue == WebCore::PlatformWheelEventPhaseNone)
+        if (enumValue == Test::PlatformWheelEventPhaseNone)
             return encodedValue;
     }
     return encodedValue;
 }
 
-bool EncodingTraits<WebCore::PlatformWheelEventPhase>::decodeValue(EncodedValue& encodedValue, WebCore::PlatformWheelEventPhase& enumValue)
+bool EncodingTraits<Test::PlatformWheelPhase>::decodeValue(EncodedValue& encodedValue, Test::PlatformWheelPhase& enumValue)
 {
     Vector<String> enumStrings;
     if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings))
@@ -88,7 +95,7 @@ bool EncodingTraits<WebCore::PlatformWheelEventPhase>::decodeValue(EncodedValue&
 
     for (const String& enumString : enumStrings) {
         if (enumString == "PlatformWheelEventPhaseNone")
-            enumValue = static_cast<WebCore::PlatformWheelEventPhase>(enumValue | WebCore::PlatformWheelEventPhaseNone);
+            enumValue = static_cast<Test::PlatformWheelPhase>(enumValue | Test::PlatformWheelEventPhaseNone);
     }
 
     return true;
index 644612f..3302f58 100644 (file)
 #include "InternalNamespaceHeaderIncludeDummy.h"
 #include <platform/ExternalNamespaceHeaderIncludeDummy.h>
 
+namespace Test {
+enum PlatformWheelPhase : uint64_t;
+}
+
 namespace WebCore {
 class PlatformWheelEvent;
-enum PlatformWheelEventPhase : uint64_t;
 }
 
 
@@ -45,7 +48,7 @@ class HandleWheelEvent;
 } // namespace Test
 
 namespace JSC {
-template<> struct InputTraits<Test::HandleWheelEvent> {
+template<> struct TEST_EXPORT_MACRO InputTraits<Test::HandleWheelEvent> {
     static InputQueue queue() { return InputQueue::EventLoopInput; }
     static const String& type();
 
@@ -53,11 +56,11 @@ template<> struct InputTraits<Test::HandleWheelEvent> {
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::HandleWheelEvent>&);
 };
 #if ENABLE(DUMMY_FEATURE)
-template<> struct EncodingTraits<WebCore::PlatformWheelEventPhase> {
-    typedef WebCore::PlatformWheelEventPhase DecodedType;
+template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::PlatformWheelPhase> {
+    typedef Test::PlatformWheelPhase DecodedType;
 
-    static EncodedValue encodeValue(const WebCore::PlatformWheelEventPhase& value);
-    static bool decodeValue(EncodedValue&, WebCore::PlatformWheelEventPhase& value);
+    static EncodedValue encodeValue(const Test::PlatformWheelPhase& value);
+    static bool decodeValue(EncodedValue&, Test::PlatformWheelPhase& value);
 };
 #endif // ENABLE(DUMMY_FEATURE)
 } // namespace JSC
@@ -65,14 +68,16 @@ template<> struct EncodingTraits<WebCore::PlatformWheelEventPhase> {
 namespace Test {
 class HandleWheelEvent : public EventLoopInput<HandleWheelEvent> {
 public:
-    HandleWheelEvent(std::unique_ptr<PlatformWheelEvent> platformEvent);
+    TEST_EXPORT_MACRO HandleWheelEvent(std::unique_ptr<PlatformWheelEvent> platformEvent, PlatformWheelPhase phase);
     virtual ~HandleWheelEvent();
 
     // EventLoopInput API
     virtual void dispatch(ReplayController&) override 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
 
index b7bab8b..a19644f 100644 (file)
@@ -60,8 +60,8 @@ void InputTraits<Test::FormCombo>::encode(EncodedValue& encodedValue, const Test
 {
     encodedValue.put<PlatformEvent1::Type>(ASCIILiteral("eventType1"), input.eventType1());
     encodedValue.put<PlatformEvent2::Type>(ASCIILiteral("eventType2"), input.eventType2());
-    encodedValue.put<WebCore::FormData1::Type>(ASCIILiteral("formType1"), input.formType1());
-    encodedValue.put<WebCore::FormData2::Type>(ASCIILiteral("formType2"), input.formType2());
+    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)
@@ -74,34 +74,34 @@ bool InputTraits<Test::FormCombo>::decode(EncodedValue& encodedValue, std::uniqu
     if (!encodedValue.get<PlatformEvent2::Type>(ASCIILiteral("eventType2"), eventType2))
         return false;
 
-    WebCore::FormData1::Type formType1;
-    if (!encodedValue.get<WebCore::FormData1::Type>(ASCIILiteral("formType1"), formType1))
+    Test::FormData1::Type formType1;
+    if (!encodedValue.get<Test::FormData1::Type>(ASCIILiteral("formType1"), formType1))
         return false;
 
-    WebCore::FormData2::Type formType2;
-    if (!encodedValue.get<WebCore::FormData2::Type>(ASCIILiteral("formType2"), formType2))
+    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<WebCore::FormData1::Type>::encodeValue(const WebCore::FormData1::Type& enumValue)
+EncodedValue EncodingTraits<Test::FormData1::Type>::encodeValue(const Test::FormData1::Type& enumValue)
 {
     EncodedValue encodedValue = EncodedValue::createArray();
-    if (enumValue & WebCore::FormData1::Text) {
+    if (enumValue & Test::FormData1::Text) {
         encodedValue.append<String>(ASCIILiteral("Text"));
-        if (enumValue == WebCore::FormData1::Text)
+        if (enumValue == Test::FormData1::Text)
             return encodedValue;
     }
-    if (enumValue & WebCore::FormData1::Blob) {
+    if (enumValue & Test::FormData1::Blob) {
         encodedValue.append<String>(ASCIILiteral("Blob"));
-        if (enumValue == WebCore::FormData1::Blob)
+        if (enumValue == Test::FormData1::Blob)
             return encodedValue;
     }
     return encodedValue;
 }
 
-bool EncodingTraits<WebCore::FormData1::Type>::decodeValue(EncodedValue& encodedValue, WebCore::FormData1::Type& enumValue)
+bool EncodingTraits<Test::FormData1::Type>::decodeValue(EncodedValue& encodedValue, Test::FormData1::Type& enumValue)
 {
     Vector<String> enumStrings;
     if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings))
@@ -109,87 +109,32 @@ bool EncodingTraits<WebCore::FormData1::Type>::decodeValue(EncodedValue& encoded
 
     for (const String& enumString : enumStrings) {
         if (enumString == "Text")
-            enumValue = static_cast<WebCore::FormData1::Type>(enumValue | WebCore::FormData1::Text);
+            enumValue = static_cast<Test::FormData1::Type>(enumValue | Test::FormData1::Text);
         else if (enumString == "Blob")
-            enumValue = static_cast<WebCore::FormData1::Type>(enumValue | WebCore::FormData1::Blob);
+            enumValue = static_cast<Test::FormData1::Type>(enumValue | Test::FormData1::Blob);
     }
 
     return true;
 }
 
-EncodedValue EncodingTraits<WebCore::FormData2::Type>::encodeValue(const WebCore::FormData2::Type& enumValue)
+EncodedValue EncodingTraits<Test::FormData2::Type>::encodeValue(const Test::FormData2::Type& enumValue)
 {
     switch (enumValue) {
-    case WebCore::FormData2::Type::Text: return EncodedValue::createString("Text");
-    case WebCore::FormData2::Type::Blob: return EncodedValue::createString("Blob");
+    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<WebCore::FormData2::Type>::decodeValue(EncodedValue& encodedValue, WebCore::FormData2::Type& enumValue)
+bool EncodingTraits<Test::FormData2::Type>::decodeValue(EncodedValue& encodedValue, Test::FormData2::Type& enumValue)
 {
     String enumString = encodedValue.convertTo<String>();
     if (enumString == "Text") {
-        enumValue = WebCore::FormData2::Type::Text;
+        enumValue = Test::FormData2::Type::Text;
         return true;
     }
     if (enumString == "Blob") {
-        enumValue = WebCore::FormData2::Type::Blob;
-        return true;
-    }
-    return false;
-}
-
-EncodedValue EncodingTraits<PlatformEvent1::Type>::encodeValue(const PlatformEvent1::Type& enumValue)
-{
-    EncodedValue encodedValue = EncodedValue::createArray();
-    if (enumValue & PlatformEvent1::Mouse) {
-        encodedValue.append<String>(ASCIILiteral("Mouse"));
-        if (enumValue == PlatformEvent1::Mouse)
-            return encodedValue;
-    }
-    if (enumValue & PlatformEvent1::Keyboard) {
-        encodedValue.append<String>(ASCIILiteral("Keyboard"));
-        if (enumValue == PlatformEvent1::Keyboard)
-            return encodedValue;
-    }
-    return encodedValue;
-}
-
-bool EncodingTraits<PlatformEvent1::Type>::decodeValue(EncodedValue& encodedValue, PlatformEvent1::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<PlatformEvent1::Type>(enumValue | PlatformEvent1::Mouse);
-        else if (enumString == "Keyboard")
-            enumValue = static_cast<PlatformEvent1::Type>(enumValue | PlatformEvent1::Keyboard);
-    }
-
-    return true;
-}
-
-EncodedValue EncodingTraits<PlatformEvent2::Type>::encodeValue(const PlatformEvent2::Type& enumValue)
-{
-    switch (enumValue) {
-    case PlatformEvent2::Type::Mouse: return EncodedValue::createString("Mouse");
-    case PlatformEvent2::Type::Keyboard: return EncodedValue::createString("Keyboard");
-    default: ASSERT_NOT_REACHED(); return EncodedValue::createString("Error!");
-    }
-}
-
-bool EncodingTraits<PlatformEvent2::Type>::decodeValue(EncodedValue& encodedValue, PlatformEvent2::Type& enumValue)
-{
-    String enumString = encodedValue.convertTo<String>();
-    if (enumString == "Mouse") {
-        enumValue = PlatformEvent2::Type::Mouse;
-        return true;
-    }
-    if (enumString == "Keyboard") {
-        enumValue = PlatformEvent2::Type::Keyboard;
+        enumValue = Test::FormData2::Type::Blob;
         return true;
     }
     return false;
index d656556..fd3b398 100644 (file)
 #define generate_enums_with_same_base_name_json_TestReplayInputs_h
 
 #if ENABLE(WEB_REPLAY)
+#include "FormData1.h"
+#include "FormData2.h"
 #include "InternalNamespaceHeaderIncludeDummy.h"
 #include <platform/ExternalNamespaceHeaderIncludeDummy.h>
-#include <replay/FormData1.h>
-#include <replay/FormData2.h>
 #include <replay/PlatformEvent.h>
 
 
@@ -44,46 +44,32 @@ class FormCombo;
 } // namespace Test
 
 namespace JSC {
-template<> struct InputTraits<Test::FormCombo> {
+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 EncodingTraits<WebCore::FormData1::Type> {
-    typedef WebCore::FormData1::Type DecodedType;
+template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::FormData1::Type> {
+    typedef Test::FormData1::Type DecodedType;
 
-    static EncodedValue encodeValue(const WebCore::FormData1::Type& value);
-    static bool decodeValue(EncodedValue&, WebCore::FormData1::Type& value);
+    static EncodedValue encodeValue(const Test::FormData1::Type& value);
+    static bool decodeValue(EncodedValue&, Test::FormData1::Type& value);
 };
 
-template<> struct EncodingTraits<WebCore::FormData2::Type> {
-    typedef WebCore::FormData2::Type DecodedType;
+template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::FormData2::Type> {
+    typedef Test::FormData2::Type DecodedType;
 
-    static EncodedValue encodeValue(const WebCore::FormData2::Type& value);
-    static bool decodeValue(EncodedValue&, WebCore::FormData2::Type& value);
-};
-
-template<> struct EncodingTraits<PlatformEvent1::Type> {
-    typedef PlatformEvent1::Type DecodedType;
-
-    static EncodedValue encodeValue(const PlatformEvent1::Type& value);
-    static bool decodeValue(EncodedValue&, PlatformEvent1::Type& value);
-};
-
-template<> struct EncodingTraits<PlatformEvent2::Type> {
-    typedef PlatformEvent2::Type DecodedType;
-
-    static EncodedValue encodeValue(const PlatformEvent2::Type& value);
-    static bool decodeValue(EncodedValue&, PlatformEvent2::Type& value);
+    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:
-    FormCombo(PlatformEvent1::Type eventType1, PlatformEvent2::Type eventType2, FormData1::Type formType1, FormData2::Type formType2);
+    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; }
index e4d2ba1..e0967cc 100644 (file)
@@ -45,7 +45,7 @@ class SetRandomSeed;
 
 namespace JSC {
 #if ENABLE(DUMMY_FEATURE)
-template<> struct InputTraits<Test::GetCurrentTime> {
+template<> struct TEST_EXPORT_MACRO InputTraits<Test::GetCurrentTime> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
     static const String& type();
 
@@ -54,7 +54,7 @@ template<> struct InputTraits<Test::GetCurrentTime> {
 };
 #endif // ENABLE(DUMMY_FEATURE)
 
-template<> struct InputTraits<Test::SetRandomSeed> {
+template<> struct TEST_EXPORT_MACRO InputTraits<Test::SetRandomSeed> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
     static const String& type();
 
@@ -68,7 +68,7 @@ namespace Test {
 #if ENABLE(DUMMY_FEATURE)
 class GetCurrentTime : public NondeterministicInput<GetCurrentTime> {
 public:
-    GetCurrentTime(double currentTime);
+    TEST_EXPORT_MACRO GetCurrentTime(double currentTime);
     virtual ~GetCurrentTime();
 
     double currentTime() const { return m_currentTime; }
@@ -79,7 +79,7 @@ private:
 
 class SetRandomSeed : public NondeterministicInput<SetRandomSeed> {
 public:
-    SetRandomSeed(uint64_t randomSeed);
+    TEST_EXPORT_MACRO SetRandomSeed(uint64_t randomSeed);
     virtual ~SetRandomSeed();
 
     uint64_t randomSeed() const { return m_randomSeed; }
index 1728598..467c010 100644 (file)
@@ -46,7 +46,7 @@ class SavedHistory;
 } // namespace Test
 
 namespace JSC {
-template<> struct InputTraits<Test::ArrayOfThings> {
+template<> struct TEST_EXPORT_MACRO InputTraits<Test::ArrayOfThings> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
     static const String& type();
 
@@ -54,7 +54,7 @@ template<> struct InputTraits<Test::ArrayOfThings> {
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::ArrayOfThings>&);
 };
 
-template<> struct InputTraits<Test::SavedHistory> {
+template<> struct TEST_EXPORT_MACRO InputTraits<Test::SavedHistory> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
     static const String& type();
 
@@ -67,7 +67,7 @@ template<> struct InputTraits<Test::SavedHistory> {
 namespace Test {
 class ArrayOfThings : public NondeterministicInput<ArrayOfThings> {
 public:
-    ArrayOfThings(Vector<double>& doubles, Vector<JSThing>& jsthings, Vector<WebThing>& webthings);
+    TEST_EXPORT_MACRO ArrayOfThings(Vector<double>& doubles, Vector<JSThing>& jsthings, Vector<WebThing>& webthings);
     virtual ~ArrayOfThings();
 
     const Vector<double>& doubles() const { return m_doubles; }
@@ -81,7 +81,7 @@ private:
 
 class SavedHistory : public NondeterministicInput<SavedHistory> {
 public:
-    SavedHistory(Vector<RefPtr<HistoryItem>>& entries);
+    TEST_EXPORT_MACRO SavedHistory(Vector<RefPtr<HistoryItem>>& entries);
     virtual ~SavedHistory();
 
     const Vector<RefPtr<HistoryItem>>& entries() const { return m_entries; }
index 371e7f5..7b98bfc 100644 (file)
@@ -42,7 +42,7 @@ class ScalarInput2;
 } // namespace Test
 
 namespace JSC {
-template<> struct InputTraits<Test::ScalarInput1> {
+template<> struct TEST_EXPORT_MACRO InputTraits<Test::ScalarInput1> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
     static const String& type();
 
@@ -50,7 +50,7 @@ template<> struct InputTraits<Test::ScalarInput1> {
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::ScalarInput1>&);
 };
 
-template<> struct InputTraits<Test::ScalarInput2> {
+template<> struct TEST_EXPORT_MACRO InputTraits<Test::ScalarInput2> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
     static const String& type();
 
@@ -63,7 +63,7 @@ template<> struct InputTraits<Test::ScalarInput2> {
 namespace Test {
 class ScalarInput1 : public NondeterministicInput<ScalarInput1> {
 public:
-    ScalarInput1(ScalarType data);
+    TEST_EXPORT_MACRO ScalarInput1(ScalarType data);
     virtual ~ScalarInput1();
 
     ScalarType data() const { return m_data; }
@@ -73,7 +73,7 @@ private:
 
 class ScalarInput2 : public NondeterministicInput<ScalarInput2> {
 public:
-    ScalarInput2(ScalarType data);
+    TEST_EXPORT_MACRO ScalarInput2(ScalarType data);
     virtual ~ScalarInput2();
 
     ScalarType data() const { return m_data; }
index ae19e52..d77bcff 100644 (file)
@@ -42,7 +42,7 @@ class MapInput;
 } // namespace Test
 
 namespace JSC {
-template<> struct InputTraits<Test::ScalarInput> {
+template<> struct TEST_EXPORT_MACRO InputTraits<Test::ScalarInput> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
     static const String& type();
 
@@ -50,7 +50,7 @@ template<> struct InputTraits<Test::ScalarInput> {
     static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::ScalarInput>&);
 };
 
-template<> struct InputTraits<Test::MapInput> {
+template<> struct TEST_EXPORT_MACRO InputTraits<Test::MapInput> {
     static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
     static const String& type();
 
@@ -63,7 +63,7 @@ template<> struct InputTraits<Test::MapInput> {
 namespace Test {
 class ScalarInput : public NondeterministicInput<ScalarInput> {
 public:
-    ScalarInput(ScalarType data);
+    TEST_EXPORT_MACRO ScalarInput(ScalarType data);
     virtual ~ScalarInput();
 
     ScalarType data() const { return m_data; }
@@ -73,7 +73,7 @@ private:
 
 class MapInput : public NondeterministicInput<MapInput> {
 public:
-    MapInput(std::unique_ptr<MapType> data);
+    TEST_EXPORT_MACRO MapInput(std::unique_ptr<MapType> data);
     virtual ~MapInput();
 
     const MapType& data() const { return *m_data; }
index 03b68e4..31d2c43 100644 (file)
@@ -1,6 +1,6 @@
 {
     "types": {
-        "WebCore": [
+        "Test": [
             {
                 "name": "MouseButton", "mode": "SCALAR",
                 "flags": ["ENUM"],
         ]
     },
 
-    "inputs": [
-        {
-            "name": "SavedMouseButton",
-            "description": "Supplies a mouse button enum value.",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "button", "type": "MouseButton" }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "SavedMouseButton",
+                "description": "Supplies a mouse button enum value.",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "button", "type": "MouseButton" }
+                ]
+            }
+        ]
+    }
 }
index 6ebb61c..089e699 100644 (file)
         ]
     },
 
-    "inputs": [
-        {
-            "name": "FormCombo",
-            "description": "Combines an event type and form data type.",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "eventType", "type": "PlatformEvent::Type" }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "FormCombo",
+                "description": "Combines an event type and form data type.",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "eventType", "type": "PlatformEvent::Type" }
+                ]
+            }
+        ]
+    }
 }
index 0ce634a..91c84a2 100644 (file)
@@ -6,22 +6,24 @@
         ]
     },
 
-    "inputs": [
-        {
-            "name": "GetCurrentTime",
-            "description": "Supplies the system time to Date.now() and new Date().",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "currentTime", "type": "double" }
-            ]
-        },
-        {
-            "name": "GetCurrentTime",
-            "description": "Sets the PRNG seed used by Math.random().",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "randomSeed", "type": "uint64_t" }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "GetCurrentTime",
+                "description": "Supplies the system time to Date.now() and new Date().",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "currentTime", "type": "double" }
+                ]
+            },
+            {
+                "name": "GetCurrentTime",
+                "description": "Sets the PRNG seed used by Math.random().",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "randomSeed", "type": "uint64_t" }
+                ]
+            }
+        ]
+    }
 }
index cca473e..fc4b5d9 100644 (file)
@@ -6,17 +6,19 @@
         ]
     },
 
-    "inputs": [
-        {
-            "name": "SetRandomSeed",
-            "description": "Sets the PRNG seed used by Math.random().",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                {
-                    "name": "randomSeed",
-                    "type": "uint64_t"
-                }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "SetRandomSeed",
+                "description": "Sets the PRNG seed used by Math.random().",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    {
+                        "name": "randomSeed",
+                        "type": "uint64_t"
+                    }
+                ]
+            }
+        ]
+    }
 }
index 21b5d1d..5bd20bd 100644 (file)
@@ -8,14 +8,16 @@
         ]
     },
 
-    "inputs": [
-        {
-            "name": "SavedMouseButton",
-            "description": "Supplies a mouse button enum value.",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "currentTime", "type": "MouseButton" }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "SavedMouseButton",
+                "description": "Supplies a mouse button enum value.",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "currentTime", "type": "MouseButton" }
+                ]
+            }
+        ]
+    }
 }
index ec16e06..b924aaf 100644 (file)
@@ -5,16 +5,18 @@
         ]
     },
 
-    "inputs": [
-        {
-            "name": "GetCurrentTime",
-            "description": "Supplies the system time to Date.now() and new Date().",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                {
-                    "type": "double"
-                }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "GetCurrentTime",
+                "description": "Supplies the system time to Date.now() and new Date().",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    {
+                        "type": "double"
+                    }
+                ]
+            }
+        ]
+    }
 }
index feed8b8..aa80980 100644 (file)
@@ -5,16 +5,18 @@
         ]
     },
 
-    "inputs": [
-        {
-            "description": "Supplies the system time to Date.now() and new Date().",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                {
-                    "name": "currentTime",
-                    "type": "double"
-                }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "description": "Supplies the system time to Date.now() and new Date().",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    {
+                        "name": "currentTime",
+                        "type": "double"
+                    }
+                ]
+            }
+        ]
+    }
 }
index 56422c3..8136dfb 100644 (file)
@@ -5,16 +5,18 @@
         ]
     },
 
-    "inputs": [
-        {
-            "name": "GetCurrentTime",
-            "description": "Supplies the system time to Date.now() and new Date().",
-            "members": [
-                {
-                    "name": "currentTime",
-                    "type": "double"
-                }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "GetCurrentTime",
+                "description": "Supplies the system time to Date.now() and new Date().",
+                "members": [
+                    {
+                        "name": "currentTime",
+                        "type": "double"
+                    }
+                ]
+            }
+        ]
+    }
 }
index a5d37b7..3ed6d1e 100644 (file)
@@ -5,17 +5,19 @@
         ]
     },
 
-    "inputs": [
-        {
-            "name": "GetCurrentTime",
-            "description": "Supplies the system time to Date.now() and new Date().",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                {
-                    "name": "currentTime",
-                    "type": "double"
-                }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "GetCurrentTime",
+                "description": "Supplies the system time to Date.now() and new Date().",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    {
+                        "name": "currentTime",
+                        "type": "double"
+                    }
+                ]
+            }
+        ]
+    }
 }
index 017495e..01b1c08 100644 (file)
@@ -5,17 +5,19 @@
         ]
     },
 
-    "inputs": [
-        {
-            "name": "GetCurrentTime",
-            "description": "Supplies the system time to Date.now() and new Date().",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                {
-                    "name": "currentTime",
-                    "type": "double"
-                }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "GetCurrentTime",
+                "description": "Supplies the system time to Date.now() and new Date().",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    {
+                        "name": "currentTime",
+                        "type": "double"
+                    }
+                ]
+            }
+        ]
+    }
 }
diff --git a/Source/JavaScriptCore/replay/scripts/tests/fail-on-no-inputs.json b/Source/JavaScriptCore/replay/scripts/tests/fail-on-no-inputs.json
deleted file mode 100644 (file)
index 91f31fd..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-    "types": {
-        "Global": [
-            { "name": "double", "mode": "SCALAR" }
-        ]
-    }
-}
diff --git a/Source/JavaScriptCore/replay/scripts/tests/fail-on-no-types.json b/Source/JavaScriptCore/replay/scripts/tests/fail-on-no-types.json
deleted file mode 100644 (file)
index e260c55..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-    "inputs": [
-        {
-            "name": "GetCurrentTime",
-            "description": "Supplies the system time to Date.now() and new Date().",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                {
-                    "name": "currentTime",
-                    "type": "double"
-                }
-            ]
-        }
-    ]
- }
index 6f40f81..cd15f06 100644 (file)
@@ -5,17 +5,19 @@
         ]
     },
 
-    "inputs": [
-        {
-            "name": "GetCurrentTime",
-            "description": "Supplies the system time to Date.now() and new Date().",
-            "queue": "SCRIPT_MEOIZED",
-            "members": [
-                {
-                    "name": "currentTime",
-                    "type": "double"
-                }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "GetCurrentTime",
+                "description": "Supplies the system time to Date.now() and new Date().",
+                "queue": "SCRIPT_MEOIZED",
+                "members": [
+                    {
+                        "name": "currentTime",
+                        "type": "double"
+                    }
+                ]
+            }
+        ]
+    }
 }
index 5a00d12..8a23057 100644 (file)
@@ -5,17 +5,19 @@
         ]
     },
 
-    "inputs": [
-        {
-            "name": "SetRandomSeed",
-            "description": "Sets the PRNG seed used by Math.random().",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                {
-                    "name": "randomSeed",
-                    "type": "double"
-                }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "SetRandomSeed",
+                "description": "Sets the PRNG seed used by Math.random().",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    {
+                        "name": "randomSeed",
+                        "type": "double"
+                    }
+                ]
+            }
+        ]
+    }
 }
index 03655cb..b553bef 100644 (file)
@@ -5,17 +5,19 @@
         ]
     },
 
-    "inputs": [
-        {
-            "name": "GetCurrentTime",
-            "description": "Supplies the system time to Date.now() and new Date().",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                {
-                    "name": "currentTime",
-                    "type": "double"
-                }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "GetCurrentTime",
+                "description": "Supplies the system time to Date.now() and new Date().",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    {
+                        "name": "currentTime",
+                        "type": "double"
+                    }
+                ]
+            }
+        ]
+    }
 }
index 40e4943..9b2017d 100644 (file)
         ]
     },
 
-    "inputs": [
-        {
-            "name": "SavedMouseButton",
-            "description": "Supplies a mouse button enum value.",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "button", "type": "MouseButton" }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "SavedMouseButton",
+                "description": "Supplies a mouse button enum value.",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "button", "type": "MouseButton" }
+                ]
+            }
+        ]
+    }
 }
index 8df1772..ef2e163 100644 (file)
@@ -1,14 +1,12 @@
 {
     "types": {
-        "JavaScriptCore": [
+        "Test": [
             {
                 "name": "InputQueue", "mode": "SCALAR",
                 "flags": ["ENUM_CLASS"],
                 "values": ["EventLoopInput", "LoaderMemoizedData", "ScriptMemoizedData"],
                 "header": "replay/NondeterministicInput.h"
-            }
-        ],
-        "WebCore": [
+            },
             {
                 "name": "MouseButton", "mode": "SCALAR", "storage": "unsigned",
                 "flags": ["ENUM"],
         ]
     },
 
-    "inputs": [
-        {
-            "name": "SavedMouseButton",
-            "description": "Supplies a mouse button enum value.",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "button", "type": "MouseButton" }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "SavedMouseButton",
+                "description": "Supplies a mouse button enum value.",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "button", "type": "MouseButton" }
+                ]
+            }
+        ]
+    }
 }
index 680e320..20ea359 100644 (file)
@@ -7,9 +7,11 @@
             {
                 "name": "PlatformWheelEvent", "mode": "OWNED",
                 "header": "platform/PlatformWheelEvent.h"
-            },
+            }
+        ],
+        "Test": [
             {
-                "name": "PlatformWheelEventPhase", "mode": "SCALAR", "storage": "uint64_t",
+                "name": "PlatformWheelPhase", "mode": "SCALAR", "storage": "uint64_t",
                 "flags": ["ENUM"],
                 "guard": "ENABLE(DUMMY_FEATURE)",
                 "values": ["PlatformWheelEventPhaseNone"],
         ]
     },
 
-    "inputs": [
-        {
-            "name": "HandleWheelEvent",
-            "description": "",
-            "queue": "EVENT_LOOP",
-            "members": [
-                { "name": "platformEvent", "type": "PlatformWheelEvent" }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "HandleWheelEvent",
+                "description": "",
+                "queue": "EVENT_LOOP",
+                "members": [
+                    { "name": "platformEvent", "type": "PlatformWheelEvent" },
+                    { "name": "phase", "type": "PlatformWheelPhase" }
+                ]
+            }
+        ]
+    }
 }
index d77bdb6..699439d 100644 (file)
@@ -16,7 +16,7 @@
                 "header": "replay/PlatformEvent.h"
             }
         ],
-        "WebCore": [
+        "Test": [
             {
                 "name": "Type", "mode": "SCALAR", "storage": "uint64_t",
                 "enclosing_class": "FormData1",
         ]
     },
 
-    "inputs": [
-        {
-            "name": "FormCombo",
-            "description": "Combines an event type and form data type.",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "eventType1", "type": "PlatformEvent1::Type" },
-                { "name": "eventType2", "type": "PlatformEvent2::Type" },
-                { "name": "formType1", "type": "FormData1::Type" },
-                { "name": "formType2", "type": "FormData2::Type" }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "FormCombo",
+                "description": "Combines an event type and form data type.",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "eventType1", "type": "PlatformEvent1::Type" },
+                    { "name": "eventType2", "type": "PlatformEvent2::Type" },
+                    { "name": "formType1", "type": "FormData1::Type" },
+                    { "name": "formType2", "type": "FormData2::Type" }
+                ]
+            }
+        ]
+    }
 }
index 5f6a24e..93b16bf 100644 (file)
@@ -7,30 +7,32 @@
         ]
     },
 
-    "inputs": [
-        {
-            "name": "ScalarInput",
-            "description": "",
-            "queue": "EVENT_LOOP",
-            "members": [
-                { "name": "data", "type": "ScalarType" }
-            ]
-        },
-        {
-            "name": "MapInput",
-            "description": "",
-            "queue": "EVENT_LOOP",
-            "members": [
-                { "name": "data", "type": "MapType" }
-            ]
-        },
-        {
-            "name": "SharedMapInput",
-            "description": "",
-            "queue": "EVENT_LOOP",
-            "members": [
-                { "name": "data", "type": "SharedMapType" }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "ScalarInput",
+                "description": "",
+                "queue": "EVENT_LOOP",
+                "members": [
+                    { "name": "data", "type": "ScalarType" }
+                ]
+            },
+            {
+                "name": "MapInput",
+                "description": "",
+                "queue": "EVENT_LOOP",
+                "members": [
+                    { "name": "data", "type": "MapType" }
+                ]
+            },
+            {
+                "name": "SharedMapInput",
+                "description": "",
+                "queue": "EVENT_LOOP",
+                "members": [
+                    { "name": "data", "type": "SharedMapType" }
+                ]
+            }
+        ]
+    }
 }
index 67846d7..75cd504 100644 (file)
@@ -6,23 +6,25 @@
         ]
     },
 
-    "inputs": [
-        {
-            "name": "GetCurrentTime",
-            "description": "Supplies the system time to Date.now() and new Date().",
-            "queue": "SCRIPT_MEMOIZED",
-            "guard": "ENABLE(DUMMY_FEATURE)",
-            "members": [
-                { "name": "currentTime", "type": "double" }
-            ]
-        },
-        {
-            "name": "SetRandomSeed",
-            "description": "Sets the PRNG seed used by Math.random().",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                {"name": "randomSeed", "type": "uint64_t" }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "GetCurrentTime",
+                "description": "Supplies the system time to Date.now() and new Date().",
+                "queue": "SCRIPT_MEMOIZED",
+                "guard": "ENABLE(DUMMY_FEATURE)",
+                "members": [
+                    { "name": "currentTime", "type": "double" }
+                ]
+            },
+            {
+                "name": "SetRandomSeed",
+                "description": "Sets the PRNG seed used by Math.random().",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    {"name": "randomSeed", "type": "uint64_t" }
+                ]
+            }
+        ]
+    }
 }
index 076e54b..eabd072 100644 (file)
         ]
     },
 
-    "inputs": [
-        {
-            "name": "ArrayOfThings",
-            "description": "Supplies arrays of things.",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "doubles", "type": "double", "flags": ["VECTOR"] },
-                { "name": "jsthings", "type": "JSThing", "flags": ["VECTOR"] },
-                { "name": "webthings", "type": "WebThing", "flags": ["VECTOR"] }
-            ]
-        },
-        {
-            "name": "SavedHistory",
-            "description": "Save history items.",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "entries", "type": "HistoryItem", "flags": ["VECTOR"] }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "ArrayOfThings",
+                "description": "Supplies arrays of things.",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "doubles", "type": "double", "flags": ["VECTOR"] },
+                    { "name": "jsthings", "type": "JSThing", "flags": ["VECTOR"] },
+                    { "name": "webthings", "type": "WebThing", "flags": ["VECTOR"] }
+                ]
+            },
+            {
+                "name": "SavedHistory",
+                "description": "Save history items.",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "entries", "type": "HistoryItem", "flags": ["VECTOR"] }
+                ]
+            }
+        ]
+    }
 }
index f5069e6..3f49cc1 100644 (file)
@@ -5,23 +5,25 @@
         ]
     },
 
-    "inputs": [
-        {
-            "name": "ScalarInput1",
-            "description": "",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "data", "type": "ScalarType" }
-            ]
-        },
-        {
-            "name": "ScalarInput2",
-            "description": "",
-            "queue": "SCRIPT_MEMOIZED",
-            "flags": ["CREATE_FROM_PAGE"],
-            "members": [
-                { "name": "data", "type": "ScalarType" }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "ScalarInput1",
+                "description": "",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "data", "type": "ScalarType" }
+                ]
+            },
+            {
+                "name": "ScalarInput2",
+                "description": "",
+                "queue": "SCRIPT_MEMOIZED",
+                "flags": ["CREATE_FROM_PAGE"],
+                "members": [
+                    { "name": "data", "type": "ScalarType" }
+                ]
+            }
+        ]
+    }
 }
index 80e50d6..0d66bd8 100644 (file)
@@ -6,22 +6,24 @@
         ]
     },
 
-    "inputs": [
-        {
-            "name": "ScalarInput",
-            "description": "",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "data", "type": "ScalarType" }
-            ]
-        },
-        {
-            "name": "MapInput",
-            "description": "",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "data", "type": "MapType" }
-            ]
-        }
-    ]
+    "inputs": {
+        "Test": [
+            {
+                "name": "ScalarInput",
+                "description": "",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "data", "type": "ScalarType" }
+                ]
+            },
+            {
+                "name": "MapInput",
+                "description": "",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "data", "type": "MapType" }
+                ]
+            }
+        ]
+    }
 }
index 71768ee..5bc3dd8 100644 (file)
@@ -1,3 +1,15 @@
+2015-01-19  Brian J. Burg  <burg@cs.washington.edu>
+
+        Web Replay: code generator should take supplemental specifications and allow cross-framework references
+        https://bugs.webkit.org/show_bug.cgi?id=136312
+
+        Reviewed by Joseph Pecoraro.
+
+        Changes covered by existing input generator tests.
+
+        * DerivedSources.make: Add JSInputs.json as supplemental specification.
+        * replay/WebInputs.json: Moved common types to JSInputs.json.
+
 2015-01-20  Csaba Osztrogon├íc  <ossy@webkit.org>
 
         Fix unused-const-variable warning in RenderLayerCompositor.cpp
index 97dc67d..7c1ac7d 100644 (file)
@@ -1162,6 +1162,7 @@ INPUT_GENERATOR_SCRIPTS = \
 
 INPUT_GENERATOR_SPECIFICATIONS = \
        $(WebCore)/replay/WebInputs.json \
+       $(WebReplayScripts)/JSInputs.json \
 #
 
 all : WebReplayInputs.h
index 61f5b61..b17231e 100644 (file)
@@ -1,30 +1,5 @@
 {
     "types": {
-        "Global": [
-            { "name": "bool", "mode": "SCALAR" },
-            { "name": "double", "mode": "SCALAR" },
-            { "name": "uint32_t", "mode": "SCALAR", "description": "Unsigned 32-bit integer." },
-            { "name": "uint64_t", "mode": "SCALAR", "description": "Unsigned 64-bit integer." },
-            { "name": "int32_t", "mode": "SCALAR", "description": "Signed 32-bit integer." },
-            { "name": "int64_t", "mode": "SCALAR", "description": "Signed 64-bit integer." }
-        ],
-
-        "WTF": [
-            {
-                "name": "String", "mode": "HEAVY_SCALAR",
-                "header": "wtf/text/WTFString.h"
-            }
-        ],
-
-        "JavaScriptCore": [
-            {
-                "name": "InputQueue", "mode": "SCALAR", "storage": "uint8_t",
-                "flags": ["ENUM_CLASS"],
-                "values": ["EventLoopInput", "LoaderMemoizedData", "ScriptMemoizedData", "Count"],
-                "header": "replay/NondeterministicInput.h"
-            }
-        ],
-
         "WebCore": [
             {
                 "name": "EncodedCType", "mode": "SCALAR", "storage": "uint8_t",
         ]
     },
 
-    "inputs": [
-        {
-            "name": "BeginSegmentSentinel",
-            "description": "A sentinel input to signal the start of a segment.",
-            "queue": "EVENT_LOOP",
-            "members": [ ]
-        },
-        {
-            "name": "DocumentLastModifiedDate",
-            "description": "A fallback value used for the document's last modified date if the Last-Modified header can't be found or used.",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "fallbackValue", "type": "double" }
-            ]
-        },
-        {
-            "name": "EndSegmentSentinel",
-            "description": "A sentinel input to signal the end of a segment.",
-            "queue": "EVENT_LOOP",
-            "members": [ ]
-        },
-        {
-            "name": "HandleMouseMove",
-            "description": "The embedder signalled a mouse move event.",
-            "queue": "EVENT_LOOP",
-            "members": [
-                { "name": "platformEvent", "type": "PlatformMouseEvent" },
-                { "name": "scrollbarTargeted", "type": "bool" }
-            ]
-        },
-        {
-            "name": "HandleMousePress",
-            "description": "The embedder signalled a mouse press event.",
-            "queue": "EVENT_LOOP",
-            "members": [
-                { "name": "platformEvent", "type": "PlatformMouseEvent" }
-            ]
-        },
-        {
-            "name": "HandleMouseRelease",
-            "description": "The embedder signalled a mouse release event.",
-            "queue": "EVENT_LOOP",
-            "members": [
-                { "name": "platformEvent", "type": "PlatformMouseEvent" }
-            ]
-        },
-        {
-            "name": "HandleKeyPress",
-            "description": "The embedder signalled a key press event.",
-            "queue": "EVENT_LOOP",
-            "members": [
-                { "name": "platformEvent", "type": "PlatformKeyboardEvent" }
-            ]
-        },
-        {
-            "name": "HandleWheelEvent",
-            "description": "The embedder signalled a mouse wheel event.",
-            "queue": "EVENT_LOOP",
-            "members": [
-                { "name": "platformEvent", "type": "PlatformWheelEvent" }
-            ]
-        },
-        {
-            "name": "InitialNavigation",
-            "description": "Initiate the initial main frame navigation.",
-            "queue": "EVENT_LOOP",
-            "flags": ["HIDDEN", "CREATE_FROM_PAGE"],
-            "members": [
-                { "name": "securityOrigin", "type": "SecurityOrigin" },
-                { "name": "url", "type": "URL" },
-                { "name": "referrer", "type": "String" }
-            ]
-        },
-        {
-            "name": "FetchPluginData",
-            "description": "Plugin data was requested through DOMPluginArray or DOMMimeTypeArray.",
-            "queue": "SCRIPT_MEMOIZED",
-            "members": [
-                { "name": "pluginData", "type": "PluginData" }
-            ]
-        },
-        {
-            "name": "LogicalScrollPage",
-            "description": "The embedder signalled a logical scroll event.",
-            "queue": "EVENT_LOOP",
-            "members": [
-                { "name": "direction", "type": "ScrollLogicalDirection" },
-                { "name": "granularity", "type": "ScrollGranularity" }
-            ]
-        },
-        {
-            "name": "ScrollPage",
-            "description": "The embedder signalled a scroll event.",
-            "queue": "EVENT_LOOP",
-            "members": [
-                { "name": "direction", "type": "ScrollDirection" },
-                { "name": "granularity", "type": "ScrollGranularity" }
-            ]
-        }
-    ]
+    "inputs": {
+        "WebCore": [
+            {
+                "name": "BeginSegmentSentinel",
+                "description": "A sentinel input to signal the start of a segment.",
+                "queue": "EVENT_LOOP",
+                "members": [ ]
+            },
+            {
+                "name": "DocumentLastModifiedDate",
+                "description": "A fallback value used for the document's last modified date if the Last-Modified header can't be found or used.",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "fallbackValue", "type": "double" }
+                ]
+            },
+            {
+                "name": "EndSegmentSentinel",
+                "description": "A sentinel input to signal the end of a segment.",
+                "queue": "EVENT_LOOP",
+                "members": [ ]
+            },
+            {
+                "name": "HandleMouseMove",
+                "description": "The embedder signalled a mouse move event.",
+                "queue": "EVENT_LOOP",
+                "members": [
+                    { "name": "platformEvent", "type": "PlatformMouseEvent" },
+                    { "name": "scrollbarTargeted", "type": "bool" }
+                ]
+            },
+            {
+                "name": "HandleMousePress",
+                "description": "The embedder signalled a mouse press event.",
+                "queue": "EVENT_LOOP",
+                "members": [
+                    { "name": "platformEvent", "type": "PlatformMouseEvent" }
+                ]
+            },
+            {
+                "name": "HandleMouseRelease",
+                "description": "The embedder signalled a mouse release event.",
+                "queue": "EVENT_LOOP",
+                "members": [
+                    { "name": "platformEvent", "type": "PlatformMouseEvent" }
+                ]
+            },
+            {
+                "name": "HandleKeyPress",
+                "description": "The embedder signalled a key press event.",
+                "queue": "EVENT_LOOP",
+                "members": [
+                    { "name": "platformEvent", "type": "PlatformKeyboardEvent" }
+                ]
+            },
+            {
+                "name": "HandleWheelEvent",
+                "description": "The embedder signalled a mouse wheel event.",
+                "queue": "EVENT_LOOP",
+                "members": [
+                    { "name": "platformEvent", "type": "PlatformWheelEvent" }
+                ]
+            },
+            {
+                "name": "InitialNavigation",
+                "description": "Initiate the initial main frame navigation.",
+                "queue": "EVENT_LOOP",
+                "flags": ["HIDDEN", "CREATE_FROM_PAGE"],
+                "members": [
+                    { "name": "securityOrigin", "type": "SecurityOrigin" },
+                    { "name": "url", "type": "URL" },
+                    { "name": "referrer", "type": "String" }
+                ]
+            },
+            {
+                "name": "FetchPluginData",
+                "description": "Plugin data was requested through DOMPluginArray or DOMMimeTypeArray.",
+                "queue": "SCRIPT_MEMOIZED",
+                "members": [
+                    { "name": "pluginData", "type": "PluginData" }
+                ]
+            },
+            {
+                "name": "LogicalScrollPage",
+                "description": "The embedder signalled a logical scroll event.",
+                "queue": "EVENT_LOOP",
+                "members": [
+                    { "name": "direction", "type": "ScrollLogicalDirection" },
+                    { "name": "granularity", "type": "ScrollGranularity" }
+                ]
+            },
+            {
+                "name": "ScrollPage",
+                "description": "The embedder signalled a scroll event.",
+                "queue": "EVENT_LOOP",
+                "members": [
+                    { "name": "direction", "type": "ScrollDirection" },
+                    { "name": "granularity", "type": "ScrollGranularity" }
+                ]
+            }
+        ]
+    }
 }