Changeset 262424 in webkit
- Timestamp:
- Jun 2, 2020, 9:10:54 AM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r262412 r262424 1 2020-06-02 Rob Buis <[email protected]> 2 3 Make generated C++ code use modern C++ 4 https://bugs.webkit.org/show_bug.cgi?id=190714 5 6 Reviewed by Sam Weinig. 7 8 Update inspector protocol generator and rebaseline the tests. 9 10 * inspector/scripts/codegen/cpp_generator_templates.py: 11 * inspector/scripts/codegen/generate_cpp_protocol_types_header.py: 12 * inspector/scripts/tests/expected/commands-with-async-attribute.json-result: 13 * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result: 14 * inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result: 15 * inspector/scripts/tests/expected/enum-values.json-result: 16 * inspector/scripts/tests/expected/events-with-optional-parameters.json-result: 17 * inspector/scripts/tests/expected/same-type-id-different-domain.json-result: 18 * inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result: 19 * inspector/scripts/tests/expected/type-declaration-array-type.json-result: 20 * inspector/scripts/tests/expected/type-declaration-enum-type.json-result: 21 * inspector/scripts/tests/expected/type-declaration-object-type.json-result: 22 * inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result: 23 * yarr/generateYarrUnicodePropertyTables.py: 24 1 25 2020-06-02 Paulo Matos <[email protected]> 2 26 -
trunk/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator_templates.py
r262203 r262424 140 140 message->getObject("params"_s, parameters); 141 141 142 typedef void (${domainName}BackendDispatcher::*CallHandler)(long requestId, RefPtr<JSON::Object>&& message);143 typedef HashMap<String, CallHandler> DispatchMap;142 using CallHandler = void (${domainName}BackendDispatcher::*)(long requestId, RefPtr<JSON::Object>&& message); 143 using DispatchMap = HashMap<String, CallHandler>; 144 144 static NeverDestroyed<DispatchMap> dispatchMap; 145 145 if (dispatchMap.get().isEmpty()) { -
trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py
r262243 r262424 170 170 if len(declaration.description) > 0: 171 171 typedef_lines.append('/* %s */' % declaration.description) 172 typedef_lines.append(' typedef %s %s;' % (primitive_name, declaration.type_name))172 typedef_lines.append('using %s = %s;' % (declaration.type_name, primitive_name)) 173 173 sections.append(self.wrap_with_guard_for_condition(declaration.condition, '\n'.join(typedef_lines))) 174 174 … … 178 178 if len(declaration.description) > 0: 179 179 typedef_lines.append('/* %s */' % declaration.description) 180 typedef_lines.append(' typedef JSON::ArrayOf<%s> %s;' % (element_type, declaration.type_name))180 typedef_lines.append('using %s = JSON::ArrayOf<%s>;' % (declaration.type_name, element_type)) 181 181 sections.append(self.wrap_with_guard_for_condition(declaration.condition, '\n'.join(typedef_lines))) 182 182 … … 487 487 enum_lines.append('template<>') 488 488 enum_lines.append('struct DefaultHash<Inspector::Protocol::%s::%s> {' % (domain.domain_name, enum_type.raw_name())) 489 enum_lines.append(' typedef IntHash<Inspector::Protocol::%s::%s> Hash;' % (domain.domain_name, enum_type.raw_name()))489 enum_lines.append(' using Hash = IntHash<Inspector::Protocol::%s::%s>;' % (domain.domain_name, enum_type.raw_name())) 490 490 enum_lines.append('};') 491 491 domain_lines.append(self.wrap_with_guard_for_condition(enum_type.declaration().condition, '\n'.join(enum_lines))) -
trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-async-attribute.json-result
r262203 r262424 619 619 namespace Database { 620 620 /* Unique identifier of Database object. */ 621 typedef int DatabaseId;622 typedef JSON::ArrayOf<Inspector::Protocol::Database::PrimaryColors> ColorList;621 using DatabaseId = int; 622 using ColorList = JSON::ArrayOf<Inspector::Protocol::Database::PrimaryColors>; 623 623 } // Database 624 624 // End of typedefs. … … 735 735 template<> 736 736 struct DefaultHash<Inspector::Protocol::Database::PrimaryColors> { 737 typedef IntHash<Inspector::Protocol::Database::PrimaryColors> Hash;737 using Hash = IntHash<Inspector::Protocol::Database::PrimaryColors>; 738 738 }; 739 739 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result
r262203 r262424 530 530 namespace Database { 531 531 /* Unique identifier of Database object. */ 532 typedef int DatabaseId;533 typedef JSON::ArrayOf<Inspector::Protocol::Database::PrimaryColors> ColorList;532 using DatabaseId = int; 533 using ColorList = JSON::ArrayOf<Inspector::Protocol::Database::PrimaryColors>; 534 534 } // Database 535 535 // End of typedefs. … … 646 646 template<> 647 647 struct DefaultHash<Inspector::Protocol::Database::PrimaryColors> { 648 typedef IntHash<Inspector::Protocol::Database::PrimaryColors> Hash;648 using Hash = IntHash<Inspector::Protocol::Database::PrimaryColors>; 649 649 }; 650 650 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result
r262203 r262424 338 338 message->getObject("params"_s, parameters); 339 339 340 typedef void (Network3BackendDispatcher::*CallHandler)(long requestId, RefPtr<JSON::Object>&& message);341 typedef HashMap<String, CallHandler> DispatchMap;340 using CallHandler = void (Network3BackendDispatcher::*)(long requestId, RefPtr<JSON::Object>&& message); 341 using DispatchMap = HashMap<String, CallHandler>; 342 342 static NeverDestroyed<DispatchMap> dispatchMap; 343 343 if (dispatchMap.get().isEmpty()) { … … 638 638 namespace Network2 { 639 639 /* Unique loader identifier. */ 640 typedef String LoaderId;640 using LoaderId = String; 641 641 } // Network2 642 642 // End of typedefs. -
trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/enum-values.json-result
r262203 r262424 494 494 template<> 495 495 struct DefaultHash<Inspector::Protocol::TypeDomain::TypeDomainEnum> { 496 typedef IntHash<Inspector::Protocol::TypeDomain::TypeDomainEnum> Hash;496 using Hash = IntHash<Inspector::Protocol::TypeDomain::TypeDomainEnum>; 497 497 }; 498 498 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/events-with-optional-parameters.json-result
r262203 r262424 383 383 namespace Database { 384 384 /* Unique identifier of Database object. */ 385 typedef String DatabaseId;386 typedef String PrimaryColors;387 typedef JSON::ArrayOf<String> ColorList;385 using DatabaseId = String; 386 using PrimaryColors = String; 387 using ColorList = JSON::ArrayOf<String>; 388 388 } // Database 389 389 // End of typedefs. -
trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/same-type-id-different-domain.json-result
r262203 r262424 314 314 namespace Runtime { 315 315 /* Unique object identifier. */ 316 typedef String RemoteObjectId;316 using RemoteObjectId = String; 317 317 } // Runtime 318 318 319 319 namespace Runtime2 { 320 320 /* Unique object identifier. */ 321 typedef String RemoteObjectId;321 using RemoteObjectId = String; 322 322 } // Runtime2 323 323 // End of typedefs. -
trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result
r262203 r262424 314 314 namespace Runtime { 315 315 /* Unique object identifier. */ 316 typedef int RemoteObjectId;316 using RemoteObjectId = int; 317 317 } // Runtime 318 318 // End of typedefs. -
trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-array-type.json-result
r262203 r262424 323 323 // Typedefs. 324 324 namespace Debugger { 325 typedef int BreakpointId;325 using BreakpointId = int; 326 326 } // Debugger 327 327 328 328 namespace Runtime { 329 typedef int ObjectId;330 typedef JSON::ArrayOf<int> LuckyNumbers;331 typedef JSON::ArrayOf<String> BabyNames;332 typedef JSON::ArrayOf<int> NewObjects;333 typedef JSON::ArrayOf<int> OldObjects;334 typedef JSON::ArrayOf<Inspector::Protocol::Debugger::Reason> StopReasons;329 using ObjectId = int; 330 using LuckyNumbers = JSON::ArrayOf<int>; 331 using BabyNames = JSON::ArrayOf<String>; 332 using NewObjects = JSON::ArrayOf<int>; 333 using OldObjects = JSON::ArrayOf<int>; 334 using StopReasons = JSON::ArrayOf<Inspector::Protocol::Debugger::Reason>; 335 335 } // Runtime 336 336 // End of typedefs. … … 381 381 template<> 382 382 struct DefaultHash<Inspector::Protocol::Debugger::Reason> { 383 typedef IntHash<Inspector::Protocol::Debugger::Reason> Hash;383 using Hash = IntHash<Inspector::Protocol::Debugger::Reason>; 384 384 }; 385 385 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-enum-type.json-result
r262203 r262424 380 380 template<> 381 381 struct DefaultHash<Inspector::Protocol::Runtime::FarmAnimals> { 382 typedef IntHash<Inspector::Protocol::Runtime::FarmAnimals> Hash;382 using Hash = IntHash<Inspector::Protocol::Runtime::FarmAnimals>; 383 383 }; 384 384 template<> 385 385 struct DefaultHash<Inspector::Protocol::Runtime::TwoLeggedAnimals> { 386 typedef IntHash<Inspector::Protocol::Runtime::TwoLeggedAnimals> Hash;386 using Hash = IntHash<Inspector::Protocol::Runtime::TwoLeggedAnimals>; 387 387 }; 388 388 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-object-type.json-result
r262203 r262424 334 334 // Typedefs. 335 335 namespace Database { 336 typedef JSON::ArrayOf<Inspector::Protocol::Database::Error> ErrorList;336 using ErrorList = JSON::ArrayOf<Inspector::Protocol::Database::Error>; 337 337 } // Database 338 338 // End of typedefs. … … 910 910 template<> 911 911 struct DefaultHash<Inspector::Protocol::Database::MouseButton> { 912 typedef IntHash<Inspector::Protocol::Database::MouseButton> Hash;912 using Hash = IntHash<Inspector::Protocol::Database::MouseButton>; 913 913 }; 914 914 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result
r262203 r262424 328 328 // Typedefs. 329 329 namespace Test { 330 typedef int CastedObjectId;331 typedef int UncastedObjectId;330 using CastedObjectId = int; 331 using UncastedObjectId = int; 332 332 } // Test 333 333 // End of typedefs. … … 597 597 template<> 598 598 struct DefaultHash<Inspector::Protocol::Test::UncastedAnimals> { 599 typedef IntHash<Inspector::Protocol::Test::UncastedAnimals> Hash;599 using Hash = IntHash<Inspector::Protocol::Test::UncastedAnimals>; 600 600 }; 601 601 template<> 602 602 struct DefaultHash<Inspector::Protocol::Test::CastedAnimals> { 603 typedef IntHash<Inspector::Protocol::Test::CastedAnimals> Hash;603 using Hash = IntHash<Inspector::Protocol::Test::CastedAnimals>; 604 604 }; 605 605 -
trunk/Source/JavaScriptCore/yarr/generateYarrUnicodePropertyTables.py
r248846 r262424 552 552 propertyData.dump(file, propertyData != cls.allPropertyData[-1]) 553 553 554 file.write(" typedef std::unique_ptr<CharacterClass> (*CreateCharacterClass)();\n")554 file.write("using CreateCharacterClass = std::unique_ptr<CharacterClass> (*)();\n") 555 555 file.write("static CreateCharacterClass createFunctions[{}] = {{\n ".format(len(cls.allPropertyData))) 556 556 functionsOnThisLine = 0 -
trunk/Source/WebCore/ChangeLog
r262421 r262424 1 2020-06-02 Rob Buis <[email protected]> 2 3 Make generated C++ code use modern C++ 4 https://bugs.webkit.org/show_bug.cgi?id=190714 5 6 Reviewed by Sam Weinig. 7 8 Replace typedef usage by alias-declaration. 9 10 No new tests. No change in behavior. 11 12 * css/makeprop.pl: 13 * dom/make_names.pl: 14 (printHeaderHead): 15 (printInit): 16 (printTypeHelpersHeaderFile): 17 (printFactoryCppFile): 18 (printFactoryHeaderFile): 19 (printWrapperFactoryCppFile): 20 (printWrapperFactoryHeaderFile): 21 1 22 2020-06-02 Tetsuharu Ohzeki <[email protected]> 2 23 -
trunk/Source/WebCore/css/makeprop.pl
r260491 r262424 619 619 620 620 namespace WTF { 621 template<> struct DefaultHash<WebCore::CSSPropertyID> { typedef IntHash<unsigned> Hash; };621 template<> struct DefaultHash<WebCore::CSSPropertyID> { using Hash = IntHash<unsigned>; }; 622 622 template<> struct HashTraits<WebCore::CSSPropertyID> : GenericHashTraits<WebCore::CSSPropertyID> { 623 623 static const bool emptyValueIsZero = true; -
trunk/Source/WebCore/dom/make_names.pl
r261013 r262424 543 543 544 544 print F<<END 545 #ifndef ${prefix}_${namespace}Names_h 546 547 #define ${prefix}_${namespace}Names_h 545 #pragma once 548 546 549 547 $includes … … 584 582 print F "\nWEBCORE_EXPORT void init();\n\n"; 585 583 print F "} }\n\n"; 586 print F "#endif\n\n";587 584 return; 588 585 } … … 696 693 printLicenseHeader($F); 697 694 698 print F "#ifndef ".$parameters{namespace}."ElementTypeHelpers_h\n"; 699 print F "#define ".$parameters{namespace}."ElementTypeHelpers_h\n\n"; 695 print F "#pragma once\n\n"; 700 696 print F "#include \"".$parameters{namespace}."Names.h\"\n\n"; 701 697 702 698 printTypeHelpers($F, \%allTags); 703 704 print F "#endif\n";705 699 706 700 close F; … … 968 962 namespace WebCore { 969 963 970 typedef Ref<$parameters{namespace}Element> (*$parameters{namespace}ConstructorFunction)(const QualifiedName&, Document&$formElementArgumentForDeclaration, bool createdByParser);964 using $parameters{namespace}ConstructorFunction = Ref<$parameters{namespace}Element> (*)(const QualifiedName&, Document&$formElementArgumentForDeclaration, bool createdByParser); 971 965 972 966 END … … 1088 1082 1089 1083 print F<<END 1090 #ifndef $parameters{namespace}ElementFactory_h 1091 #define $parameters{namespace}ElementFactory_h 1084 #pragma once 1092 1085 1093 1086 #include <wtf/Forward.h> … … 1126 1119 1127 1120 } 1128 1129 #endif // $parameters{namespace}ElementFactory_h1130 1121 1131 1122 END … … 1248 1239 namespace WebCore { 1249 1240 1250 typedef JSDOMObject* (*Create$parameters{namespace}ElementWrapperFunction)(JSDOMGlobalObject*, Ref<$parameters{namespace}Element>&&);1241 using Create$parameters{namespace}ElementWrapperFunction = JSDOMObject* (*)(JSDOMGlobalObject*, Ref<$parameters{namespace}Element>&&); 1251 1242 1252 1243 END … … 1339 1330 printLicenseHeader($F); 1340 1331 1341 print F "#ifndef JS$parameters{namespace}ElementWrapperFactory_h\n"; 1342 print F "#define JS$parameters{namespace}ElementWrapperFactory_h\n\n"; 1343 1344 print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWith}; 1332 print F "#pragma once\n\n"; 1345 1333 1346 1334 print F <<END … … 1360 1348 ; 1361 1349 1362 print F "#endif // $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryWith};1363 1364 print F "#endif // JS$parameters{namespace}ElementWrapperFactory_h\n";1365 1366 1350 close F; 1367 1351 } -
trunk/Source/WebKit/ChangeLog
r262415 r262424 1 2020-06-02 Rob Buis <[email protected]> 2 3 Make generated C++ code use modern C++ 4 https://bugs.webkit.org/show_bug.cgi?id=190714 5 6 Reviewed by Sam Weinig. 7 8 Replace typedef usage by alias-declaration. 9 10 * Scripts/webkit/messages.py: 11 1 12 2020-06-02 Carlos Garcia Campos <[email protected]> 2 13 -
trunk/Source/WebKit/Scripts/webkit/messages.py
r262075 r262424 141 141 result.append('class %s {\n' % message.name) 142 142 result.append('public:\n') 143 result.append(' typedef %s Arguments;\n' % arguments_type(message))143 result.append(' using Arguments = %s;\n' % arguments_type(message)) 144 144 result.append('\n') 145 145 result.append(' static IPC::MessageName name() { return IPC::MessageName::%s_%s; }\n' % (receiver.name, message.name))
Note:
See TracChangeset
for help on using the changeset viewer.