Changeset 178714 in webkit
- Timestamp:
- Jan 20, 2015 8:52:18 AM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 4 deleted
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r178708 r178714 1 2015-01-19 Brian J. Burg <burg@cs.washington.edu> 2 3 Web Replay: code generator should take supplemental specifications and allow cross-framework references 4 https://bugs.webkit.org/show_bug.cgi?id=136312 5 6 Reviewed by Joseph Pecoraro. 7 8 Some types are shared between replay inputs from different frameworks. 9 Previously, these type declarations were duplicated in every input 10 specification file in which they were used. This caused some type encoding 11 traits to be emitted twice if used from WebCore inputs and WebKit2 inputs. 12 13 This patch teaches the replay inputs code generator to accept multiple 14 input specification files. Inputs can freely reference types from other 15 frameworks without duplicating declarations. 16 17 On the code generation side, the model could contain types and inputs from 18 frameworks that are not the target framework. Only generate code for the 19 target framework. 20 21 To properly generate cross-framework type encoding traits, use 22 Type.encoding_type_argument in more places, and add the export macro for WebCore 23 and the Test framework. 24 25 Adjust some tests so that enum coverage is preserved by moving the enum types 26 into "Test" (the target framework for tests). 27 28 * JavaScriptCore.vcxproj/copy-files.cmd: 29 For Windows, copy over JSInputs.json as if it were a private header. 30 31 * JavaScriptCore.xcodeproj/project.pbxproj: Make JSInputs.json a private header. 32 * replay/JSInputs.json: 33 Put all primitive types and WTF types in this specification file. 34 35 * replay/scripts/CodeGeneratorReplayInputs.py: 36 (Input.__init__): 37 (InputsModel.__init__): Keep track of the input's framework. 38 (InputsModel.parse_specification): Parse the framework here. Adjust to new format, 39 and allow either types or inputs to be missing from a single file. 40 41 (InputsModel.parse_type_with_framework): 42 (InputsModel.parse_input_with_framework): 43 (Generator.should_generate_item): Added helper method. 44 (Generator.generate_header): Filter inputs to generate. 45 (Generator.generate_implementation): Filter inputs to generate. 46 (Generator.generate_enum_trait_declaration): Filter enums to generate. 47 Add WEBCORE_EXPORT macro to enum encoding traits. 48 49 (Generator.generate_for_each_macro): Filter inputs to generate. 50 (Generator.generate_enum_trait_implementation): Filter enums to generate. 51 (generate_from_specifications): Added. 52 (generate_from_specifications.parse_json_from_file): 53 (InputsModel.parse_toplevel): Deleted. 54 (InputsModel.parse_type_with_framework_name): Deleted. 55 (InputsModel.parse_input): Deleted. 56 (generate_from_specification): Deleted. 57 * replay/scripts/CodeGeneratorReplayInputsTemplates.py: 58 * replay/scripts/tests/expected/fail-on-no-inputs.json-error: Removed. 59 * replay/scripts/tests/expected/fail-on-no-types.json-error: Removed. 60 * replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp: 61 * replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h: 62 * replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp: 63 * replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h: 64 * replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.cpp: 65 * replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.h: 66 * replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp: 67 * replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.h: 68 * replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h: 69 * replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h: 70 * replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h: 71 * replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h: 72 * replay/scripts/tests/fail-on-c-style-enum-no-storage.json: 73 * replay/scripts/tests/fail-on-duplicate-enum-type.json: 74 * replay/scripts/tests/fail-on-duplicate-input-names.json: 75 * replay/scripts/tests/fail-on-duplicate-type-names.json: 76 * replay/scripts/tests/fail-on-enum-type-missing-values.json: 77 * replay/scripts/tests/fail-on-missing-input-member-name.json: 78 * replay/scripts/tests/fail-on-missing-input-name.json: 79 * replay/scripts/tests/fail-on-missing-input-queue.json: 80 * replay/scripts/tests/fail-on-missing-type-mode.json: 81 * replay/scripts/tests/fail-on-missing-type-name.json: 82 * replay/scripts/tests/fail-on-no-inputs.json: 83 Removed, no longer required to be in a single file. 84 85 * replay/scripts/tests/fail-on-no-types.json: 86 Removed, no longer required to be in a single file. 87 88 * replay/scripts/tests/fail-on-unknown-input-queue.json: 89 * replay/scripts/tests/fail-on-unknown-member-type.json: 90 * replay/scripts/tests/fail-on-unknown-type-mode.json: 91 * replay/scripts/tests/generate-enum-encoding-helpers-with-guarded-values.json: 92 * replay/scripts/tests/generate-enum-encoding-helpers.json: 93 * replay/scripts/tests/generate-enum-with-guard.json: 94 Include enums that are and are not generated. 95 96 * replay/scripts/tests/generate-enums-with-same-base-name.json: 97 * replay/scripts/tests/generate-event-loop-shape-types.json: 98 * replay/scripts/tests/generate-input-with-guard.json: 99 * replay/scripts/tests/generate-input-with-vector-members.json: 100 * replay/scripts/tests/generate-inputs-with-flags.json: 101 * replay/scripts/tests/generate-memoized-type-modes.json: 102 1 103 2015-01-20 Tomas Popela <tpopela@redhat.com> 2 104 -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/copy-files.cmd
r174893 r178714 87 87 xcopy /y "%DerivedSourcesDirectory%\JSReplayInputs.h" "%PrivateHeadersDirectory%" >NUL 88 88 89 echo Copying Web Replay specification files as if they were private headers... 90 xcopy /y /d ..\replay\*.json "%PrivateHeadersDirectory%" >NUL 91 89 92 echo Copying builtins header as if it were a private header... 90 93 xcopy /y "%DerivedSourcesDirectory%\JSCBuiltins.h" "%PrivateHeadersDirectory%" >NUL -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r178696 r178714 1576 1576 C2FCAE1317A9C24E0034C735 /* BytecodeLivenessAnalysis.h in Headers */ = {isa = PBXBuildFile; fileRef = C2FCAE0F17A9C24E0034C735 /* BytecodeLivenessAnalysis.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1577 1577 C2FE18A416BAEC4000AF3061 /* StructureRareData.h in Headers */ = {isa = PBXBuildFile; fileRef = C2FE18A316BAEC4000AF3061 /* StructureRareData.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1578 C442CB251A6CDB8C005D3D7C /* JSInputs.json in Headers */ = {isa = PBXBuildFile; fileRef = 9928FF3D18AC4B1C00B8CF12 /* JSInputs.json */; settings = {ATTRIBUTES = (Private, ); }; }; 1578 1579 C4703CC0192844960013FBEA /* generate-inspector-protocol-bindings.py in Headers */ = {isa = PBXBuildFile; fileRef = C4703CBF192844960013FBEA /* generate-inspector-protocol-bindings.py */; settings = {ATTRIBUTES = (Private, ); }; }; 1579 1580 C4703CCE192844CC0013FBEA /* generate_js_backend_commands.py in Headers */ = {isa = PBXBuildFile; fileRef = C4703CC3192844CC0013FBEA /* generate_js_backend_commands.py */; settings = {ATTRIBUTES = (Private, ); }; }; … … 5387 5388 A1A009C11831A26E00CF8711 /* ARM64Assembler.h in Headers */, 5388 5389 86D3B2C410156BDE002865E7 /* ARMAssembler.h in Headers */, 5390 C442CB251A6CDB8C005D3D7C /* JSInputs.json in Headers */, 5389 5391 52678F911A04177C006A306D /* ControlFlowProfiler.h in Headers */, 5390 5392 52678F8F1A031009006A306D /* BasicBlockLocation.h in Headers */, -
trunk/Source/JavaScriptCore/replay/JSInputs.json
r164007 r178714 2 2 "types": { 3 3 "Global": [ 4 { "name": "bool", "mode": "SCALAR" }, 4 5 { "name": "double", "mode": "SCALAR" }, 5 { "name": "uint64_t", "mode": "SCALAR" } 6 { "name": "uint32_t", "mode": "SCALAR", "description": "Unsigned 32-bit integer." }, 7 { "name": "uint64_t", "mode": "SCALAR", "description": "Unsigned 64-bit integer." }, 8 { "name": "int32_t", "mode": "SCALAR", "description": "Signed 32-bit integer." }, 9 { "name": "int64_t", "mode": "SCALAR", "description": "Signed 64-bit integer." } 10 ], 11 12 "WTF": [ 13 { 14 "name": "String", "mode": "HEAVY_SCALAR", 15 "header": "wtf/text/WTFString.h" 16 } 17 ], 18 19 "JavaScriptCore": [ 20 { 21 "name": "InputQueue", "mode": "SCALAR", "storage": "uint8_t", 22 "flags": ["ENUM_CLASS"], 23 "values": ["EventLoopInput", "LoaderMemoizedData", "ScriptMemoizedData", "Count"], 24 "header": "replay/NondeterministicInput.h" 25 } 6 26 ] 7 27 }, 8 28 9 "inputs": [ 10 { 11 "name": "GetCurrentTime", 12 "description": "Supplies the system time to Date.now() and new Date().", 13 "queue": "SCRIPT_MEMOIZED", 14 "members": [ 15 { "name": "currentTime", "type": "double" } 16 ] 17 }, 18 { 19 "name": "SetRandomSeed", 20 "description": "Sets the PRNG seed used by Math.random().", 21 "queue": "SCRIPT_MEMOIZED", 22 "members": [ 23 { "name": "randomSeed", "type": "uint64_t" } 24 ] 25 } 26 ] 29 "inputs": { 30 "JavaScriptCore": [ 31 { 32 "name": "GetCurrentTime", 33 "description": "Supplies the system time to Date.now() and new Date().", 34 "queue": "SCRIPT_MEMOIZED", 35 "members": [ 36 { "name": "currentTime", "type": "double" } 37 ] 38 }, 39 { 40 "name": "SetRandomSeed", 41 "description": "Sets the PRNG seed used by Math.random().", 42 "queue": "SCRIPT_MEMOIZED", 43 "members": [ 44 { "name": "randomSeed", "type": "uint64_t" } 45 ] 46 } 47 ] 48 } 27 49 } -
trunk/Source/JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py
r178668 r178714 113 113 "prefix": "Web", 114 114 "namespace": "WebCore", 115 "exportMacro": "WEBCORE_EXPORT" 115 116 }, 116 117 # Used for bindings tests. … … 118 119 "prefix": "Test", 119 120 "namespace": "Test", 121 "exportMacro": "TEST_EXPORT_MACRO" 120 122 } 121 123 } … … 216 218 217 219 class Input: 218 def __init__(self, name, description, queueString, flags, guard=None):220 def __init__(self, name, description, framework, queueString, flags, guard=None): 219 221 self.name = name 220 222 self.description = description 223 self.framework = framework 221 224 self.queue = InputQueue.fromString(queueString) 222 225 self._flags = flags … … 398 401 399 402 class InputsModel: 400 def __init__(self , parsed_json):403 def __init__(self): 401 404 self.inputs = [] 402 405 self.types = [] … … 406 409 self.types_by_name = {} 407 410 self.inputs_by_name = {} 408 409 self.parse_toplevel(parsed_json)410 411 411 412 def enum_types(self): … … 419 420 return self.types_by_name.get(member.typeName) 420 421 421 def parse_toplevel(self, json): 422 check_for_required_properties(['types', 'inputs'], json, 'toplevel') 423 if not isinstance(json['types'], dict): 424 raise ParseException("Malformed specification: types is not a dict of framework->type list") 425 426 if not isinstance(json['inputs'], list): 427 raise ParseException("Malformed specification: inputs is not an array") 428 429 for type_framework_name, type_list in json['types'].iteritems(): 430 if not isinstance(type_list, list): 431 raise ParseException("Malformed specification: type list for framework %s is not a list" % type_framework_name) 432 433 for _type in type_list: 434 self.parse_type_with_framework_name(_type, type_framework_name) 435 436 for val in json['inputs']: 437 self.parse_input(val) 438 439 def parse_type_with_framework_name(self, json, framework_name): 422 def parse_specification(self, json): 423 if 'types' in json: 424 if not isinstance(json['types'], dict): 425 raise ParseException("Malformed specification: types is not a dict of framework->type list") 426 427 for framework_name, type_list in json['types'].iteritems(): 428 if not isinstance(type_list, list): 429 raise ParseException("Malformed specification: type list for framework %s is not a list" % framework_name) 430 431 framework = Framework.fromString(framework_name) 432 for _type in type_list: 433 self.parse_type_with_framework(_type, framework) 434 435 if 'inputs' in json: 436 if not isinstance(json['inputs'], dict): 437 raise ParseException("Malformed specification: inputs is not a dict of framework->input list") 438 439 for framework_name, input_list in json['inputs'].iteritems(): 440 if not isinstance(input_list, list): 441 raise ParseException("Malformed specification: input list for framework %s is not a list" % framework_name) 442 443 framework = Framework.fromString(framework_name) 444 for _input in input_list: 445 self.parse_input_with_framework(_input, framework) 446 447 def parse_type_with_framework(self, json, framework): 440 448 check_for_required_properties(['name', 'mode'], json, 'type') 441 framework = Framework.fromString(framework_name)442 449 if framework is not Frameworks.Global: 443 450 check_for_required_properties(['header'], json, 'non-global type') … … 463 470 self.types.append(_type) 464 471 465 def parse_input (self, json):472 def parse_input_with_framework(self, json, framework): 466 473 check_for_required_properties(['name', 'description', 'queue', 'members'], json, 'input') 467 _input = Input(json['name'], json['description'], json['queue'], json.get('flags', []), json.get('guard'))474 _input = Input(json['name'], json['description'], framework, json['queue'], json.get('flags', []), json.get('guard')) 468 475 if isinstance(json['members'], list): 469 476 for member in json['members']: … … 564 571 return self.target_framework.setting(key, GLOBAL_CONFIG.get(key, default)) 565 572 573 def should_generate_item(self, item): 574 return item.framework is self.target_framework 575 566 576 # This does not account for any filename mangling performed on behalf of the test harness. 567 577 def output_filename(self, extension=None): … … 588 598 589 599 def generate_header(self): 600 enums_to_generate = filter(self.should_generate_item, self._model.enum_types()) 601 inputs_to_generate = filter(self.should_generate_item, self._model.inputs) 602 590 603 template_arguments = { 591 604 'licenseBlock': self.generate_license(), … … 597 610 'includes': self.generate_includes(defaults=self.setting('headerIncludes')), 598 611 'typeForwardDeclarations': self.generate_type_forward_declarations(), 599 'inputForwardDeclarations': "\n".join([wrap_with_guard("class %s;", _input.guard) % _input.name for _input in self._model.inputs]),600 'inputClassDeclarations': "\n\n".join([self.generate_class_declaration(_input) for _input in self._model.inputs]),601 'inputTraitDeclarations': "\n\n".join([self.generate_input_trait_declaration(_input) for _input in self._model.inputs]),602 'inputTypeTraitDeclarations': "\n\n".join([self.generate_input_type_trait_declaration(_input) for _input in self._model.inputs]),603 'enumTraitDeclarations': "\n\n".join([wrap_with_guard(self.generate_enum_trait_declaration(_type), _type.guard) for _type in self._model.enum_types()]),612 'inputForwardDeclarations': "\n".join([wrap_with_guard("class %s;", _input.guard) % _input.name for _input in inputs_to_generate]), 613 'inputClassDeclarations': "\n\n".join([self.generate_class_declaration(_input) for _input in inputs_to_generate]), 614 'inputTraitDeclarations': "\n\n".join([self.generate_input_trait_declaration(_input) for _input in inputs_to_generate]), 615 'inputTypeTraitDeclarations': "\n\n".join([self.generate_input_type_trait_declaration(_input) for _input in inputs_to_generate]), 616 'enumTraitDeclarations': "\n\n".join([wrap_with_guard(self.generate_enum_trait_declaration(_type), _type.guard) for _type in enums_to_generate]), 604 617 'forEachMacro': self.generate_for_each_macro(), 605 618 } … … 608 621 609 622 def generate_implementation(self): 623 enums_to_generate = filter(self.should_generate_item, self._model.enum_types()) 624 inputs_to_generate = filter(self.should_generate_item, self._model.inputs) 625 610 626 template_arguments = { 611 627 'licenseBlock': self.generate_license(), … … 615 631 'inputsNamespace': self.target_framework.setting('namespace'), 616 632 'includes': self.generate_includes(defaults=self.setting('implIncludes'), includes_for_types=True), 617 'inputClassImplementations': "\n\n".join([self.generate_class_implementation(_input) for _input in self._model.inputs]),618 'inputTraitImplementations': "\n\n".join([self.generate_input_trait_implementation(_input) for _input in self._model.inputs]),619 'enumTraitImplementations': "\n\n".join([wrap_with_guard(self.generate_enum_trait_implementation(_type), _type.guard) for _type in self._model.enum_types()]),633 'inputClassImplementations': "\n\n".join([self.generate_class_implementation(_input) for _input in inputs_to_generate]), 634 'inputTraitImplementations': "\n\n".join([self.generate_input_trait_implementation(_input) for _input in inputs_to_generate]), 635 'enumTraitImplementations': "\n\n".join([wrap_with_guard(self.generate_enum_trait_implementation(_type), _type.guard) for _type in enums_to_generate]), 620 636 } 621 637 … … 779 795 780 796 def generate_enum_trait_declaration(self, _type): 797 decl_type = ['struct'] 798 if len(self.setting('exportMacro')) > 0: 799 decl_type.append(self.setting('exportMacro')) 800 781 801 should_qualify_type = _type.framework != self.traits_framework 782 802 template = Templates.EnumTraitDeclaration if _type.is_enum() else Templates.EnumClassTraitDeclaration 783 803 template_arguments = { 784 'enumName': _type.type_name(qualified=should_qualify_type), 804 'encodingTypeArgument': _type.encoding_type_argument(qualified=should_qualify_type), 805 'enumType': _type.type_name(qualified=should_qualify_type), 806 'structOrClass': " ".join(decl_type) 785 807 } 786 808 return Template(template).substitute(template_arguments) 787 809 788 810 def generate_for_each_macro(self): 811 inputs_to_generate = filter(self.should_generate_item, self._model.inputs) 812 789 813 macro_name = "%s_REPLAY_INPUT_NAMES_FOR_EACH" % self.setting('prefix').upper() 790 814 lines = [] 791 815 lines.append("#define %s(macro) \\" % macro_name) 792 lines.extend([" macro(%s) \\" % _input.name for _input in self._model.inputs])816 lines.extend([" macro(%s) \\" % _input.name for _input in inputs_to_generate]) 793 817 lines.append(" \\") 794 818 lines.append("// end of %s" % macro_name) … … 870 894 871 895 template_arguments = { 872 'enumName': _type.type_name(qualified=should_qualify_type), 896 'encodingTypeArgument': _type.encoding_type_argument(qualified=should_qualify_type), 897 'enumType': _type.type_name(qualified=should_qualify_type), 873 898 'encodeCases': "\n".join(encodeLines), 874 899 'decodeCases': "\n".join(decodeLines) … … 960 985 961 986 962 def generate_from_specification(input_filepath=None, output_prefix="", output_dirpath=None, framework_name=None, force_output=False): 963 try: 964 with open(input_filepath, "r") as input_file: 965 parsed_json = json.load(input_file) 966 except ValueError as e: 967 raise Exception("Error parsing valid JSON in file: " + input_filepath) 987 def generate_from_specifications(input_filepaths=[], output_prefix="", output_dirpath=None, framework_name=None, force_output=False): 968 988 969 989 if not framework_name in FRAMEWORK_CONFIG_MAP: 970 990 raise ParseException("Unknown or unsupported framework name supplied: " + framework_name) 971 991 972 model = InputsModel(parsed_json) 992 if len(input_filepaths) == 0: 993 raise ParseException("Must provide at least one specification file, none were provided.") 994 995 def parse_json_from_file(input_filepath): 996 try: 997 with open(input_filepath, "r") as input_file: 998 return json.load(input_file) 999 except ValueError as e: 1000 raise Exception("Error parsing valid JSON in file: " + input_filepath) 1001 1002 specifications = map(parse_json_from_file, input_filepaths) 1003 1004 model = InputsModel() 1005 for spec in specifications: 1006 model.parse_specification(spec) 1007 973 1008 model.resolve_types() 974 generator = Generator(model, framework_name, input_filepath , output_prefix)1009 generator = Generator(model, framework_name, input_filepaths[0], output_prefix) 975 1010 976 1011 generator.write_output_files(output_dirpath, force_output) … … 980 1015 allowed_framework_names = FRAMEWORK_CONFIG_MAP.keys() 981 1016 982 cli_parser = optparse.OptionParser(usage="usage: %prog [options] <Inputs.json> ")1017 cli_parser = optparse.OptionParser(usage="usage: %prog [options] <Inputs.json> [, <MoreInputs.json> ]") 983 1018 cli_parser.add_option("-o", "--outputDir", help="Directory where generated files should be written.") 984 1019 cli_parser.add_option("--framework", type="choice", choices=allowed_framework_names, help="The framework these inputs belong to.") # JavaScriptCore, WebCore … … 990 1025 991 1026 arg_options, arg_values = cli_parser.parse_args() 992 if (len(arg_values) < 1):993 raise ParseException("At least one plain argument expected")994 1027 995 1028 if not arg_options.outputDir: … … 1000 1033 1001 1034 options = { 1002 'input_filepath ': arg_values[0],1035 'input_filepaths': arg_values, 1003 1036 'output_dirpath': arg_options.outputDir, 1004 1037 'output_prefix': os.path.basename(arg_values[0]) if arg_options.test else "", … … 1008 1041 1009 1042 try: 1010 generate_from_specification (**options)1043 generate_from_specifications(**options) 1011 1044 except (ParseException, TypecheckException) as e: 1012 1045 if arg_options.test: -
trunk/Source/JavaScriptCore/replay/scripts/CodeGeneratorReplayInputsTemplates.py
r178668 r178714 113 113 114 114 EnumTraitDeclaration = ( 115 """template<> struct EncodingTraits<${enumName}> {116 typedef ${enum Name} DecodedType;117 118 static EncodedValue encodeValue(const ${enum Name}& value);119 static bool decodeValue(EncodedValue&, ${enum Name}& value);115 """template<> ${structOrClass} EncodingTraits<${encodingTypeArgument}> { 116 typedef ${enumType} DecodedType; 117 118 static EncodedValue encodeValue(const ${enumType}& value); 119 static bool decodeValue(EncodedValue&, ${enumType}& value); 120 120 };""") 121 121 122 122 EnumClassTraitDeclaration = ( 123 """template<> struct EncodingTraits<${enumName}> {124 typedef ${enum Name} DecodedType;125 126 static EncodedValue encodeValue(const ${enum Name}& value);127 static bool decodeValue(EncodedValue&, ${enum Name}& value);123 """template<> ${structOrClass} EncodingTraits<${encodingTypeArgument}> { 124 typedef ${enumType} DecodedType; 125 126 static EncodedValue encodeValue(const ${enumType}& value); 127 static bool decodeValue(EncodedValue&, ${enumType}& value); 128 128 };""") 129 129 … … 179 179 180 180 EnumClassTraitImplementation = ( 181 """EncodedValue EncodingTraits<${en umName}>::encodeValue(const ${enumName}& enumValue)181 """EncodedValue EncodingTraits<${encodingTypeArgument}>::encodeValue(const ${enumType}& enumValue) 182 182 { 183 183 switch (enumValue) { … … 187 187 } 188 188 189 bool EncodingTraits<${en umName}>::decodeValue(EncodedValue& encodedValue, ${enumName}& enumValue)189 bool EncodingTraits<${encodingTypeArgument}>::decodeValue(EncodedValue& encodedValue, ${enumType}& enumValue) 190 190 { 191 191 String enumString = encodedValue.convertTo<String>(); … … 204 204 205 205 EnumTraitImplementation = ( 206 """EncodedValue EncodingTraits<${en umName}>::encodeValue(const ${enumName}& enumValue)206 """EncodedValue EncodingTraits<${encodingTypeArgument}>::encodeValue(const ${enumType}& enumValue) 207 207 { 208 208 EncodedValue encodedValue = EncodedValue::createArray(); … … 211 211 } 212 212 213 bool EncodingTraits<${en umName}>::decodeValue(EncodedValue& encodedValue, ${enumName}& enumValue)213 bool EncodingTraits<${encodingTypeArgument}>::decodeValue(EncodedValue& encodedValue, ${enumType}& enumValue) 214 214 { 215 215 Vector<String> enumStrings; -
trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp
r174863 r178714 69 69 return true; 70 70 } 71 EncodedValue EncodingTraits<WebCore::MouseButton>::encodeValue(const WebCore::MouseButton& enumValue)72 {73 EncodedValue encodedValue = EncodedValue::createArray();74 if (enumValue & WebCore::NoButton) {75 encodedValue.append<String>(ASCIILiteral("NoButton"));76 if (enumValue == WebCore::NoButton)77 return encodedValue;78 }79 if (enumValue & WebCore::LeftButton) {80 encodedValue.append<String>(ASCIILiteral("LeftButton"));81 if (enumValue == WebCore::LeftButton)82 return encodedValue;83 }84 if (enumValue & WebCore::MiddleButton) {85 encodedValue.append<String>(ASCIILiteral("MiddleButton"));86 if (enumValue == WebCore::MiddleButton)87 return encodedValue;88 }89 if (enumValue & WebCore::RightButton) {90 encodedValue.append<String>(ASCIILiteral("RightButton"));91 if (enumValue == WebCore::RightButton)92 return encodedValue;93 }94 #if ENABLE(SIDE_BUTTONS)95 if (enumValue & WebCore::LeftSideButton) {96 encodedValue.append<String>(ASCIILiteral("LeftSideButton"));97 if (enumValue == WebCore::LeftSideButton)98 return encodedValue;99 }100 if (enumValue & WebCore::RightSideButton) {101 encodedValue.append<String>(ASCIILiteral("RightSideButton"));102 if (enumValue == WebCore::RightSideButton)103 return encodedValue;104 }105 #endif // ENABLE(SIDE_BUTTONS)106 #if PLATFORM(WINDOWS)107 if (enumValue & WebCore::WindowsButton) {108 encodedValue.append<String>(ASCIILiteral("WindowsButton"));109 if (enumValue == WebCore::WindowsButton)110 return encodedValue;111 }112 #endif // PLATFORM(WINDOWS)113 return encodedValue;114 }115 71 116 bool EncodingTraits<WebCore::MouseButton>::decodeValue(EncodedValue& encodedValue, WebCore::MouseButton& enumValue)117 {118 Vector<String> enumStrings;119 if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings))120 return false;121 122 for (const String& enumString : enumStrings) {123 if (enumString == "NoButton")124 enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::NoButton);125 else if (enumString == "LeftButton")126 enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::LeftButton);127 else if (enumString == "MiddleButton")128 enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::MiddleButton);129 else if (enumString == "RightButton")130 enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::RightButton);131 #if ENABLE(SIDE_BUTTONS)132 if (enumString == "LeftSideButton")133 enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::LeftSideButton);134 else if (enumString == "RightSideButton")135 enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::RightSideButton);136 #endif // ENABLE(SIDE_BUTTONS)137 #if PLATFORM(WINDOWS)138 if (enumString == "WindowsButton")139 enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::WindowsButton);140 #endif // PLATFORM(WINDOWS)141 }142 143 return true;144 }145 72 } // namespace JSC 146 73 -
trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h
r178668 r178714 45 45 46 46 namespace JSC { 47 template<> struct InputTraits<Test::SavedMouseButton> {47 template<> struct TEST_EXPORT_MACRO InputTraits<Test::SavedMouseButton> { 48 48 static InputQueue queue() { return InputQueue::ScriptMemoizedData; } 49 49 static const String& type(); … … 52 52 static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::SavedMouseButton>&); 53 53 }; 54 template<> struct EncodingTraits<WebCore::MouseButton> {55 typedef WebCore::MouseButton DecodedType;56 54 57 static EncodedValue encodeValue(const WebCore::MouseButton& value);58 static bool decodeValue(EncodedValue&, WebCore::MouseButton& value);59 };60 55 } // namespace JSC 61 56 … … 63 58 class SavedMouseButton : public NondeterministicInput<SavedMouseButton> { 64 59 public: 65 SavedMouseButton(MouseButton button);60 TEST_EXPORT_MACRO SavedMouseButton(MouseButton button); 66 61 virtual ~SavedMouseButton(); 67 62 -
trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp
r174863 r178714 33 33 #if ENABLE(WEB_REPLAY) 34 34 #include "InternalNamespaceImplIncludeDummy.h" 35 #include "NondeterministicInput.h" 36 #include "PlatformMouseEvent.h" 35 37 #include <platform/ExternalNamespaceImplIncludeDummy.h> 36 #include <platform/PlatformMouseEvent.h>37 #include <replay/NondeterministicInput.h>38 38 39 39 namespace Test { … … 58 58 void InputTraits<Test::SavedMouseButton>::encode(EncodedValue& encodedValue, const Test::SavedMouseButton& input) 59 59 { 60 encodedValue.put< WebCore::MouseButton>(ASCIILiteral("button"), input.button());60 encodedValue.put<Test::MouseButton>(ASCIILiteral("button"), input.button()); 61 61 } 62 62 63 63 bool InputTraits<Test::SavedMouseButton>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::SavedMouseButton>& input) 64 64 { 65 WebCore::MouseButton button;66 if (!encodedValue.get< WebCore::MouseButton>(ASCIILiteral("button"), button))65 Test::MouseButton button; 66 if (!encodedValue.get<Test::MouseButton>(ASCIILiteral("button"), button)) 67 67 return false; 68 68 … … 70 70 return true; 71 71 } 72 EncodedValue EncodingTraits< InputQueue>::encodeValue(constInputQueue& enumValue)72 EncodedValue EncodingTraits<Test::InputQueue>::encodeValue(const Test::InputQueue& enumValue) 73 73 { 74 74 switch (enumValue) { 75 case InputQueue::EventLoopInput: return EncodedValue::createString("EventLoopInput");76 case InputQueue::LoaderMemoizedData: return EncodedValue::createString("LoaderMemoizedData");77 case InputQueue::ScriptMemoizedData: return EncodedValue::createString("ScriptMemoizedData");75 case Test::InputQueue::EventLoopInput: return EncodedValue::createString("EventLoopInput"); 76 case Test::InputQueue::LoaderMemoizedData: return EncodedValue::createString("LoaderMemoizedData"); 77 case Test::InputQueue::ScriptMemoizedData: return EncodedValue::createString("ScriptMemoizedData"); 78 78 default: ASSERT_NOT_REACHED(); return EncodedValue::createString("Error!"); 79 79 } 80 80 } 81 81 82 bool EncodingTraits< InputQueue>::decodeValue(EncodedValue& encodedValue,InputQueue& enumValue)82 bool EncodingTraits<Test::InputQueue>::decodeValue(EncodedValue& encodedValue, Test::InputQueue& enumValue) 83 83 { 84 84 String enumString = encodedValue.convertTo<String>(); 85 85 if (enumString == "EventLoopInput") { 86 enumValue = InputQueue::EventLoopInput;86 enumValue = Test::InputQueue::EventLoopInput; 87 87 return true; 88 88 } 89 89 if (enumString == "LoaderMemoizedData") { 90 enumValue = InputQueue::LoaderMemoizedData;90 enumValue = Test::InputQueue::LoaderMemoizedData; 91 91 return true; 92 92 } 93 93 if (enumString == "ScriptMemoizedData") { 94 enumValue = InputQueue::ScriptMemoizedData;94 enumValue = Test::InputQueue::ScriptMemoizedData; 95 95 return true; 96 96 } … … 98 98 } 99 99 100 EncodedValue EncodingTraits< WebCore::MouseButton>::encodeValue(const WebCore::MouseButton& enumValue)100 EncodedValue EncodingTraits<Test::MouseButton>::encodeValue(const Test::MouseButton& enumValue) 101 101 { 102 102 EncodedValue encodedValue = EncodedValue::createArray(); 103 if (enumValue & WebCore::NoButton) {103 if (enumValue & Test::NoButton) { 104 104 encodedValue.append<String>(ASCIILiteral("NoButton")); 105 if (enumValue == WebCore::NoButton)105 if (enumValue == Test::NoButton) 106 106 return encodedValue; 107 107 } 108 if (enumValue & WebCore::LeftButton) {108 if (enumValue & Test::LeftButton) { 109 109 encodedValue.append<String>(ASCIILiteral("LeftButton")); 110 if (enumValue == WebCore::LeftButton)110 if (enumValue == Test::LeftButton) 111 111 return encodedValue; 112 112 } 113 if (enumValue & WebCore::MiddleButton) {113 if (enumValue & Test::MiddleButton) { 114 114 encodedValue.append<String>(ASCIILiteral("MiddleButton")); 115 if (enumValue == WebCore::MiddleButton)115 if (enumValue == Test::MiddleButton) 116 116 return encodedValue; 117 117 } 118 if (enumValue & WebCore::RightButton) {118 if (enumValue & Test::RightButton) { 119 119 encodedValue.append<String>(ASCIILiteral("RightButton")); 120 if (enumValue == WebCore::RightButton)120 if (enumValue == Test::RightButton) 121 121 return encodedValue; 122 122 } … … 124 124 } 125 125 126 bool EncodingTraits< WebCore::MouseButton>::decodeValue(EncodedValue& encodedValue, WebCore::MouseButton& enumValue)126 bool EncodingTraits<Test::MouseButton>::decodeValue(EncodedValue& encodedValue, Test::MouseButton& enumValue) 127 127 { 128 128 Vector<String> enumStrings; … … 132 132 for (const String& enumString : enumStrings) { 133 133 if (enumString == "NoButton") 134 enumValue = static_cast< WebCore::MouseButton>(enumValue | WebCore::NoButton);134 enumValue = static_cast<Test::MouseButton>(enumValue | Test::NoButton); 135 135 else if (enumString == "LeftButton") 136 enumValue = static_cast< WebCore::MouseButton>(enumValue | WebCore::LeftButton);136 enumValue = static_cast<Test::MouseButton>(enumValue | Test::LeftButton); 137 137 else if (enumString == "MiddleButton") 138 enumValue = static_cast< WebCore::MouseButton>(enumValue | WebCore::MiddleButton);138 enumValue = static_cast<Test::MouseButton>(enumValue | Test::MiddleButton); 139 139 else if (enumString == "RightButton") 140 enumValue = static_cast< WebCore::MouseButton>(enumValue | WebCore::RightButton);140 enumValue = static_cast<Test::MouseButton>(enumValue | Test::RightButton); 141 141 } 142 142 … … 144 144 } 145 145 146 EncodedValue EncodingTraits< WebCore::PlatformEvent::Type>::encodeValue(const WebCore::PlatformEvent::Type& enumValue)146 EncodedValue EncodingTraits<Test::PlatformEvent::Type>::encodeValue(const Test::PlatformEvent::Type& enumValue) 147 147 { 148 148 EncodedValue encodedValue = EncodedValue::createArray(); 149 if (enumValue & WebCore::PlatformEvent::Mouse) {149 if (enumValue & Test::PlatformEvent::Mouse) { 150 150 encodedValue.append<String>(ASCIILiteral("Mouse")); 151 if (enumValue == WebCore::PlatformEvent::Mouse)151 if (enumValue == Test::PlatformEvent::Mouse) 152 152 return encodedValue; 153 153 } 154 if (enumValue & WebCore::PlatformEvent::Key) {154 if (enumValue & Test::PlatformEvent::Key) { 155 155 encodedValue.append<String>(ASCIILiteral("Key")); 156 if (enumValue == WebCore::PlatformEvent::Key)156 if (enumValue == Test::PlatformEvent::Key) 157 157 return encodedValue; 158 158 } 159 if (enumValue & WebCore::PlatformEvent::Touch) {159 if (enumValue & Test::PlatformEvent::Touch) { 160 160 encodedValue.append<String>(ASCIILiteral("Touch")); 161 if (enumValue == WebCore::PlatformEvent::Touch)161 if (enumValue == Test::PlatformEvent::Touch) 162 162 return encodedValue; 163 163 } 164 if (enumValue & WebCore::PlatformEvent::Wheel) {164 if (enumValue & Test::PlatformEvent::Wheel) { 165 165 encodedValue.append<String>(ASCIILiteral("Wheel")); 166 if (enumValue == WebCore::PlatformEvent::Wheel)166 if (enumValue == Test::PlatformEvent::Wheel) 167 167 return encodedValue; 168 168 } … … 170 170 } 171 171 172 bool EncodingTraits< WebCore::PlatformEvent::Type>::decodeValue(EncodedValue& encodedValue, WebCore::PlatformEvent::Type& enumValue)172 bool EncodingTraits<Test::PlatformEvent::Type>::decodeValue(EncodedValue& encodedValue, Test::PlatformEvent::Type& enumValue) 173 173 { 174 174 Vector<String> enumStrings; … … 178 178 for (const String& enumString : enumStrings) { 179 179 if (enumString == "Mouse") 180 enumValue = static_cast< WebCore::PlatformEvent::Type>(enumValue | WebCore::PlatformEvent::Mouse);180 enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Mouse); 181 181 else if (enumString == "Key") 182 enumValue = static_cast< WebCore::PlatformEvent::Type>(enumValue | WebCore::PlatformEvent::Key);182 enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Key); 183 183 else if (enumString == "Touch") 184 enumValue = static_cast< WebCore::PlatformEvent::Type>(enumValue | WebCore::PlatformEvent::Touch);184 enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Touch); 185 185 else if (enumString == "Wheel") 186 enumValue = static_cast< WebCore::PlatformEvent::Type>(enumValue | WebCore::PlatformEvent::Wheel);186 enumValue = static_cast<Test::PlatformEvent::Type>(enumValue | Test::PlatformEvent::Wheel); 187 187 } 188 188 -
trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h
r178668 r178714 33 33 #if ENABLE(WEB_REPLAY) 34 34 #include "InternalNamespaceHeaderIncludeDummy.h" 35 #include "PlatformEvent.h" 35 36 #include <platform/ExternalNamespaceHeaderIncludeDummy.h> 36 #include <platform/PlatformEvent.h>37 37 38 namespace WebCore{38 namespace Test { 39 39 enum MouseButton : unsigned; 40 }41 42 namespace JSC {43 40 enum class InputQueue; 44 41 } … … 50 47 51 48 namespace JSC { 52 template<> struct InputTraits<Test::SavedMouseButton> {49 template<> struct TEST_EXPORT_MACRO InputTraits<Test::SavedMouseButton> { 53 50 static InputQueue queue() { return InputQueue::ScriptMemoizedData; } 54 51 static const String& type(); … … 57 54 static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::SavedMouseButton>&); 58 55 }; 59 template<> struct EncodingTraits<InputQueue> {60 typedef InputQueue DecodedType;56 template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::InputQueue> { 57 typedef Test::InputQueue DecodedType; 61 58 62 static EncodedValue encodeValue(const InputQueue& value);63 static bool decodeValue(EncodedValue&, InputQueue& value);59 static EncodedValue encodeValue(const Test::InputQueue& value); 60 static bool decodeValue(EncodedValue&, Test::InputQueue& value); 64 61 }; 65 62 66 template<> struct EncodingTraits<WebCore::MouseButton> {67 typedef WebCore::MouseButton DecodedType;63 template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::MouseButton> { 64 typedef Test::MouseButton DecodedType; 68 65 69 static EncodedValue encodeValue(const WebCore::MouseButton& value);70 static bool decodeValue(EncodedValue&, WebCore::MouseButton& value);66 static EncodedValue encodeValue(const Test::MouseButton& value); 67 static bool decodeValue(EncodedValue&, Test::MouseButton& value); 71 68 }; 72 69 73 template<> struct EncodingTraits<WebCore::PlatformEvent::Type> {74 typedef WebCore::PlatformEvent::Type DecodedType;70 template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::PlatformEvent::Type> { 71 typedef Test::PlatformEvent::Type DecodedType; 75 72 76 static EncodedValue encodeValue(const WebCore::PlatformEvent::Type& value);77 static bool decodeValue(EncodedValue&, WebCore::PlatformEvent::Type& value);73 static EncodedValue encodeValue(const Test::PlatformEvent::Type& value); 74 static bool decodeValue(EncodedValue&, Test::PlatformEvent::Type& value); 78 75 }; 79 76 } // namespace JSC … … 82 79 class SavedMouseButton : public NondeterministicInput<SavedMouseButton> { 83 80 public: 84 SavedMouseButton(MouseButton button);81 TEST_EXPORT_MACRO SavedMouseButton(MouseButton button); 85 82 virtual ~SavedMouseButton(); 86 83 -
trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.cpp
r174863 r178714 33 33 #if ENABLE(WEB_REPLAY) 34 34 #include "InternalNamespaceImplIncludeDummy.h" 35 #include "PlatformWheelEvent.h" 35 36 #include <platform/ExternalNamespaceImplIncludeDummy.h> 36 37 #include <platform/PlatformWheelEvent.h> 37 38 38 39 namespace Test { 39 HandleWheelEvent::HandleWheelEvent(std::unique_ptr<PlatformWheelEvent> platformEvent )40 HandleWheelEvent::HandleWheelEvent(std::unique_ptr<PlatformWheelEvent> platformEvent, PlatformWheelPhase phase) 40 41 : EventLoopInput<HandleWheelEvent>() 41 42 , m_platformEvent(WTF::move(platformEvent)) 43 , m_phase(phase) 42 44 { 43 45 } … … 58 60 { 59 61 encodedValue.put<WebCore::PlatformWheelEvent>(ASCIILiteral("platformEvent"), input.platformEvent()); 62 encodedValue.put<Test::PlatformWheelPhase>(ASCIILiteral("phase"), input.phase()); 60 63 } 61 64 … … 66 69 return false; 67 70 68 input = std::make_unique<Test::HandleWheelEvent>(WTF::move(platformEvent)); 71 Test::PlatformWheelPhase phase; 72 if (!encodedValue.get<Test::PlatformWheelPhase>(ASCIILiteral("phase"), phase)) 73 return false; 74 75 input = std::make_unique<Test::HandleWheelEvent>(WTF::move(platformEvent), phase); 69 76 return true; 70 77 } 71 78 #if ENABLE(DUMMY_FEATURE) 72 EncodedValue EncodingTraits< WebCore::PlatformWheelEventPhase>::encodeValue(const WebCore::PlatformWheelEventPhase& enumValue)79 EncodedValue EncodingTraits<Test::PlatformWheelPhase>::encodeValue(const Test::PlatformWheelPhase& enumValue) 73 80 { 74 81 EncodedValue encodedValue = EncodedValue::createArray(); 75 if (enumValue & WebCore::PlatformWheelEventPhaseNone) {82 if (enumValue & Test::PlatformWheelEventPhaseNone) { 76 83 encodedValue.append<String>(ASCIILiteral("PlatformWheelEventPhaseNone")); 77 if (enumValue == WebCore::PlatformWheelEventPhaseNone)84 if (enumValue == Test::PlatformWheelEventPhaseNone) 78 85 return encodedValue; 79 86 } … … 81 88 } 82 89 83 bool EncodingTraits< WebCore::PlatformWheelEventPhase>::decodeValue(EncodedValue& encodedValue, WebCore::PlatformWheelEventPhase& enumValue)90 bool EncodingTraits<Test::PlatformWheelPhase>::decodeValue(EncodedValue& encodedValue, Test::PlatformWheelPhase& enumValue) 84 91 { 85 92 Vector<String> enumStrings; … … 89 96 for (const String& enumString : enumStrings) { 90 97 if (enumString == "PlatformWheelEventPhaseNone") 91 enumValue = static_cast< WebCore::PlatformWheelEventPhase>(enumValue | WebCore::PlatformWheelEventPhaseNone);98 enumValue = static_cast<Test::PlatformWheelPhase>(enumValue | Test::PlatformWheelEventPhaseNone); 92 99 } 93 100 -
trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-with-guard.json-TestReplayInputs.h
r178668 r178714 35 35 #include <platform/ExternalNamespaceHeaderIncludeDummy.h> 36 36 37 namespace Test { 38 enum PlatformWheelPhase : uint64_t; 39 } 40 37 41 namespace WebCore { 38 42 class PlatformWheelEvent; 39 enum PlatformWheelEventPhase : uint64_t;40 43 } 41 44 … … 46 49 47 50 namespace JSC { 48 template<> struct InputTraits<Test::HandleWheelEvent> {51 template<> struct TEST_EXPORT_MACRO InputTraits<Test::HandleWheelEvent> { 49 52 static InputQueue queue() { return InputQueue::EventLoopInput; } 50 53 static const String& type(); … … 54 57 }; 55 58 #if ENABLE(DUMMY_FEATURE) 56 template<> struct EncodingTraits<WebCore::PlatformWheelEventPhase> {57 typedef WebCore::PlatformWheelEventPhase DecodedType;59 template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::PlatformWheelPhase> { 60 typedef Test::PlatformWheelPhase DecodedType; 58 61 59 static EncodedValue encodeValue(const WebCore::PlatformWheelEventPhase& value);60 static bool decodeValue(EncodedValue&, WebCore::PlatformWheelEventPhase& value);62 static EncodedValue encodeValue(const Test::PlatformWheelPhase& value); 63 static bool decodeValue(EncodedValue&, Test::PlatformWheelPhase& value); 61 64 }; 62 65 #endif // ENABLE(DUMMY_FEATURE) … … 66 69 class HandleWheelEvent : public EventLoopInput<HandleWheelEvent> { 67 70 public: 68 HandleWheelEvent(std::unique_ptr<PlatformWheelEvent> platformEvent);71 TEST_EXPORT_MACRO HandleWheelEvent(std::unique_ptr<PlatformWheelEvent> platformEvent, PlatformWheelPhase phase); 69 72 virtual ~HandleWheelEvent(); 70 73 … … 72 75 virtual void dispatch(ReplayController&) override final; 73 76 const PlatformWheelEvent& platformEvent() const { return *m_platformEvent; } 77 PlatformWheelPhase phase() const { return m_phase; } 74 78 private: 75 79 std::unique_ptr<PlatformWheelEvent> m_platformEvent; 80 PlatformWheelPhase m_phase; 76 81 }; 77 82 } // namespace Test -
trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp
r174863 r178714 61 61 encodedValue.put<PlatformEvent1::Type>(ASCIILiteral("eventType1"), input.eventType1()); 62 62 encodedValue.put<PlatformEvent2::Type>(ASCIILiteral("eventType2"), input.eventType2()); 63 encodedValue.put< WebCore::FormData1::Type>(ASCIILiteral("formType1"), input.formType1());64 encodedValue.put< WebCore::FormData2::Type>(ASCIILiteral("formType2"), input.formType2());63 encodedValue.put<Test::FormData1::Type>(ASCIILiteral("formType1"), input.formType1()); 64 encodedValue.put<Test::FormData2::Type>(ASCIILiteral("formType2"), input.formType2()); 65 65 } 66 66 … … 75 75 return false; 76 76 77 WebCore::FormData1::Type formType1;78 if (!encodedValue.get< WebCore::FormData1::Type>(ASCIILiteral("formType1"), formType1))77 Test::FormData1::Type formType1; 78 if (!encodedValue.get<Test::FormData1::Type>(ASCIILiteral("formType1"), formType1)) 79 79 return false; 80 80 81 WebCore::FormData2::Type formType2;82 if (!encodedValue.get< WebCore::FormData2::Type>(ASCIILiteral("formType2"), formType2))81 Test::FormData2::Type formType2; 82 if (!encodedValue.get<Test::FormData2::Type>(ASCIILiteral("formType2"), formType2)) 83 83 return false; 84 84 … … 86 86 return true; 87 87 } 88 EncodedValue EncodingTraits< WebCore::FormData1::Type>::encodeValue(const WebCore::FormData1::Type& enumValue)88 EncodedValue EncodingTraits<Test::FormData1::Type>::encodeValue(const Test::FormData1::Type& enumValue) 89 89 { 90 90 EncodedValue encodedValue = EncodedValue::createArray(); 91 if (enumValue & WebCore::FormData1::Text) {91 if (enumValue & Test::FormData1::Text) { 92 92 encodedValue.append<String>(ASCIILiteral("Text")); 93 if (enumValue == WebCore::FormData1::Text)93 if (enumValue == Test::FormData1::Text) 94 94 return encodedValue; 95 95 } 96 if (enumValue & WebCore::FormData1::Blob) {96 if (enumValue & Test::FormData1::Blob) { 97 97 encodedValue.append<String>(ASCIILiteral("Blob")); 98 if (enumValue == WebCore::FormData1::Blob)98 if (enumValue == Test::FormData1::Blob) 99 99 return encodedValue; 100 100 } … … 102 102 } 103 103 104 bool EncodingTraits< WebCore::FormData1::Type>::decodeValue(EncodedValue& encodedValue, WebCore::FormData1::Type& enumValue)104 bool EncodingTraits<Test::FormData1::Type>::decodeValue(EncodedValue& encodedValue, Test::FormData1::Type& enumValue) 105 105 { 106 106 Vector<String> enumStrings; … … 110 110 for (const String& enumString : enumStrings) { 111 111 if (enumString == "Text") 112 enumValue = static_cast< WebCore::FormData1::Type>(enumValue | WebCore::FormData1::Text);112 enumValue = static_cast<Test::FormData1::Type>(enumValue | Test::FormData1::Text); 113 113 else if (enumString == "Blob") 114 enumValue = static_cast< WebCore::FormData1::Type>(enumValue | WebCore::FormData1::Blob);114 enumValue = static_cast<Test::FormData1::Type>(enumValue | Test::FormData1::Blob); 115 115 } 116 116 … … 118 118 } 119 119 120 EncodedValue EncodingTraits< WebCore::FormData2::Type>::encodeValue(const WebCore::FormData2::Type& enumValue)120 EncodedValue EncodingTraits<Test::FormData2::Type>::encodeValue(const Test::FormData2::Type& enumValue) 121 121 { 122 122 switch (enumValue) { 123 case WebCore::FormData2::Type::Text: return EncodedValue::createString("Text");124 case WebCore::FormData2::Type::Blob: return EncodedValue::createString("Blob");123 case Test::FormData2::Type::Text: return EncodedValue::createString("Text"); 124 case Test::FormData2::Type::Blob: return EncodedValue::createString("Blob"); 125 125 default: ASSERT_NOT_REACHED(); return EncodedValue::createString("Error!"); 126 126 } 127 127 } 128 128 129 bool EncodingTraits< WebCore::FormData2::Type>::decodeValue(EncodedValue& encodedValue, WebCore::FormData2::Type& enumValue)129 bool EncodingTraits<Test::FormData2::Type>::decodeValue(EncodedValue& encodedValue, Test::FormData2::Type& enumValue) 130 130 { 131 131 String enumString = encodedValue.convertTo<String>(); 132 132 if (enumString == "Text") { 133 enumValue = WebCore::FormData2::Type::Text;133 enumValue = Test::FormData2::Type::Text; 134 134 return true; 135 135 } 136 136 if (enumString == "Blob") { 137 enumValue = WebCore::FormData2::Type::Blob; 138 return true; 139 } 140 return false; 141 } 142 143 EncodedValue EncodingTraits<PlatformEvent1::Type>::encodeValue(const PlatformEvent1::Type& enumValue) 144 { 145 EncodedValue encodedValue = EncodedValue::createArray(); 146 if (enumValue & PlatformEvent1::Mouse) { 147 encodedValue.append<String>(ASCIILiteral("Mouse")); 148 if (enumValue == PlatformEvent1::Mouse) 149 return encodedValue; 150 } 151 if (enumValue & PlatformEvent1::Keyboard) { 152 encodedValue.append<String>(ASCIILiteral("Keyboard")); 153 if (enumValue == PlatformEvent1::Keyboard) 154 return encodedValue; 155 } 156 return encodedValue; 157 } 158 159 bool EncodingTraits<PlatformEvent1::Type>::decodeValue(EncodedValue& encodedValue, PlatformEvent1::Type& enumValue) 160 { 161 Vector<String> enumStrings; 162 if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings)) 163 return false; 164 165 for (const String& enumString : enumStrings) { 166 if (enumString == "Mouse") 167 enumValue = static_cast<PlatformEvent1::Type>(enumValue | PlatformEvent1::Mouse); 168 else if (enumString == "Keyboard") 169 enumValue = static_cast<PlatformEvent1::Type>(enumValue | PlatformEvent1::Keyboard); 170 } 171 172 return true; 173 } 174 175 EncodedValue EncodingTraits<PlatformEvent2::Type>::encodeValue(const PlatformEvent2::Type& enumValue) 176 { 177 switch (enumValue) { 178 case PlatformEvent2::Type::Mouse: return EncodedValue::createString("Mouse"); 179 case PlatformEvent2::Type::Keyboard: return EncodedValue::createString("Keyboard"); 180 default: ASSERT_NOT_REACHED(); return EncodedValue::createString("Error!"); 181 } 182 } 183 184 bool EncodingTraits<PlatformEvent2::Type>::decodeValue(EncodedValue& encodedValue, PlatformEvent2::Type& enumValue) 185 { 186 String enumString = encodedValue.convertTo<String>(); 187 if (enumString == "Mouse") { 188 enumValue = PlatformEvent2::Type::Mouse; 189 return true; 190 } 191 if (enumString == "Keyboard") { 192 enumValue = PlatformEvent2::Type::Keyboard; 137 enumValue = Test::FormData2::Type::Blob; 193 138 return true; 194 139 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.h
r178668 r178714 32 32 33 33 #if ENABLE(WEB_REPLAY) 34 #include "FormData1.h" 35 #include "FormData2.h" 34 36 #include "InternalNamespaceHeaderIncludeDummy.h" 35 37 #include <platform/ExternalNamespaceHeaderIncludeDummy.h> 36 #include <replay/FormData1.h>37 #include <replay/FormData2.h>38 38 #include <replay/PlatformEvent.h> 39 39 … … 45 45 46 46 namespace JSC { 47 template<> struct InputTraits<Test::FormCombo> {47 template<> struct TEST_EXPORT_MACRO InputTraits<Test::FormCombo> { 48 48 static InputQueue queue() { return InputQueue::ScriptMemoizedData; } 49 49 static const String& type(); … … 52 52 static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::FormCombo>&); 53 53 }; 54 template<> struct EncodingTraits<WebCore::FormData1::Type> {55 typedef WebCore::FormData1::Type DecodedType;54 template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::FormData1::Type> { 55 typedef Test::FormData1::Type DecodedType; 56 56 57 static EncodedValue encodeValue(const WebCore::FormData1::Type& value);58 static bool decodeValue(EncodedValue&, WebCore::FormData1::Type& value);57 static EncodedValue encodeValue(const Test::FormData1::Type& value); 58 static bool decodeValue(EncodedValue&, Test::FormData1::Type& value); 59 59 }; 60 60 61 template<> struct EncodingTraits<WebCore::FormData2::Type> {62 typedef WebCore::FormData2::Type DecodedType;61 template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::FormData2::Type> { 62 typedef Test::FormData2::Type DecodedType; 63 63 64 static EncodedValue encodeValue(const WebCore::FormData2::Type& value); 65 static bool decodeValue(EncodedValue&, WebCore::FormData2::Type& value); 66 }; 67 68 template<> struct EncodingTraits<PlatformEvent1::Type> { 69 typedef PlatformEvent1::Type DecodedType; 70 71 static EncodedValue encodeValue(const PlatformEvent1::Type& value); 72 static bool decodeValue(EncodedValue&, PlatformEvent1::Type& value); 73 }; 74 75 template<> struct EncodingTraits<PlatformEvent2::Type> { 76 typedef PlatformEvent2::Type DecodedType; 77 78 static EncodedValue encodeValue(const PlatformEvent2::Type& value); 79 static bool decodeValue(EncodedValue&, PlatformEvent2::Type& value); 64 static EncodedValue encodeValue(const Test::FormData2::Type& value); 65 static bool decodeValue(EncodedValue&, Test::FormData2::Type& value); 80 66 }; 81 67 } // namespace JSC … … 84 70 class FormCombo : public NondeterministicInput<FormCombo> { 85 71 public: 86 FormCombo(PlatformEvent1::Type eventType1, PlatformEvent2::Type eventType2, FormData1::Type formType1, FormData2::Type formType2);72 TEST_EXPORT_MACRO FormCombo(PlatformEvent1::Type eventType1, PlatformEvent2::Type eventType2, FormData1::Type formType1, FormData2::Type formType2); 87 73 virtual ~FormCombo(); 88 74 -
trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h
r178668 r178714 46 46 namespace JSC { 47 47 #if ENABLE(DUMMY_FEATURE) 48 template<> struct InputTraits<Test::GetCurrentTime> {48 template<> struct TEST_EXPORT_MACRO InputTraits<Test::GetCurrentTime> { 49 49 static InputQueue queue() { return InputQueue::ScriptMemoizedData; } 50 50 static const String& type(); … … 55 55 #endif // ENABLE(DUMMY_FEATURE) 56 56 57 template<> struct InputTraits<Test::SetRandomSeed> {57 template<> struct TEST_EXPORT_MACRO InputTraits<Test::SetRandomSeed> { 58 58 static InputQueue queue() { return InputQueue::ScriptMemoizedData; } 59 59 static const String& type(); … … 69 69 class GetCurrentTime : public NondeterministicInput<GetCurrentTime> { 70 70 public: 71 GetCurrentTime(double currentTime);71 TEST_EXPORT_MACRO GetCurrentTime(double currentTime); 72 72 virtual ~GetCurrentTime(); 73 73 … … 80 80 class SetRandomSeed : public NondeterministicInput<SetRandomSeed> { 81 81 public: 82 SetRandomSeed(uint64_t randomSeed);82 TEST_EXPORT_MACRO SetRandomSeed(uint64_t randomSeed); 83 83 virtual ~SetRandomSeed(); 84 84 -
trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h
r178668 r178714 47 47 48 48 namespace JSC { 49 template<> struct InputTraits<Test::ArrayOfThings> {49 template<> struct TEST_EXPORT_MACRO InputTraits<Test::ArrayOfThings> { 50 50 static InputQueue queue() { return InputQueue::ScriptMemoizedData; } 51 51 static const String& type(); … … 55 55 }; 56 56 57 template<> struct InputTraits<Test::SavedHistory> {57 template<> struct TEST_EXPORT_MACRO InputTraits<Test::SavedHistory> { 58 58 static InputQueue queue() { return InputQueue::ScriptMemoizedData; } 59 59 static const String& type(); … … 68 68 class ArrayOfThings : public NondeterministicInput<ArrayOfThings> { 69 69 public: 70 ArrayOfThings(Vector<double>& doubles, Vector<JSThing>& jsthings, Vector<WebThing>& webthings);70 TEST_EXPORT_MACRO ArrayOfThings(Vector<double>& doubles, Vector<JSThing>& jsthings, Vector<WebThing>& webthings); 71 71 virtual ~ArrayOfThings(); 72 72 … … 82 82 class SavedHistory : public NondeterministicInput<SavedHistory> { 83 83 public: 84 SavedHistory(Vector<RefPtr<HistoryItem>>& entries);84 TEST_EXPORT_MACRO SavedHistory(Vector<RefPtr<HistoryItem>>& entries); 85 85 virtual ~SavedHistory(); 86 86 -
trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h
r178668 r178714 43 43 44 44 namespace JSC { 45 template<> struct InputTraits<Test::ScalarInput1> {45 template<> struct TEST_EXPORT_MACRO InputTraits<Test::ScalarInput1> { 46 46 static InputQueue queue() { return InputQueue::ScriptMemoizedData; } 47 47 static const String& type(); … … 51 51 }; 52 52 53 template<> struct InputTraits<Test::ScalarInput2> {53 template<> struct TEST_EXPORT_MACRO InputTraits<Test::ScalarInput2> { 54 54 static InputQueue queue() { return InputQueue::ScriptMemoizedData; } 55 55 static const String& type(); … … 64 64 class ScalarInput1 : public NondeterministicInput<ScalarInput1> { 65 65 public: 66 ScalarInput1(ScalarType data);66 TEST_EXPORT_MACRO ScalarInput1(ScalarType data); 67 67 virtual ~ScalarInput1(); 68 68 … … 74 74 class ScalarInput2 : public NondeterministicInput<ScalarInput2> { 75 75 public: 76 ScalarInput2(ScalarType data);76 TEST_EXPORT_MACRO ScalarInput2(ScalarType data); 77 77 virtual ~ScalarInput2(); 78 78 -
trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h
r178668 r178714 43 43 44 44 namespace JSC { 45 template<> struct InputTraits<Test::ScalarInput> {45 template<> struct TEST_EXPORT_MACRO InputTraits<Test::ScalarInput> { 46 46 static InputQueue queue() { return InputQueue::ScriptMemoizedData; } 47 47 static const String& type(); … … 51 51 }; 52 52 53 template<> struct InputTraits<Test::MapInput> {53 template<> struct TEST_EXPORT_MACRO InputTraits<Test::MapInput> { 54 54 static InputQueue queue() { return InputQueue::ScriptMemoizedData; } 55 55 static const String& type(); … … 64 64 class ScalarInput : public NondeterministicInput<ScalarInput> { 65 65 public: 66 ScalarInput(ScalarType data);66 TEST_EXPORT_MACRO ScalarInput(ScalarType data); 67 67 virtual ~ScalarInput(); 68 68 … … 74 74 class MapInput : public NondeterministicInput<MapInput> { 75 75 public: 76 MapInput(std::unique_ptr<MapType> data);76 TEST_EXPORT_MACRO MapInput(std::unique_ptr<MapType> data); 77 77 virtual ~MapInput(); 78 78 -
trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-c-style-enum-no-storage.json
r163918 r178714 1 1 { 2 2 "types": { 3 " WebCore": [3 "Test": [ 4 4 { 5 5 "name": "MouseButton", "mode": "SCALAR", … … 11 11 }, 12 12 13 "inputs": [ 14 { 15 "name": "SavedMouseButton", 16 "description": "Supplies a mouse button enum value.", 17 "queue": "SCRIPT_MEMOIZED", 18 "members": [ 19 { "name": "button", "type": "MouseButton" } 20 ] 21 } 22 ] 13 "inputs": { 14 "Test": [ 15 { 16 "name": "SavedMouseButton", 17 "description": "Supplies a mouse button enum value.", 18 "queue": "SCRIPT_MEMOIZED", 19 "members": [ 20 { "name": "button", "type": "MouseButton" } 21 ] 22 } 23 ] 24 } 23 25 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-duplicate-enum-type.json
r167174 r178714 21 21 }, 22 22 23 "inputs": [ 24 { 25 "name": "FormCombo", 26 "description": "Combines an event type and form data type.", 27 "queue": "SCRIPT_MEMOIZED", 28 "members": [ 29 { "name": "eventType", "type": "PlatformEvent::Type" } 30 ] 31 } 32 ] 23 "inputs": { 24 "Test": [ 25 { 26 "name": "FormCombo", 27 "description": "Combines an event type and form data type.", 28 "queue": "SCRIPT_MEMOIZED", 29 "members": [ 30 { "name": "eventType", "type": "PlatformEvent::Type" } 31 ] 32 } 33 ] 34 } 33 35 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-duplicate-input-names.json
r163918 r178714 7 7 }, 8 8 9 "inputs": [ 10 { 11 "name": "GetCurrentTime", 12 "description": "Supplies the system time to Date.now() and new Date().", 13 "queue": "SCRIPT_MEMOIZED", 14 "members": [ 15 { "name": "currentTime", "type": "double" } 16 ] 17 }, 18 { 19 "name": "GetCurrentTime", 20 "description": "Sets the PRNG seed used by Math.random().", 21 "queue": "SCRIPT_MEMOIZED", 22 "members": [ 23 { "name": "randomSeed", "type": "uint64_t" } 24 ] 25 } 26 ] 9 "inputs": { 10 "Test": [ 11 { 12 "name": "GetCurrentTime", 13 "description": "Supplies the system time to Date.now() and new Date().", 14 "queue": "SCRIPT_MEMOIZED", 15 "members": [ 16 { "name": "currentTime", "type": "double" } 17 ] 18 }, 19 { 20 "name": "GetCurrentTime", 21 "description": "Sets the PRNG seed used by Math.random().", 22 "queue": "SCRIPT_MEMOIZED", 23 "members": [ 24 { "name": "randomSeed", "type": "uint64_t" } 25 ] 26 } 27 ] 28 } 27 29 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-duplicate-type-names.json
r163918 r178714 7 7 }, 8 8 9 "inputs": [ 10 { 11 "name": "SetRandomSeed", 12 "description": "Sets the PRNG seed used by Math.random().", 13 "queue": "SCRIPT_MEMOIZED", 14 "members": [ 15 { 16 "name": "randomSeed", 17 "type": "uint64_t" 18 } 19 ] 20 } 21 ] 9 "inputs": { 10 "Test": [ 11 { 12 "name": "SetRandomSeed", 13 "description": "Sets the PRNG seed used by Math.random().", 14 "queue": "SCRIPT_MEMOIZED", 15 "members": [ 16 { 17 "name": "randomSeed", 18 "type": "uint64_t" 19 } 20 ] 21 } 22 ] 23 } 22 24 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-enum-type-missing-values.json
r163918 r178714 9 9 }, 10 10 11 "inputs": [ 12 { 13 "name": "SavedMouseButton", 14 "description": "Supplies a mouse button enum value.", 15 "queue": "SCRIPT_MEMOIZED", 16 "members": [ 17 { "name": "currentTime", "type": "MouseButton" } 18 ] 19 } 20 ] 11 "inputs": { 12 "Test": [ 13 { 14 "name": "SavedMouseButton", 15 "description": "Supplies a mouse button enum value.", 16 "queue": "SCRIPT_MEMOIZED", 17 "members": [ 18 { "name": "currentTime", "type": "MouseButton" } 19 ] 20 } 21 ] 22 } 21 23 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-member-name.json
r163918 r178714 6 6 }, 7 7 8 "inputs": [ 9 { 10 "name": "GetCurrentTime", 11 "description": "Supplies the system time to Date.now() and new Date().", 12 "queue": "SCRIPT_MEMOIZED", 13 "members": [ 14 { 15 "type": "double" 16 } 17 ] 18 } 19 ] 8 "inputs": { 9 "Test": [ 10 { 11 "name": "GetCurrentTime", 12 "description": "Supplies the system time to Date.now() and new Date().", 13 "queue": "SCRIPT_MEMOIZED", 14 "members": [ 15 { 16 "type": "double" 17 } 18 ] 19 } 20 ] 21 } 20 22 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-name.json
r163918 r178714 6 6 }, 7 7 8 "inputs": [ 9 { 10 "description": "Supplies the system time to Date.now() and new Date().", 11 "queue": "SCRIPT_MEMOIZED", 12 "members": [ 13 { 14 "name": "currentTime", 15 "type": "double" 16 } 17 ] 18 } 19 ] 8 "inputs": { 9 "Test": [ 10 { 11 "description": "Supplies the system time to Date.now() and new Date().", 12 "queue": "SCRIPT_MEMOIZED", 13 "members": [ 14 { 15 "name": "currentTime", 16 "type": "double" 17 } 18 ] 19 } 20 ] 21 } 20 22 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-queue.json
r163918 r178714 6 6 }, 7 7 8 "inputs": [ 9 { 10 "name": "GetCurrentTime", 11 "description": "Supplies the system time to Date.now() and new Date().", 12 "members": [ 13 { 14 "name": "currentTime", 15 "type": "double" 16 } 17 ] 18 } 19 ] 8 "inputs": { 9 "Test": [ 10 { 11 "name": "GetCurrentTime", 12 "description": "Supplies the system time to Date.now() and new Date().", 13 "members": [ 14 { 15 "name": "currentTime", 16 "type": "double" 17 } 18 ] 19 } 20 ] 21 } 20 22 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-type-mode.json
r163918 r178714 6 6 }, 7 7 8 "inputs": [ 9 { 10 "name": "GetCurrentTime", 11 "description": "Supplies the system time to Date.now() and new Date().", 12 "queue": "SCRIPT_MEMOIZED", 13 "members": [ 14 { 15 "name": "currentTime", 16 "type": "double" 17 } 18 ] 19 } 20 ] 8 "inputs": { 9 "Test": [ 10 { 11 "name": "GetCurrentTime", 12 "description": "Supplies the system time to Date.now() and new Date().", 13 "queue": "SCRIPT_MEMOIZED", 14 "members": [ 15 { 16 "name": "currentTime", 17 "type": "double" 18 } 19 ] 20 } 21 ] 22 } 21 23 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-type-name.json
r163918 r178714 6 6 }, 7 7 8 "inputs": [ 9 { 10 "name": "GetCurrentTime", 11 "description": "Supplies the system time to Date.now() and new Date().", 12 "queue": "SCRIPT_MEMOIZED", 13 "members": [ 14 { 15 "name": "currentTime", 16 "type": "double" 17 } 18 ] 19 } 20 ] 8 "inputs": { 9 "Test": [ 10 { 11 "name": "GetCurrentTime", 12 "description": "Supplies the system time to Date.now() and new Date().", 13 "queue": "SCRIPT_MEMOIZED", 14 "members": [ 15 { 16 "name": "currentTime", 17 "type": "double" 18 } 19 ] 20 } 21 ] 22 } 21 23 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-input-queue.json
r163918 r178714 6 6 }, 7 7 8 "inputs": [ 9 { 10 "name": "GetCurrentTime", 11 "description": "Supplies the system time to Date.now() and new Date().", 12 "queue": "SCRIPT_MEOIZED", 13 "members": [ 14 { 15 "name": "currentTime", 16 "type": "double" 17 } 18 ] 19 } 20 ] 8 "inputs": { 9 "Test": [ 10 { 11 "name": "GetCurrentTime", 12 "description": "Supplies the system time to Date.now() and new Date().", 13 "queue": "SCRIPT_MEOIZED", 14 "members": [ 15 { 16 "name": "currentTime", 17 "type": "double" 18 } 19 ] 20 } 21 ] 22 } 21 23 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-member-type.json
r163918 r178714 6 6 }, 7 7 8 "inputs": [ 9 { 10 "name": "SetRandomSeed", 11 "description": "Sets the PRNG seed used by Math.random().", 12 "queue": "SCRIPT_MEMOIZED", 13 "members": [ 14 { 15 "name": "randomSeed", 16 "type": "double" 17 } 18 ] 19 } 20 ] 8 "inputs": { 9 "Test": [ 10 { 11 "name": "SetRandomSeed", 12 "description": "Sets the PRNG seed used by Math.random().", 13 "queue": "SCRIPT_MEMOIZED", 14 "members": [ 15 { 16 "name": "randomSeed", 17 "type": "double" 18 } 19 ] 20 } 21 ] 22 } 21 23 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-type-mode.json
r163918 r178714 6 6 }, 7 7 8 "inputs": [ 9 { 10 "name": "GetCurrentTime", 11 "description": "Supplies the system time to Date.now() and new Date().", 12 "queue": "SCRIPT_MEMOIZED", 13 "members": [ 14 { 15 "name": "currentTime", 16 "type": "double" 17 } 18 ] 19 } 20 ] 8 "inputs": { 9 "Test": [ 10 { 11 "name": "GetCurrentTime", 12 "description": "Supplies the system time to Date.now() and new Date().", 13 "queue": "SCRIPT_MEMOIZED", 14 "members": [ 15 { 16 "name": "currentTime", 17 "type": "double" 18 } 19 ] 20 } 21 ] 22 } 21 23 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/generate-enum-encoding-helpers-with-guarded-values.json
r163918 r178714 15 15 }, 16 16 17 "inputs": [ 18 { 19 "name": "SavedMouseButton", 20 "description": "Supplies a mouse button enum value.", 21 "queue": "SCRIPT_MEMOIZED", 22 "members": [ 23 { "name": "button", "type": "MouseButton" } 24 ] 25 } 26 ] 17 "inputs": { 18 "Test": [ 19 { 20 "name": "SavedMouseButton", 21 "description": "Supplies a mouse button enum value.", 22 "queue": "SCRIPT_MEMOIZED", 23 "members": [ 24 { "name": "button", "type": "MouseButton" } 25 ] 26 } 27 ] 28 } 27 29 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/generate-enum-encoding-helpers.json
r174863 r178714 1 1 { 2 2 "types": { 3 " JavaScriptCore": [3 "Test": [ 4 4 { 5 5 "name": "InputQueue", "mode": "SCALAR", … … 7 7 "values": ["EventLoopInput", "LoaderMemoizedData", "ScriptMemoizedData"], 8 8 "header": "replay/NondeterministicInput.h" 9 } 10 ], 11 "WebCore": [ 9 }, 12 10 { 13 11 "name": "MouseButton", "mode": "SCALAR", "storage": "unsigned", … … 26 24 }, 27 25 28 "inputs": [ 29 { 30 "name": "SavedMouseButton", 31 "description": "Supplies a mouse button enum value.", 32 "queue": "SCRIPT_MEMOIZED", 33 "members": [ 34 { "name": "button", "type": "MouseButton" } 35 ] 36 } 37 ] 26 "inputs": { 27 "Test": [ 28 { 29 "name": "SavedMouseButton", 30 "description": "Supplies a mouse button enum value.", 31 "queue": "SCRIPT_MEMOIZED", 32 "members": [ 33 { "name": "button", "type": "MouseButton" } 34 ] 35 } 36 ] 37 } 38 38 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/generate-enum-with-guard.json
r169889 r178714 8 8 "name": "PlatformWheelEvent", "mode": "OWNED", 9 9 "header": "platform/PlatformWheelEvent.h" 10 }, 10 } 11 ], 12 "Test": [ 11 13 { 12 "name": "PlatformWheel EventPhase", "mode": "SCALAR", "storage": "uint64_t",14 "name": "PlatformWheelPhase", "mode": "SCALAR", "storage": "uint64_t", 13 15 "flags": ["ENUM"], 14 16 "guard": "ENABLE(DUMMY_FEATURE)", … … 19 21 }, 20 22 21 "inputs": [ 22 { 23 "name": "HandleWheelEvent", 24 "description": "", 25 "queue": "EVENT_LOOP", 26 "members": [ 27 { "name": "platformEvent", "type": "PlatformWheelEvent" } 28 ] 29 } 30 ] 23 "inputs": { 24 "Test": [ 25 { 26 "name": "HandleWheelEvent", 27 "description": "", 28 "queue": "EVENT_LOOP", 29 "members": [ 30 { "name": "platformEvent", "type": "PlatformWheelEvent" }, 31 { "name": "phase", "type": "PlatformWheelPhase" } 32 ] 33 } 34 ] 35 } 31 36 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/generate-enums-with-same-base-name.json
r171683 r178714 17 17 } 18 18 ], 19 " WebCore": [19 "Test": [ 20 20 { 21 21 "name": "Type", "mode": "SCALAR", "storage": "uint64_t", … … 35 35 }, 36 36 37 "inputs": [ 38 { 39 "name": "FormCombo", 40 "description": "Combines an event type and form data type.", 41 "queue": "SCRIPT_MEMOIZED", 42 "members": [ 43 { "name": "eventType1", "type": "PlatformEvent1::Type" }, 44 { "name": "eventType2", "type": "PlatformEvent2::Type" }, 45 { "name": "formType1", "type": "FormData1::Type" }, 46 { "name": "formType2", "type": "FormData2::Type" } 47 ] 48 } 49 ] 37 "inputs": { 38 "Test": [ 39 { 40 "name": "FormCombo", 41 "description": "Combines an event type and form data type.", 42 "queue": "SCRIPT_MEMOIZED", 43 "members": [ 44 { "name": "eventType1", "type": "PlatformEvent1::Type" }, 45 { "name": "eventType2", "type": "PlatformEvent2::Type" }, 46 { "name": "formType1", "type": "FormData1::Type" }, 47 { "name": "formType2", "type": "FormData2::Type" } 48 ] 49 } 50 ] 51 } 50 52 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/generate-event-loop-shape-types.json
r163918 r178714 8 8 }, 9 9 10 "inputs": [ 11 { 12 "name": "ScalarInput", 13 "description": "", 14 "queue": "EVENT_LOOP", 15 "members": [ 16 { "name": "data", "type": "ScalarType" } 17 ] 18 }, 19 { 20 "name": "MapInput", 21 "description": "", 22 "queue": "EVENT_LOOP", 23 "members": [ 24 { "name": "data", "type": "MapType" } 25 ] 26 }, 27 { 28 "name": "SharedMapInput", 29 "description": "", 30 "queue": "EVENT_LOOP", 31 "members": [ 32 { "name": "data", "type": "SharedMapType" } 33 ] 34 } 35 ] 10 "inputs": { 11 "Test": [ 12 { 13 "name": "ScalarInput", 14 "description": "", 15 "queue": "EVENT_LOOP", 16 "members": [ 17 { "name": "data", "type": "ScalarType" } 18 ] 19 }, 20 { 21 "name": "MapInput", 22 "description": "", 23 "queue": "EVENT_LOOP", 24 "members": [ 25 { "name": "data", "type": "MapType" } 26 ] 27 }, 28 { 29 "name": "SharedMapInput", 30 "description": "", 31 "queue": "EVENT_LOOP", 32 "members": [ 33 { "name": "data", "type": "SharedMapType" } 34 ] 35 } 36 ] 37 } 36 38 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/generate-input-with-guard.json
r163918 r178714 7 7 }, 8 8 9 "inputs": [ 10 { 11 "name": "GetCurrentTime", 12 "description": "Supplies the system time to Date.now() and new Date().", 13 "queue": "SCRIPT_MEMOIZED", 14 "guard": "ENABLE(DUMMY_FEATURE)", 15 "members": [ 16 { "name": "currentTime", "type": "double" } 17 ] 18 }, 19 { 20 "name": "SetRandomSeed", 21 "description": "Sets the PRNG seed used by Math.random().", 22 "queue": "SCRIPT_MEMOIZED", 23 "members": [ 24 {"name": "randomSeed", "type": "uint64_t" } 25 ] 26 } 27 ] 9 "inputs": { 10 "Test": [ 11 { 12 "name": "GetCurrentTime", 13 "description": "Supplies the system time to Date.now() and new Date().", 14 "queue": "SCRIPT_MEMOIZED", 15 "guard": "ENABLE(DUMMY_FEATURE)", 16 "members": [ 17 { "name": "currentTime", "type": "double" } 18 ] 19 }, 20 { 21 "name": "SetRandomSeed", 22 "description": "Sets the PRNG seed used by Math.random().", 23 "queue": "SCRIPT_MEMOIZED", 24 "members": [ 25 {"name": "randomSeed", "type": "uint64_t" } 26 ] 27 } 28 ] 29 } 28 30 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/generate-input-with-vector-members.json
r171684 r178714 18 18 }, 19 19 20 "inputs": [ 21 { 22 "name": "ArrayOfThings", 23 "description": "Supplies arrays of things.", 24 "queue": "SCRIPT_MEMOIZED", 25 "members": [ 26 { "name": "doubles", "type": "double", "flags": ["VECTOR"] }, 27 { "name": "jsthings", "type": "JSThing", "flags": ["VECTOR"] }, 28 { "name": "webthings", "type": "WebThing", "flags": ["VECTOR"] } 29 ] 30 }, 31 { 32 "name": "SavedHistory", 33 "description": "Save history items.", 34 "queue": "SCRIPT_MEMOIZED", 35 "members": [ 36 { "name": "entries", "type": "HistoryItem", "flags": ["VECTOR"] } 37 ] 38 } 39 ] 20 "inputs": { 21 "Test": [ 22 { 23 "name": "ArrayOfThings", 24 "description": "Supplies arrays of things.", 25 "queue": "SCRIPT_MEMOIZED", 26 "members": [ 27 { "name": "doubles", "type": "double", "flags": ["VECTOR"] }, 28 { "name": "jsthings", "type": "JSThing", "flags": ["VECTOR"] }, 29 { "name": "webthings", "type": "WebThing", "flags": ["VECTOR"] } 30 ] 31 }, 32 { 33 "name": "SavedHistory", 34 "description": "Save history items.", 35 "queue": "SCRIPT_MEMOIZED", 36 "members": [ 37 { "name": "entries", "type": "HistoryItem", "flags": ["VECTOR"] } 38 ] 39 } 40 ] 41 } 40 42 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/generate-inputs-with-flags.json
r163918 r178714 6 6 }, 7 7 8 "inputs": [ 9 { 10 "name": "ScalarInput1", 11 "description": "", 12 "queue": "SCRIPT_MEMOIZED", 13 "members": [ 14 { "name": "data", "type": "ScalarType" } 15 ] 16 }, 17 { 18 "name": "ScalarInput2", 19 "description": "", 20 "queue": "SCRIPT_MEMOIZED", 21 "flags": ["CREATE_FROM_PAGE"], 22 "members": [ 23 { "name": "data", "type": "ScalarType" } 24 ] 25 } 26 ] 8 "inputs": { 9 "Test": [ 10 { 11 "name": "ScalarInput1", 12 "description": "", 13 "queue": "SCRIPT_MEMOIZED", 14 "members": [ 15 { "name": "data", "type": "ScalarType" } 16 ] 17 }, 18 { 19 "name": "ScalarInput2", 20 "description": "", 21 "queue": "SCRIPT_MEMOIZED", 22 "flags": ["CREATE_FROM_PAGE"], 23 "members": [ 24 { "name": "data", "type": "ScalarType" } 25 ] 26 } 27 ] 28 } 27 29 } -
trunk/Source/JavaScriptCore/replay/scripts/tests/generate-memoized-type-modes.json
r163918 r178714 7 7 }, 8 8 9 "inputs": [ 10 { 11 "name": "ScalarInput", 12 "description": "", 13 "queue": "SCRIPT_MEMOIZED", 14 "members": [ 15 { "name": "data", "type": "ScalarType" } 16 ] 17 }, 18 { 19 "name": "MapInput", 20 "description": "", 21 "queue": "SCRIPT_MEMOIZED", 22 "members": [ 23 { "name": "data", "type": "MapType" } 24 ] 25 } 26 ] 9 "inputs": { 10 "Test": [ 11 { 12 "name": "ScalarInput", 13 "description": "", 14 "queue": "SCRIPT_MEMOIZED", 15 "members": [ 16 { "name": "data", "type": "ScalarType" } 17 ] 18 }, 19 { 20 "name": "MapInput", 21 "description": "", 22 "queue": "SCRIPT_MEMOIZED", 23 "members": [ 24 { "name": "data", "type": "MapType" } 25 ] 26 } 27 ] 28 } 27 29 } -
trunk/Source/WebCore/ChangeLog
r178712 r178714 1 2015-01-19 Brian J. Burg <burg@cs.washington.edu> 2 3 Web Replay: code generator should take supplemental specifications and allow cross-framework references 4 https://bugs.webkit.org/show_bug.cgi?id=136312 5 6 Reviewed by Joseph Pecoraro. 7 8 Changes covered by existing input generator tests. 9 10 * DerivedSources.make: Add JSInputs.json as supplemental specification. 11 * replay/WebInputs.json: Moved common types to JSInputs.json. 12 1 13 2015-01-20 Csaba Osztrogonác <ossy@webkit.org> 2 14 -
trunk/Source/WebCore/DerivedSources.make
r178674 r178714 1163 1163 INPUT_GENERATOR_SPECIFICATIONS = \ 1164 1164 $(WebCore)/replay/WebInputs.json \ 1165 $(WebReplayScripts)/JSInputs.json \ 1165 1166 # 1166 1167 -
trunk/Source/WebCore/replay/WebInputs.json
r173034 r178714 1 1 { 2 2 "types": { 3 "Global": [4 { "name": "bool", "mode": "SCALAR" },5 { "name": "double", "mode": "SCALAR" },6 { "name": "uint32_t", "mode": "SCALAR", "description": "Unsigned 32-bit integer." },7 { "name": "uint64_t", "mode": "SCALAR", "description": "Unsigned 64-bit integer." },8 { "name": "int32_t", "mode": "SCALAR", "description": "Signed 32-bit integer." },9 { "name": "int64_t", "mode": "SCALAR", "description": "Signed 64-bit integer." }10 ],11 12 "WTF": [13 {14 "name": "String", "mode": "HEAVY_SCALAR",15 "header": "wtf/text/WTFString.h"16 }17 ],18 19 "JavaScriptCore": [20 {21 "name": "InputQueue", "mode": "SCALAR", "storage": "uint8_t",22 "flags": ["ENUM_CLASS"],23 "values": ["EventLoopInput", "LoaderMemoizedData", "ScriptMemoizedData", "Count"],24 "header": "replay/NondeterministicInput.h"25 }26 ],27 28 3 "WebCore": [ 29 4 { … … 158 133 }, 159 134 160 "inputs": [ 161 { 162 "name": "BeginSegmentSentinel", 163 "description": "A sentinel input to signal the start of a segment.", 164 "queue": "EVENT_LOOP", 165 "members": [ ] 166 }, 167 { 168 "name": "DocumentLastModifiedDate", 169 "description": "A fallback value used for the document's last modified date if the Last-Modified header can't be found or used.", 170 "queue": "SCRIPT_MEMOIZED", 171 "members": [ 172 { "name": "fallbackValue", "type": "double" } 173 ] 174 }, 175 { 176 "name": "EndSegmentSentinel", 177 "description": "A sentinel input to signal the end of a segment.", 178 "queue": "EVENT_LOOP", 179 "members": [ ] 180 }, 181 { 182 "name": "HandleMouseMove", 183 "description": "The embedder signalled a mouse move event.", 184 "queue": "EVENT_LOOP", 185 "members": [ 186 { "name": "platformEvent", "type": "PlatformMouseEvent" }, 187 { "name": "scrollbarTargeted", "type": "bool" } 188 ] 189 }, 190 { 191 "name": "HandleMousePress", 192 "description": "The embedder signalled a mouse press event.", 193 "queue": "EVENT_LOOP", 194 "members": [ 195 { "name": "platformEvent", "type": "PlatformMouseEvent" } 196 ] 197 }, 198 { 199 "name": "HandleMouseRelease", 200 "description": "The embedder signalled a mouse release event.", 201 "queue": "EVENT_LOOP", 202 "members": [ 203 { "name": "platformEvent", "type": "PlatformMouseEvent" } 204 ] 205 }, 206 { 207 "name": "HandleKeyPress", 208 "description": "The embedder signalled a key press event.", 209 "queue": "EVENT_LOOP", 210 "members": [ 211 { "name": "platformEvent", "type": "PlatformKeyboardEvent" } 212 ] 213 }, 214 { 215 "name": "HandleWheelEvent", 216 "description": "The embedder signalled a mouse wheel event.", 217 "queue": "EVENT_LOOP", 218 "members": [ 219 { "name": "platformEvent", "type": "PlatformWheelEvent" } 220 ] 221 }, 222 { 223 "name": "InitialNavigation", 224 "description": "Initiate the initial main frame navigation.", 225 "queue": "EVENT_LOOP", 226 "flags": ["HIDDEN", "CREATE_FROM_PAGE"], 227 "members": [ 228 { "name": "securityOrigin", "type": "SecurityOrigin" }, 229 { "name": "url", "type": "URL" }, 230 { "name": "referrer", "type": "String" } 231 ] 232 }, 233 { 234 "name": "FetchPluginData", 235 "description": "Plugin data was requested through DOMPluginArray or DOMMimeTypeArray.", 236 "queue": "SCRIPT_MEMOIZED", 237 "members": [ 238 { "name": "pluginData", "type": "PluginData" } 239 ] 240 }, 241 { 242 "name": "LogicalScrollPage", 243 "description": "The embedder signalled a logical scroll event.", 244 "queue": "EVENT_LOOP", 245 "members": [ 246 { "name": "direction", "type": "ScrollLogicalDirection" }, 247 { "name": "granularity", "type": "ScrollGranularity" } 248 ] 249 }, 250 { 251 "name": "ScrollPage", 252 "description": "The embedder signalled a scroll event.", 253 "queue": "EVENT_LOOP", 254 "members": [ 255 { "name": "direction", "type": "ScrollDirection" }, 256 { "name": "granularity", "type": "ScrollGranularity" } 257 ] 258 } 259 ] 135 "inputs": { 136 "WebCore": [ 137 { 138 "name": "BeginSegmentSentinel", 139 "description": "A sentinel input to signal the start of a segment.", 140 "queue": "EVENT_LOOP", 141 "members": [ ] 142 }, 143 { 144 "name": "DocumentLastModifiedDate", 145 "description": "A fallback value used for the document's last modified date if the Last-Modified header can't be found or used.", 146 "queue": "SCRIPT_MEMOIZED", 147 "members": [ 148 { "name": "fallbackValue", "type": "double" } 149 ] 150 }, 151 { 152 "name": "EndSegmentSentinel", 153 "description": "A sentinel input to signal the end of a segment.", 154 "queue": "EVENT_LOOP", 155 "members": [ ] 156 }, 157 { 158 "name": "HandleMouseMove", 159 "description": "The embedder signalled a mouse move event.", 160 "queue": "EVENT_LOOP", 161 "members": [ 162 { "name": "platformEvent", "type": "PlatformMouseEvent" }, 163 { "name": "scrollbarTargeted", "type": "bool" } 164 ] 165 }, 166 { 167 "name": "HandleMousePress", 168 "description": "The embedder signalled a mouse press event.", 169 "queue": "EVENT_LOOP", 170 "members": [ 171 { "name": "platformEvent", "type": "PlatformMouseEvent" } 172 ] 173 }, 174 { 175 "name": "HandleMouseRelease", 176 "description": "The embedder signalled a mouse release event.", 177 "queue": "EVENT_LOOP", 178 "members": [ 179 { "name": "platformEvent", "type": "PlatformMouseEvent" } 180 ] 181 }, 182 { 183 "name": "HandleKeyPress", 184 "description": "The embedder signalled a key press event.", 185 "queue": "EVENT_LOOP", 186 "members": [ 187 { "name": "platformEvent", "type": "PlatformKeyboardEvent" } 188 ] 189 }, 190 { 191 "name": "HandleWheelEvent", 192 "description": "The embedder signalled a mouse wheel event.", 193 "queue": "EVENT_LOOP", 194 "members": [ 195 { "name": "platformEvent", "type": "PlatformWheelEvent" } 196 ] 197 }, 198 { 199 "name": "InitialNavigation", 200 "description": "Initiate the initial main frame navigation.", 201 "queue": "EVENT_LOOP", 202 "flags": ["HIDDEN", "CREATE_FROM_PAGE"], 203 "members": [ 204 { "name": "securityOrigin", "type": "SecurityOrigin" }, 205 { "name": "url", "type": "URL" }, 206 { "name": "referrer", "type": "String" } 207 ] 208 }, 209 { 210 "name": "FetchPluginData", 211 "description": "Plugin data was requested through DOMPluginArray or DOMMimeTypeArray.", 212 "queue": "SCRIPT_MEMOIZED", 213 "members": [ 214 { "name": "pluginData", "type": "PluginData" } 215 ] 216 }, 217 { 218 "name": "LogicalScrollPage", 219 "description": "The embedder signalled a logical scroll event.", 220 "queue": "EVENT_LOOP", 221 "members": [ 222 { "name": "direction", "type": "ScrollLogicalDirection" }, 223 { "name": "granularity", "type": "ScrollGranularity" } 224 ] 225 }, 226 { 227 "name": "ScrollPage", 228 "description": "The embedder signalled a scroll event.", 229 "queue": "EVENT_LOOP", 230 "members": [ 231 { "name": "direction", "type": "ScrollDirection" }, 232 { "name": "granularity", "type": "ScrollGranularity" } 233 ] 234 } 235 ] 236 } 260 237 }
Note: See TracChangeset
for help on using the changeset viewer.