Changeset 212116 in webkit
- Timestamp:
- Feb 10, 2017 9:29:36 AM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r212035 r212116 1 2017-02-10 Brian Burg <bburg@apple.com> 2 3 [Cocoa] Web Inspector: generate an NS_ENUM containing platforms supported by the protocol code generator 4 https://bugs.webkit.org/show_bug.cgi?id=168019 5 <rdar://problem/28718990> 6 7 Reviewed by Joseph Pecoraro. 8 9 It's useful to have an symbolic value (not a string) for each of the supported platform values. 10 Generate this once per protocol for the Objective-C bindings. Covered by existing tests. 11 12 * inspector/scripts/codegen/generate_objc_header.py: 13 (ObjCHeaderGenerator.generate_output): 14 (ObjCHeaderGenerator._generate_enum_for_platforms): 15 Create an NS_ENUM for Platform values in Platforms. 16 17 * inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py: 18 (ObjCProtocolTypeConversionsHeaderGenerator.generate_output): 19 (ObjCProtocolTypeConversionsHeaderGenerator._generate_enum_conversion_for_platforms): 20 Add type conversion/parsing methods for the newly added enum. 21 22 * inspector/scripts/codegen/generator.py: 23 (Generator.stylized_name_for_enum_value): 24 (Generator.stylized_name_for_enum_value.replaceCallback): 25 Support arbitrary special-cased substrings in enums, not just all-caps. Add 'IOS' and 'MacOS'. 26 27 * inspector/scripts/codegen/models.py: 28 (Platforms): 29 Use lower-case string values for platform names, to avoid guesswork. 30 31 (Platforms.__metaclass__): 32 (Platforms.__metaclass__.__iter__): 33 Make it possible to iterate over Platform instances of Platforms. 34 35 * inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result: 36 * inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result: 37 * inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result: 38 * inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result: 39 * inspector/scripts/tests/generic/expected/domain-availability.json-result: 40 * inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result: 41 * inspector/scripts/tests/generic/expected/enum-values.json-result: 42 * inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result: 43 * inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result: 44 * inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result: 45 * inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result: 46 * inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result: 47 * inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result: 48 * inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result: 49 * inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result: 50 * inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result: 51 * inspector/scripts/tests/generic/expected/worker-supported-domains.json-result: 52 * inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result: 53 * inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result: 54 Rebaseline results. 55 1 56 2017-02-09 Filip Pizlo <fpizlo@apple.com> 2 57 -
trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_header.py
r210309 r212116 31 31 32 32 from generator import Generator, ucfirst 33 from models import ObjectType, EnumType 33 from models import ObjectType, EnumType, Platforms 34 34 from objc_generator import ObjCGenerator, join_type_and_name 35 35 from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates … … 74 74 sections.append(Template(ObjCTemplates.HeaderPrelude).substitute(None, **header_args)) 75 75 sections.append('\n'.join(filter(None, map(self._generate_forward_declarations, type_domains)))) 76 sections.append(self._generate_enum_for_platforms()) 76 77 sections.append('\n'.join(filter(None, map(self._generate_enums, type_domains)))) 77 78 sections.append('\n'.join(filter(None, map(self._generate_types, type_domains)))) … … 135 136 return '\n'.join(lines) 136 137 138 def _generate_enum_for_platforms(self): 139 objc_enum_name = '%sPlatform' % self.objc_prefix() 140 enum_values = [platform.name for platform in Platforms] 141 return self._generate_enum(objc_enum_name, enum_values) 142 137 143 def _generate_anonymous_enum_for_declaration(self, domain, declaration): 138 144 objc_enum_name = self.objc_enum_name_for_anonymous_enum_declaration(declaration) -
trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py
r210309 r212116 31 31 32 32 from generator import Generator 33 from models import EnumType, Frameworks 33 from models import EnumType, Frameworks, Platforms 34 34 from objc_generator import ObjCGenerator 35 35 from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates … … 70 70 sections.append(Template(ObjCTemplates.TypeConversionsHeaderPrelude).substitute(None, **header_args)) 71 71 sections.append(Template(ObjCTemplates.TypeConversionsHeaderStandard).substitute(None)) 72 sections.append(self._generate_enum_conversion_for_platforms()) 72 73 sections.extend(map(self._generate_enum_conversion_functions, domains)) 73 74 sections.append(Template(ObjCTemplates.TypeConversionsHeaderPostlude).substitute(None, **header_args)) … … 107 108 108 109 return '\n'.join(lines) 110 111 def _generate_enum_conversion_for_platforms(self): 112 objc_enum_name = '%sPlatform' % self.objc_prefix() 113 enum_values = [platform.name for platform in Platforms] 114 lines = [] 115 lines.append(self._generate_enum_objc_to_protocol_string(objc_enum_name, enum_values)) 116 lines.append(self._generate_enum_from_protocol_string(objc_enum_name, enum_values)) 117 return '\n\n'.join(lines) 109 118 110 119 def _generate_anonymous_enum_conversion_for_declaration(self, domain, declaration): -
trunk/Source/JavaScriptCore/inspector/scripts/codegen/generator.py
r210309 r212116 39 39 return str[:1].upper() + str[1:] 40 40 41 _ALWAYS_UPPERCASED_ENUM_VALUE_SUBSTRINGS = set(['API', 'CSS', 'DOM', 'HTML', 'JIT', 'XHR', 'XML']) 41 _ALWAYS_SPECIALCASED_ENUM_VALUE_SUBSTRINGS = set(['API', 'CSS', 'DOM', 'HTML', 'JIT', 'XHR', 'XML', 'IOS', 'MacOS']) 42 _ALWAYS_SPECIALCASED_ENUM_VALUE_LOOKUP_TABLE = dict([(s.upper(), s) for s in _ALWAYS_SPECIALCASED_ENUM_VALUE_SUBSTRINGS]) 42 43 43 44 # These objects are built manually by creating and setting InspectorValues. … … 239 240 @staticmethod 240 241 def stylized_name_for_enum_value(enum_value): 241 regex = '(%s)' % "|".join(_ALWAYS_ UPPERCASED_ENUM_VALUE_SUBSTRINGS)242 regex = '(%s)' % "|".join(_ALWAYS_SPECIALCASED_ENUM_VALUE_SUBSTRINGS) 242 243 243 244 def replaceCallback(match): 244 return match.group(1).upper()245 return _ALWAYS_SPECIALCASED_ENUM_VALUE_LOOKUP_TABLE[match.group(1).upper()] 245 246 246 247 # Split on hyphen, introduce camelcase, and force uppercasing of acronyms. -
trunk/Source/JavaScriptCore/inspector/scripts/codegen/models.py
r211075 r212116 133 133 134 134 class Platforms: 135 All = Platform(" All")135 All = Platform("all") 136 136 Generic = Platform("generic") 137 iOS = Platform("iOS") 138 macOS = Platform("macOS") 139 137 iOS = Platform("ios") 138 macOS = Platform("macos") 139 140 # Allow iteration over all platforms. See <http://stackoverflow.com/questions/5434400/>. 141 class __metaclass__(type): 142 def __iter__(self): 143 for attr in dir(Platforms): 144 if not attr.startswith("__"): 145 yield getattr(Platforms, attr) 140 146 141 147 class TypeReference: -
trunk/Source/JavaScriptCore/inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result
r210852 r212116 895 895 @class TestProtocolNetworkError; 896 896 897 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 898 TestProtocolPlatformAll, 899 TestProtocolPlatformGeneric, 900 TestProtocolPlatformIOS, 901 TestProtocolPlatformMacOS, 902 }; 903 897 904 898 905 … … 1002 1009 ObjCEnumType fromProtocolString(const String& value); 1003 1010 1011 inline String toProtocolString(TestProtocolPlatform value) 1012 { 1013 switch(value) { 1014 case TestProtocolPlatformAll: 1015 return ASCIILiteral("all"); 1016 case TestProtocolPlatformGeneric: 1017 return ASCIILiteral("generic"); 1018 case TestProtocolPlatformIOS: 1019 return ASCIILiteral("ios"); 1020 case TestProtocolPlatformMacOS: 1021 return ASCIILiteral("macos"); 1022 } 1023 } 1024 1025 template<> 1026 inline TestProtocolPlatform fromProtocolString(const String& value) 1027 { 1028 if (value == "all") 1029 return TestProtocolPlatformAll; 1030 if (value == "generic") 1031 return TestProtocolPlatformGeneric; 1032 if (value == "ios") 1033 return TestProtocolPlatformIOS; 1034 if (value == "macos") 1035 return TestProtocolPlatformMacOS; 1036 ASSERT_NOT_REACHED(); 1037 return TestProtocolPlatformAll; 1038 } 1039 1004 1040 1005 1041 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result
r210852 r212116 1283 1283 @class TestProtocolDatabaseError; 1284 1284 1285 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 1286 TestProtocolPlatformAll, 1287 TestProtocolPlatformGeneric, 1288 TestProtocolPlatformIOS, 1289 TestProtocolPlatformMacOS, 1290 }; 1291 1285 1292 1286 1293 typedef NS_ENUM(NSInteger, TestProtocolDatabasePrimaryColors) { … … 1421 1428 ObjCEnumType fromProtocolString(const String& value); 1422 1429 1430 inline String toProtocolString(TestProtocolPlatform value) 1431 { 1432 switch(value) { 1433 case TestProtocolPlatformAll: 1434 return ASCIILiteral("all"); 1435 case TestProtocolPlatformGeneric: 1436 return ASCIILiteral("generic"); 1437 case TestProtocolPlatformIOS: 1438 return ASCIILiteral("ios"); 1439 case TestProtocolPlatformMacOS: 1440 return ASCIILiteral("macos"); 1441 } 1442 } 1443 1444 template<> 1445 inline TestProtocolPlatform fromProtocolString(const String& value) 1446 { 1447 if (value == "all") 1448 return TestProtocolPlatformAll; 1449 if (value == "generic") 1450 return TestProtocolPlatformGeneric; 1451 if (value == "ios") 1452 return TestProtocolPlatformIOS; 1453 if (value == "macos") 1454 return TestProtocolPlatformMacOS; 1455 ASSERT_NOT_REACHED(); 1456 return TestProtocolPlatformAll; 1457 } 1458 1423 1459 1424 1460 inline String toProtocolString(TestProtocolDatabasePrimaryColors value) -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result
r210852 r212116 1140 1140 @class TestProtocolDatabaseError; 1141 1141 1142 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 1143 TestProtocolPlatformAll, 1144 TestProtocolPlatformGeneric, 1145 TestProtocolPlatformIOS, 1146 TestProtocolPlatformMacOS, 1147 }; 1148 1142 1149 1143 1150 typedef NS_ENUM(NSInteger, TestProtocolDatabasePrimaryColors) { … … 1275 1282 template<typename ObjCEnumType> 1276 1283 ObjCEnumType fromProtocolString(const String& value); 1284 1285 inline String toProtocolString(TestProtocolPlatform value) 1286 { 1287 switch(value) { 1288 case TestProtocolPlatformAll: 1289 return ASCIILiteral("all"); 1290 case TestProtocolPlatformGeneric: 1291 return ASCIILiteral("generic"); 1292 case TestProtocolPlatformIOS: 1293 return ASCIILiteral("ios"); 1294 case TestProtocolPlatformMacOS: 1295 return ASCIILiteral("macos"); 1296 } 1297 } 1298 1299 template<> 1300 inline TestProtocolPlatform fromProtocolString(const String& value) 1301 { 1302 if (value == "all") 1303 return TestProtocolPlatformAll; 1304 if (value == "generic") 1305 return TestProtocolPlatformGeneric; 1306 if (value == "ios") 1307 return TestProtocolPlatformIOS; 1308 if (value == "macos") 1309 return TestProtocolPlatformMacOS; 1310 ASSERT_NOT_REACHED(); 1311 return TestProtocolPlatformAll; 1312 } 1277 1313 1278 1314 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result
r210852 r212116 647 647 648 648 649 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 650 TestProtocolPlatformAll, 651 TestProtocolPlatformGeneric, 652 TestProtocolPlatformIOS, 653 TestProtocolPlatformMacOS, 654 }; 655 649 656 650 657 … … 738 745 ObjCEnumType fromProtocolString(const String& value); 739 746 747 inline String toProtocolString(TestProtocolPlatform value) 748 { 749 switch(value) { 750 case TestProtocolPlatformAll: 751 return ASCIILiteral("all"); 752 case TestProtocolPlatformGeneric: 753 return ASCIILiteral("generic"); 754 case TestProtocolPlatformIOS: 755 return ASCIILiteral("ios"); 756 case TestProtocolPlatformMacOS: 757 return ASCIILiteral("macos"); 758 } 759 } 760 761 template<> 762 inline TestProtocolPlatform fromProtocolString(const String& value) 763 { 764 if (value == "all") 765 return TestProtocolPlatformAll; 766 if (value == "generic") 767 return TestProtocolPlatformGeneric; 768 if (value == "ios") 769 return TestProtocolPlatformIOS; 770 if (value == "macos") 771 return TestProtocolPlatformMacOS; 772 ASSERT_NOT_REACHED(); 773 return TestProtocolPlatformAll; 774 } 775 740 776 } // namespace Inspector 741 777 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-availability.json-result
r211075 r212116 893 893 894 894 895 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 896 TestProtocolPlatformAll, 897 TestProtocolPlatformGeneric, 898 TestProtocolPlatformIOS, 899 TestProtocolPlatformMacOS, 900 }; 901 895 902 896 903 … … 992 999 ObjCEnumType fromProtocolString(const String& value); 993 1000 1001 inline String toProtocolString(TestProtocolPlatform value) 1002 { 1003 switch(value) { 1004 case TestProtocolPlatformAll: 1005 return ASCIILiteral("all"); 1006 case TestProtocolPlatformGeneric: 1007 return ASCIILiteral("generic"); 1008 case TestProtocolPlatformIOS: 1009 return ASCIILiteral("ios"); 1010 case TestProtocolPlatformMacOS: 1011 return ASCIILiteral("macos"); 1012 } 1013 } 1014 1015 template<> 1016 inline TestProtocolPlatform fromProtocolString(const String& value) 1017 { 1018 if (value == "all") 1019 return TestProtocolPlatformAll; 1020 if (value == "generic") 1021 return TestProtocolPlatformGeneric; 1022 if (value == "ios") 1023 return TestProtocolPlatformIOS; 1024 if (value == "macos") 1025 return TestProtocolPlatformMacOS; 1026 ASSERT_NOT_REACHED(); 1027 return TestProtocolPlatformAll; 1028 } 1029 994 1030 } // namespace Inspector 995 1031 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result
r210852 r212116 1150 1150 1151 1151 1152 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 1153 TestProtocolPlatformAll, 1154 TestProtocolPlatformGeneric, 1155 TestProtocolPlatformIOS, 1156 TestProtocolPlatformMacOS, 1157 }; 1158 1152 1159 1153 1160 … … 1255 1262 ObjCEnumType fromProtocolString(const String& value); 1256 1263 1264 inline String toProtocolString(TestProtocolPlatform value) 1265 { 1266 switch(value) { 1267 case TestProtocolPlatformAll: 1268 return ASCIILiteral("all"); 1269 case TestProtocolPlatformGeneric: 1270 return ASCIILiteral("generic"); 1271 case TestProtocolPlatformIOS: 1272 return ASCIILiteral("ios"); 1273 case TestProtocolPlatformMacOS: 1274 return ASCIILiteral("macos"); 1275 } 1276 } 1277 1278 template<> 1279 inline TestProtocolPlatform fromProtocolString(const String& value) 1280 { 1281 if (value == "all") 1282 return TestProtocolPlatformAll; 1283 if (value == "generic") 1284 return TestProtocolPlatformGeneric; 1285 if (value == "ios") 1286 return TestProtocolPlatformIOS; 1287 if (value == "macos") 1288 return TestProtocolPlatformMacOS; 1289 ASSERT_NOT_REACHED(); 1290 return TestProtocolPlatformAll; 1291 } 1292 1257 1293 1258 1294 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/enum-values.json-result
r210852 r212116 930 930 931 931 932 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 933 TestProtocolPlatformAll, 934 TestProtocolPlatformGeneric, 935 TestProtocolPlatformIOS, 936 TestProtocolPlatformMacOS, 937 }; 938 932 939 933 940 typedef NS_ENUM(NSInteger, TestProtocolTypeDomainEnum) { … … 1034 1041 template<typename ObjCEnumType> 1035 1042 ObjCEnumType fromProtocolString(const String& value); 1043 1044 inline String toProtocolString(TestProtocolPlatform value) 1045 { 1046 switch(value) { 1047 case TestProtocolPlatformAll: 1048 return ASCIILiteral("all"); 1049 case TestProtocolPlatformGeneric: 1050 return ASCIILiteral("generic"); 1051 case TestProtocolPlatformIOS: 1052 return ASCIILiteral("ios"); 1053 case TestProtocolPlatformMacOS: 1054 return ASCIILiteral("macos"); 1055 } 1056 } 1057 1058 template<> 1059 inline TestProtocolPlatform fromProtocolString(const String& value) 1060 { 1061 if (value == "all") 1062 return TestProtocolPlatformAll; 1063 if (value == "generic") 1064 return TestProtocolPlatformGeneric; 1065 if (value == "ios") 1066 return TestProtocolPlatformIOS; 1067 if (value == "macos") 1068 return TestProtocolPlatformMacOS; 1069 ASSERT_NOT_REACHED(); 1070 return TestProtocolPlatformAll; 1071 } 1036 1072 1037 1073 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result
r210852 r212116 883 883 @class TestProtocolDatabaseError; 884 884 885 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 886 TestProtocolPlatformAll, 887 TestProtocolPlatformGeneric, 888 TestProtocolPlatformIOS, 889 TestProtocolPlatformMacOS, 890 }; 891 885 892 886 893 … … 988 995 ObjCEnumType fromProtocolString(const String& value); 989 996 997 inline String toProtocolString(TestProtocolPlatform value) 998 { 999 switch(value) { 1000 case TestProtocolPlatformAll: 1001 return ASCIILiteral("all"); 1002 case TestProtocolPlatformGeneric: 1003 return ASCIILiteral("generic"); 1004 case TestProtocolPlatformIOS: 1005 return ASCIILiteral("ios"); 1006 case TestProtocolPlatformMacOS: 1007 return ASCIILiteral("macos"); 1008 } 1009 } 1010 1011 template<> 1012 inline TestProtocolPlatform fromProtocolString(const String& value) 1013 { 1014 if (value == "all") 1015 return TestProtocolPlatformAll; 1016 if (value == "generic") 1017 return TestProtocolPlatformGeneric; 1018 if (value == "ios") 1019 return TestProtocolPlatformIOS; 1020 if (value == "macos") 1021 return TestProtocolPlatformMacOS; 1022 ASSERT_NOT_REACHED(); 1023 return TestProtocolPlatformAll; 1024 } 1025 990 1026 991 1027 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result
r210852 r212116 922 922 @class TestProtocolNetwork2NetworkError; 923 923 924 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 925 TestProtocolPlatformAll, 926 TestProtocolPlatformGeneric, 927 TestProtocolPlatformIOS, 928 TestProtocolPlatformMacOS, 929 }; 930 924 931 925 932 … … 1029 1036 ObjCEnumType fromProtocolString(const String& value); 1030 1037 1038 inline String toProtocolString(TestProtocolPlatform value) 1039 { 1040 switch(value) { 1041 case TestProtocolPlatformAll: 1042 return ASCIILiteral("all"); 1043 case TestProtocolPlatformGeneric: 1044 return ASCIILiteral("generic"); 1045 case TestProtocolPlatformIOS: 1046 return ASCIILiteral("ios"); 1047 case TestProtocolPlatformMacOS: 1048 return ASCIILiteral("macos"); 1049 } 1050 } 1051 1052 template<> 1053 inline TestProtocolPlatform fromProtocolString(const String& value) 1054 { 1055 if (value == "all") 1056 return TestProtocolPlatformAll; 1057 if (value == "generic") 1058 return TestProtocolPlatformGeneric; 1059 if (value == "ios") 1060 return TestProtocolPlatformIOS; 1061 if (value == "macos") 1062 return TestProtocolPlatformMacOS; 1063 ASSERT_NOT_REACHED(); 1064 return TestProtocolPlatformAll; 1065 } 1066 1031 1067 1032 1068 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result
r210852 r212116 657 657 658 658 659 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 660 TestProtocolPlatformAll, 661 TestProtocolPlatformGeneric, 662 TestProtocolPlatformIOS, 663 TestProtocolPlatformMacOS, 664 }; 665 659 666 660 667 … … 747 754 template<typename ObjCEnumType> 748 755 ObjCEnumType fromProtocolString(const String& value); 756 757 inline String toProtocolString(TestProtocolPlatform value) 758 { 759 switch(value) { 760 case TestProtocolPlatformAll: 761 return ASCIILiteral("all"); 762 case TestProtocolPlatformGeneric: 763 return ASCIILiteral("generic"); 764 case TestProtocolPlatformIOS: 765 return ASCIILiteral("ios"); 766 case TestProtocolPlatformMacOS: 767 return ASCIILiteral("macos"); 768 } 769 } 770 771 template<> 772 inline TestProtocolPlatform fromProtocolString(const String& value) 773 { 774 if (value == "all") 775 return TestProtocolPlatformAll; 776 if (value == "generic") 777 return TestProtocolPlatformGeneric; 778 if (value == "ios") 779 return TestProtocolPlatformIOS; 780 if (value == "macos") 781 return TestProtocolPlatformMacOS; 782 ASSERT_NOT_REACHED(); 783 return TestProtocolPlatformAll; 784 } 749 785 750 786 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result
r210852 r212116 780 780 @class TestProtocolRuntimeKeyPath; 781 781 782 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 783 TestProtocolPlatformAll, 784 TestProtocolPlatformGeneric, 785 TestProtocolPlatformIOS, 786 TestProtocolPlatformMacOS, 787 }; 788 782 789 783 790 typedef NS_ENUM(NSInteger, TestProtocolRuntimeKeyPathType) { … … 885 892 ObjCEnumType fromProtocolString(const String& value); 886 893 894 inline String toProtocolString(TestProtocolPlatform value) 895 { 896 switch(value) { 897 case TestProtocolPlatformAll: 898 return ASCIILiteral("all"); 899 case TestProtocolPlatformGeneric: 900 return ASCIILiteral("generic"); 901 case TestProtocolPlatformIOS: 902 return ASCIILiteral("ios"); 903 case TestProtocolPlatformMacOS: 904 return ASCIILiteral("macos"); 905 } 906 } 907 908 template<> 909 inline TestProtocolPlatform fromProtocolString(const String& value) 910 { 911 if (value == "all") 912 return TestProtocolPlatformAll; 913 if (value == "generic") 914 return TestProtocolPlatformGeneric; 915 if (value == "ios") 916 return TestProtocolPlatformIOS; 917 if (value == "macos") 918 return TestProtocolPlatformMacOS; 919 ASSERT_NOT_REACHED(); 920 return TestProtocolPlatformAll; 921 } 922 887 923 888 924 inline String toProtocolString(TestProtocolRuntimeKeyPathType value) -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result
r210852 r212116 652 652 653 653 654 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 655 TestProtocolPlatformAll, 656 TestProtocolPlatformGeneric, 657 TestProtocolPlatformIOS, 658 TestProtocolPlatformMacOS, 659 }; 660 654 661 655 662 … … 742 749 template<typename ObjCEnumType> 743 750 ObjCEnumType fromProtocolString(const String& value); 751 752 inline String toProtocolString(TestProtocolPlatform value) 753 { 754 switch(value) { 755 case TestProtocolPlatformAll: 756 return ASCIILiteral("all"); 757 case TestProtocolPlatformGeneric: 758 return ASCIILiteral("generic"); 759 case TestProtocolPlatformIOS: 760 return ASCIILiteral("ios"); 761 case TestProtocolPlatformMacOS: 762 return ASCIILiteral("macos"); 763 } 764 } 765 766 template<> 767 inline TestProtocolPlatform fromProtocolString(const String& value) 768 { 769 if (value == "all") 770 return TestProtocolPlatformAll; 771 if (value == "generic") 772 return TestProtocolPlatformGeneric; 773 if (value == "ios") 774 return TestProtocolPlatformIOS; 775 if (value == "macos") 776 return TestProtocolPlatformMacOS; 777 ASSERT_NOT_REACHED(); 778 return TestProtocolPlatformAll; 779 } 744 780 745 781 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result
r210852 r212116 730 730 731 731 732 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 733 TestProtocolPlatformAll, 734 TestProtocolPlatformGeneric, 735 TestProtocolPlatformIOS, 736 TestProtocolPlatformMacOS, 737 }; 738 732 739 733 740 typedef NS_ENUM(NSInteger, TestProtocolDebuggerReason) { … … 825 832 template<typename ObjCEnumType> 826 833 ObjCEnumType fromProtocolString(const String& value); 834 835 inline String toProtocolString(TestProtocolPlatform value) 836 { 837 switch(value) { 838 case TestProtocolPlatformAll: 839 return ASCIILiteral("all"); 840 case TestProtocolPlatformGeneric: 841 return ASCIILiteral("generic"); 842 case TestProtocolPlatformIOS: 843 return ASCIILiteral("ios"); 844 case TestProtocolPlatformMacOS: 845 return ASCIILiteral("macos"); 846 } 847 } 848 849 template<> 850 inline TestProtocolPlatform fromProtocolString(const String& value) 851 { 852 if (value == "all") 853 return TestProtocolPlatformAll; 854 if (value == "generic") 855 return TestProtocolPlatformGeneric; 856 if (value == "ios") 857 return TestProtocolPlatformIOS; 858 if (value == "macos") 859 return TestProtocolPlatformMacOS; 860 ASSERT_NOT_REACHED(); 861 return TestProtocolPlatformAll; 862 } 827 863 828 864 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result
r210852 r212116 750 750 751 751 752 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 753 TestProtocolPlatformAll, 754 TestProtocolPlatformGeneric, 755 TestProtocolPlatformIOS, 756 TestProtocolPlatformMacOS, 757 }; 758 752 759 753 760 typedef NS_ENUM(NSInteger, TestProtocolRuntimeFarmAnimals) { … … 853 860 template<typename ObjCEnumType> 854 861 ObjCEnumType fromProtocolString(const String& value); 862 863 inline String toProtocolString(TestProtocolPlatform value) 864 { 865 switch(value) { 866 case TestProtocolPlatformAll: 867 return ASCIILiteral("all"); 868 case TestProtocolPlatformGeneric: 869 return ASCIILiteral("generic"); 870 case TestProtocolPlatformIOS: 871 return ASCIILiteral("ios"); 872 case TestProtocolPlatformMacOS: 873 return ASCIILiteral("macos"); 874 } 875 } 876 877 template<> 878 inline TestProtocolPlatform fromProtocolString(const String& value) 879 { 880 if (value == "all") 881 return TestProtocolPlatformAll; 882 if (value == "generic") 883 return TestProtocolPlatformGeneric; 884 if (value == "ios") 885 return TestProtocolPlatformIOS; 886 if (value == "macos") 887 return TestProtocolPlatformMacOS; 888 ASSERT_NOT_REACHED(); 889 return TestProtocolPlatformAll; 890 } 855 891 856 892 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result
r210852 r212116 1122 1122 @class TestProtocolTestParameterBundle; 1123 1123 1124 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 1125 TestProtocolPlatformAll, 1126 TestProtocolPlatformGeneric, 1127 TestProtocolPlatformIOS, 1128 TestProtocolPlatformMacOS, 1129 }; 1130 1124 1131 1125 1132 … … 1279 1286 ObjCEnumType fromProtocolString(const String& value); 1280 1287 1288 inline String toProtocolString(TestProtocolPlatform value) 1289 { 1290 switch(value) { 1291 case TestProtocolPlatformAll: 1292 return ASCIILiteral("all"); 1293 case TestProtocolPlatformGeneric: 1294 return ASCIILiteral("generic"); 1295 case TestProtocolPlatformIOS: 1296 return ASCIILiteral("ios"); 1297 case TestProtocolPlatformMacOS: 1298 return ASCIILiteral("macos"); 1299 } 1300 } 1301 1302 template<> 1303 inline TestProtocolPlatform fromProtocolString(const String& value) 1304 { 1305 if (value == "all") 1306 return TestProtocolPlatformAll; 1307 if (value == "generic") 1308 return TestProtocolPlatformGeneric; 1309 if (value == "ios") 1310 return TestProtocolPlatformIOS; 1311 if (value == "macos") 1312 return TestProtocolPlatformMacOS; 1313 ASSERT_NOT_REACHED(); 1314 return TestProtocolPlatformAll; 1315 } 1316 1281 1317 1282 1318 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result
r210852 r212116 1079 1079 @class TestProtocolTestRecursiveObject2; 1080 1080 1081 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 1082 TestProtocolPlatformAll, 1083 TestProtocolPlatformGeneric, 1084 TestProtocolPlatformIOS, 1085 TestProtocolPlatformMacOS, 1086 }; 1087 1081 1088 1082 1089 typedef NS_ENUM(NSInteger, TestProtocolTestUncastedAnimals) { … … 1208 1215 ObjCEnumType fromProtocolString(const String& value); 1209 1216 1217 inline String toProtocolString(TestProtocolPlatform value) 1218 { 1219 switch(value) { 1220 case TestProtocolPlatformAll: 1221 return ASCIILiteral("all"); 1222 case TestProtocolPlatformGeneric: 1223 return ASCIILiteral("generic"); 1224 case TestProtocolPlatformIOS: 1225 return ASCIILiteral("ios"); 1226 case TestProtocolPlatformMacOS: 1227 return ASCIILiteral("macos"); 1228 } 1229 } 1230 1231 template<> 1232 inline TestProtocolPlatform fromProtocolString(const String& value) 1233 { 1234 if (value == "all") 1235 return TestProtocolPlatformAll; 1236 if (value == "generic") 1237 return TestProtocolPlatformGeneric; 1238 if (value == "ios") 1239 return TestProtocolPlatformIOS; 1240 if (value == "macos") 1241 return TestProtocolPlatformMacOS; 1242 ASSERT_NOT_REACHED(); 1243 return TestProtocolPlatformAll; 1244 } 1245 1210 1246 1211 1247 inline String toProtocolString(TestProtocolTestUncastedAnimals value) -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/worker-supported-domains.json-result
r211075 r212116 894 894 895 895 896 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 897 TestProtocolPlatformAll, 898 TestProtocolPlatformGeneric, 899 TestProtocolPlatformIOS, 900 TestProtocolPlatformMacOS, 901 }; 902 896 903 897 904 … … 993 1000 ObjCEnumType fromProtocolString(const String& value); 994 1001 1002 inline String toProtocolString(TestProtocolPlatform value) 1003 { 1004 switch(value) { 1005 case TestProtocolPlatformAll: 1006 return ASCIILiteral("all"); 1007 case TestProtocolPlatformGeneric: 1008 return ASCIILiteral("generic"); 1009 case TestProtocolPlatformIOS: 1010 return ASCIILiteral("ios"); 1011 case TestProtocolPlatformMacOS: 1012 return ASCIILiteral("macos"); 1013 } 1014 } 1015 1016 template<> 1017 inline TestProtocolPlatform fromProtocolString(const String& value) 1018 { 1019 if (value == "all") 1020 return TestProtocolPlatformAll; 1021 if (value == "generic") 1022 return TestProtocolPlatformGeneric; 1023 if (value == "ios") 1024 return TestProtocolPlatformIOS; 1025 if (value == "macos") 1026 return TestProtocolPlatformMacOS; 1027 ASSERT_NOT_REACHED(); 1028 return TestProtocolPlatformAll; 1029 } 1030 995 1031 } // namespace Inspector 996 1032 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result
r210852 r212116 647 647 648 648 649 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 650 TestProtocolPlatformAll, 651 TestProtocolPlatformGeneric, 652 TestProtocolPlatformIOS, 653 TestProtocolPlatformMacOS, 654 }; 655 649 656 650 657 … … 738 745 ObjCEnumType fromProtocolString(const String& value); 739 746 747 inline String toProtocolString(TestProtocolPlatform value) 748 { 749 switch(value) { 750 case TestProtocolPlatformAll: 751 return ASCIILiteral("all"); 752 case TestProtocolPlatformGeneric: 753 return ASCIILiteral("generic"); 754 case TestProtocolPlatformIOS: 755 return ASCIILiteral("ios"); 756 case TestProtocolPlatformMacOS: 757 return ASCIILiteral("macos"); 758 } 759 } 760 761 template<> 762 inline TestProtocolPlatform fromProtocolString(const String& value) 763 { 764 if (value == "all") 765 return TestProtocolPlatformAll; 766 if (value == "generic") 767 return TestProtocolPlatformGeneric; 768 if (value == "ios") 769 return TestProtocolPlatformIOS; 770 if (value == "macos") 771 return TestProtocolPlatformMacOS; 772 ASSERT_NOT_REACHED(); 773 return TestProtocolPlatformAll; 774 } 775 740 776 } // namespace Inspector 741 777 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result
r210852 r212116 895 895 @class TestProtocolNetworkError; 896 896 897 typedef NS_ENUM(NSInteger, TestProtocolPlatform) { 898 TestProtocolPlatformAll, 899 TestProtocolPlatformGeneric, 900 TestProtocolPlatformIOS, 901 TestProtocolPlatformMacOS, 902 }; 903 897 904 898 905 … … 1002 1009 ObjCEnumType fromProtocolString(const String& value); 1003 1010 1011 inline String toProtocolString(TestProtocolPlatform value) 1012 { 1013 switch(value) { 1014 case TestProtocolPlatformAll: 1015 return ASCIILiteral("all"); 1016 case TestProtocolPlatformGeneric: 1017 return ASCIILiteral("generic"); 1018 case TestProtocolPlatformIOS: 1019 return ASCIILiteral("ios"); 1020 case TestProtocolPlatformMacOS: 1021 return ASCIILiteral("macos"); 1022 } 1023 } 1024 1025 template<> 1026 inline TestProtocolPlatform fromProtocolString(const String& value) 1027 { 1028 if (value == "all") 1029 return TestProtocolPlatformAll; 1030 if (value == "generic") 1031 return TestProtocolPlatformGeneric; 1032 if (value == "ios") 1033 return TestProtocolPlatformIOS; 1034 if (value == "macos") 1035 return TestProtocolPlatformMacOS; 1036 ASSERT_NOT_REACHED(); 1037 return TestProtocolPlatformAll; 1038 } 1039 1004 1040 1005 1041 -
trunk/Source/WebKit2/ChangeLog
r212115 r212116 1 2017-02-10 Brian Burg <bburg@apple.com> 2 3 [Cocoa] Web Inspector: generate an NS_ENUM containing platforms supported by the protocol code generator 4 https://bugs.webkit.org/show_bug.cgi?id=168019 5 <rdar://problem/28718990> 6 7 Reviewed by Joseph Pecoraro. 8 9 * UIProcess/Automation/Automation.json: Fix the platform values to be lowercase. 10 1 11 2017-02-10 Brian Burg <bburg@apple.com> 2 12 -
trunk/Source/WebKit2/UIProcess/Automation/Automation.json
r210927 r212116 249 249 "name": "resizeWindowOfBrowsingContext", 250 250 "description": "Resizes the window of the specified browsing context to the specified size.", 251 "platform": "mac OS",251 "platform": "macos", 252 252 "parameters": [ 253 253 { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context to be resized." }, … … 258 258 "name": "moveWindowOfBrowsingContext", 259 259 "description": "Moves the window of the specified browsing context to the specified position.", 260 "platform": "mac OS",260 "platform": "macos", 261 261 "parameters": [ 262 262 { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context to be moved." }, … … 300 300 "name": "inspectBrowsingContext", 301 301 "description": "Inspect the specified browsing context using Web Inspector.", 302 "platform": "mac OS",302 "platform": "macos", 303 303 "parameters": [ 304 304 { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be inspected." },
Note: See TracChangeset
for help on using the changeset viewer.