Changeset 252870 in webkit
- Timestamp:
- Nov 25, 2019 5:55:32 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r252855 r252870 1 2019-11-25 Fujii Hironori <Hironori.Fujii@sony.com> 2 3 Add DefaultHash<OptionSet<T>> and HashTrait<OptionSet<T>> specializations 4 https://bugs.webkit.org/show_bug.cgi?id=204562 5 6 Reviewed by Daniel Bates. 7 8 * WTF.xcodeproj/project.pbxproj: Added OptionSetHash.h 9 * wtf/CMakeLists.txt: Ditto. 10 * wtf/OptionSet.h: Made StorageType public, and use C++14 types. 11 * wtf/OptionSetHash.h: Added. 12 (WTF::DefaultHash<OptionSet<T>>::Hash::hash): 13 (WTF::DefaultHash<OptionSet<T>>::Hash::equal): 14 (WTF::HashTraits<OptionSet<T>>::emptyValue): 15 (WTF::HashTraits<OptionSet<T>>::constructDeletedValue): 16 (WTF::HashTraits<OptionSet<T>>::isDeletedValue): 17 1 18 2019-11-25 Carlos Garcia Campos <cgarcia@igalia.com> 2 19 -
trunk/Source/WTF/WTF.xcodeproj/project.pbxproj
r252850 r252870 331 331 26299B6D17A9E5B800ADEBE5 /* Ref.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Ref.h; sourceTree = "<group>"; }; 332 332 2684D4351C000D400081D663 /* IndexSparseSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexSparseSet.h; sourceTree = "<group>"; }; 333 275DFB6B238BDF72001230E2 /* OptionSetHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionSetHash.h; sourceTree = "<group>"; }; 333 334 2C05385315BC819000F21B96 /* GregorianDateTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GregorianDateTime.h; sourceTree = "<group>"; }; 334 335 2CCD892915C0390200285083 /* GregorianDateTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GregorianDateTime.cpp; sourceTree = "<group>"; }; … … 1070 1071 1AFDE6521953B23D00C48FFA /* Optional.h */, 1071 1072 1A4656181C7FC68E00F5920F /* OptionSet.h */, 1073 275DFB6B238BDF72001230E2 /* OptionSetHash.h */, 1072 1074 0F9495831C571CC900413A48 /* OrderMaker.h */, 1073 1075 A8A472D7151A825B004123FF /* OSAllocator.h */, -
trunk/Source/WTF/wtf/CMakeLists.txt
r252239 r252870 152 152 ObjectIdentifier.h 153 153 OptionSet.h 154 OptionSetHash.h 154 155 Optional.h 155 156 OrderMaker.h -
trunk/Source/WTF/wtf/OptionSet.h
r248546 r252870 40 40 WTF_MAKE_FAST_ALLOCATED; 41 41 static_assert(std::is_enum<T>::value, "T is not an enum type"); 42 typedef typename std::make_unsigned<typename std::underlying_type<T>::type>::type StorageType;43 42 44 43 public: 44 using StorageType = std::make_unsigned_t<std::underlying_type_t<T>>; 45 45 46 template<typename StorageType> class Iterator { 46 47 WTF_MAKE_FAST_ALLOCATED; -
trunk/Tools/ChangeLog
r252860 r252870 1 2019-11-25 Fujii Hironori <Hironori.Fujii@sony.com> 2 3 Add DefaultHash<OptionSet<T>> and HashTrait<OptionSet<T>> specializations 4 https://bugs.webkit.org/show_bug.cgi?id=204562 5 6 Reviewed by Daniel Bates. 7 8 * TestWebKitAPI/Tests/WTF/OptionSet.cpp: 9 Added a new test WTF_OptionSet.HashSet. 10 1 11 2019-11-25 Philippe Normand <pnormand@igalia.com> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WTF/OptionSet.cpp
r235560 r252870 27 27 28 28 #include "Test.h" 29 #include <wtf/HashSet.h> 29 30 #include <wtf/OptionSet.h> 31 #include <wtf/OptionSetHash.h> 30 32 31 33 namespace TestWebKitAPI { … … 437 439 } 438 440 441 TEST(WTF_OptionSet, HashSet) 442 { 443 HashSet<OptionSet<ExampleFlags>> hashSet; 444 EXPECT_TRUE(hashSet.add(OptionSet<ExampleFlags>()).isNewEntry); 445 EXPECT_TRUE(hashSet.add({ ExampleFlags::A }).isNewEntry); 446 EXPECT_TRUE(hashSet.add({ ExampleFlags::A, ExampleFlags::B }).isNewEntry); 447 EXPECT_FALSE(hashSet.add(OptionSet<ExampleFlags>()).isNewEntry); 448 EXPECT_FALSE(hashSet.add({ ExampleFlags::A }).isNewEntry); 449 EXPECT_FALSE(hashSet.add({ ExampleFlags::A, ExampleFlags::B }).isNewEntry); 450 EXPECT_TRUE(hashSet.remove(OptionSet<ExampleFlags>())); 451 EXPECT_TRUE(hashSet.remove({ ExampleFlags::A })); 452 EXPECT_TRUE(hashSet.remove({ ExampleFlags::A, ExampleFlags::B })); 453 EXPECT_TRUE(hashSet.add(OptionSet<ExampleFlags>()).isNewEntry); 454 EXPECT_TRUE(hashSet.add({ ExampleFlags::A }).isNewEntry); 455 EXPECT_TRUE(hashSet.add({ ExampleFlags::A, ExampleFlags::B }).isNewEntry); 456 } 457 439 458 } // namespace TestWebKitAPI
Note: See TracChangeset
for help on using the changeset viewer.