Changeset 196800 in webkit
- Timestamp:
- Feb 18, 2016 10:53:54 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r196791 r196800 1 2016-02-18 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r196791. 4 https://bugs.webkit.org/show_bug.cgi?id=154438 5 6 broke windows build (Requested by alexchristensen on #webkit). 7 8 Reverted changeset: 9 10 "Extend HashCountedSet with a method to efficiently set the 11 count of an entry" 12 https://bugs.webkit.org/show_bug.cgi?id=154352 13 http://trac.webkit.org/changeset/196791 14 1 15 2016-02-18 Brent Fulgham <bfulgham@apple.com> 2 16 -
trunk/Source/WTF/wtf/HashCountedSet.h
r196791 r196800 1 1 /* 2 * Copyright (C) 2005, 2006, 2008, 2013 , 2016Apple Inc. All rights reserved.2 * Copyright (C) 2005, 2006, 2008, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 22 22 #define WTF_HashCountedSet_h 23 23 24 #include <initializer_list>25 24 #include <wtf/Assertions.h> 26 25 #include <wtf/HashMap.h> … … 39 38 typedef typename ImplType::const_iterator const_iterator; 40 39 typedef typename ImplType::AddResult AddResult; 41 42 HashCountedSet()43 {44 }45 46 HashCountedSet(std::initializer_list<typename ImplType::KeyValuePairType> initializerList)47 {48 for (const auto& keyValuePair : initializerList)49 add(keyValuePair.key, keyValuePair.value);50 }51 52 HashCountedSet(std::initializer_list<typename ImplType::KeyType> initializerList)53 {54 for (const auto& value : initializerList)55 add(value);56 }57 40 58 41 void swap(HashCountedSet&); … … 77 60 // and an isNewEntry bool that indicates whether it is a new or existing entry. 78 61 AddResult add(const ValueType&); 79 AddResult add(ValueType&&); 80 81 // Increments the count of a value by the passed amount. 82 AddResult add(const ValueType&, unsigned); 83 AddResult add(ValueType&&, unsigned); 84 62 85 63 // Decrements the count of the value, and removes it if count goes down to zero. 86 64 // Returns true if the value is removed. … … 96 74 void clear(); 97 75 98 // Overloads for smart pointer keys that take the raw pointer type as the parameter.99 template<typename V = ValueType> typename std::enable_if<IsSmartPtr<V>::value, iterator>::type find(typename GetPtrHelper<V>::PtrType);100 template<typename V = ValueType> typename std::enable_if<IsSmartPtr<V>::value, const_iterator>::type find(typename GetPtrHelper<V>::PtrType) const;101 template<typename V = ValueType> typename std::enable_if<IsSmartPtr<V>::value, bool>::type contains(typename GetPtrHelper<V>::PtrType) const;102 template<typename V = ValueType> typename std::enable_if<IsSmartPtr<V>::value, unsigned>::type count(typename GetPtrHelper<V>::PtrType) const;103 template<typename V = ValueType> typename std::enable_if<IsSmartPtr<V>::value, bool>::type remove(typename GetPtrHelper<V>::PtrType);104 105 76 private: 106 77 ImplType m_impl; 107 78 }; 108 79 109 110 80 template<typename Value, typename HashFunctions, typename Traits> 111 81 inline void HashCountedSet<Value, HashFunctions, Traits>::swap(HashCountedSet& other) … … 185 155 AddResult result = m_impl.add(value, 0); 186 156 ++result.iterator->value; 187 return result;188 }189 190 template<typename Value, typename HashFunctions, typename Traits>191 inline typename HashCountedSet<Value, HashFunctions, Traits>::AddResult HashCountedSet<Value, HashFunctions, Traits>::add(ValueType&& value)192 {193 AddResult result = m_impl.add(std::forward<Value>(value), 0);194 ++result.iterator->value;195 return result;196 }197 198 template<typename Value, typename HashFunctions, typename Traits>199 inline typename HashCountedSet<Value, HashFunctions, Traits>::AddResult HashCountedSet<Value, HashFunctions, Traits>::add(const ValueType& value, unsigned count)200 {201 AddResult result = m_impl.add(value, 0);202 result.iterator->value += count;203 return result;204 }205 206 template<typename Value, typename HashFunctions, typename Traits>207 inline typename HashCountedSet<Value, HashFunctions, Traits>::AddResult HashCountedSet<Value, HashFunctions, Traits>::add(ValueType&& value, unsigned count)208 {209 AddResult result = m_impl.add(std::forward<Value>(value), 0);210 result.iterator->value += count;211 157 return result; 212 158 } … … 284 230 } 285 231 286 template<typename Value, typename HashFunctions, typename Traits> 287 template<typename V> 288 inline auto HashCountedSet<Value, HashFunctions, Traits>::find(typename GetPtrHelper<V>::PtrType value) -> typename std::enable_if<IsSmartPtr<V>::value, iterator>::type 289 { 290 return m_impl.template find(value); 291 } 292 293 template<typename Value, typename HashFunctions, typename Traits> 294 template<typename V> 295 inline auto HashCountedSet<Value, HashFunctions, Traits>::find(typename GetPtrHelper<V>::PtrType value) const -> typename std::enable_if<IsSmartPtr<V>::value, const_iterator>::type 296 { 297 return m_impl.template find(value); 298 } 299 300 template<typename Value, typename HashFunctions, typename Traits> 301 template<typename V> 302 inline auto HashCountedSet<Value, HashFunctions, Traits>::contains(typename GetPtrHelper<V>::PtrType value) const -> typename std::enable_if<IsSmartPtr<V>::value, bool>::type 303 { 304 return m_impl.template contains(value); 305 } 306 307 template<typename Value, typename HashFunctions, typename Traits> 308 template<typename V> 309 inline auto HashCountedSet<Value, HashFunctions, Traits>::count(typename GetPtrHelper<V>::PtrType value) const -> typename std::enable_if<IsSmartPtr<V>::value, unsigned>::type 310 { 311 return m_impl.template get(value); 312 } 313 314 template<typename Value, typename HashFunctions, typename Traits> 315 template<typename V> 316 inline auto HashCountedSet<Value, HashFunctions, Traits>::remove(typename GetPtrHelper<V>::PtrType value) -> typename std::enable_if<IsSmartPtr<V>::value, bool>::type 317 { 318 return remove(find(value)); 319 } 320 321 } // namespace WTF 232 233 } // namespace khtml 322 234 323 235 using WTF::HashCountedSet; -
trunk/Source/WebCore/ChangeLog
r196797 r196800 1 2016-02-18 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r196791. 4 https://bugs.webkit.org/show_bug.cgi?id=154438 5 6 broke windows build (Requested by alexchristensen on #webkit). 7 8 Reverted changeset: 9 10 "Extend HashCountedSet with a method to efficiently set the 11 count of an entry" 12 https://bugs.webkit.org/show_bug.cgi?id=154352 13 http://trac.webkit.org/changeset/196791 14 1 15 2016-02-18 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp
r196791 r196800 125 125 if (!decoderInner.decodeUInt32("count", count)) 126 126 return false; 127 128 hashCountedSet.add(origin, count); 127 128 // FIXME: Create a HashCountedSet method to do this efficiently 129 for (unsigned i = 0; i < count; ++i) 130 hashCountedSet.add(origin); 129 131 return true; 130 132 }); -
trunk/Tools/ChangeLog
r196791 r196800 1 2016-02-18 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r196791. 4 https://bugs.webkit.org/show_bug.cgi?id=154438 5 6 broke windows build (Requested by alexchristensen on #webkit). 7 8 Reverted changeset: 9 10 "Extend HashCountedSet with a method to efficiently set the 11 count of an entry" 12 https://bugs.webkit.org/show_bug.cgi?id=154352 13 http://trac.webkit.org/changeset/196791 14 1 15 2016-02-18 Brent Fulgham <bfulgham@apple.com> 2 16 -
trunk/Tools/TestWebKitAPI/CMakeLists.txt
r196791 r196800 48 48 ${TESTWEBKITAPI_DIR}/Tests/WTF/Deque.cpp 49 49 ${TESTWEBKITAPI_DIR}/Tests/WTF/Functional.cpp 50 ${TESTWEBKITAPI_DIR}/Tests/WTF/HashCountedSet.cpp51 50 ${TESTWEBKITAPI_DIR}/Tests/WTF/HashMap.cpp 52 51 ${TESTWEBKITAPI_DIR}/Tests/WTF/HashSet.cpp -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r196791 r196800 80 80 76E182DF154767E600F1FADD /* auto-submitting-form.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 76E182DE15475A8300F1FADD /* auto-submitting-form.html */; }; 81 81 7A1458FC1AD5C07000E06772 /* mouse-button-listener.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 7A1458FB1AD5C03500E06772 /* mouse-button-listener.html */; }; 82 7A38D7E61C752D5F004F157D /* HashCountedSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A38D7E51C752D5F004F157D /* HashCountedSet.cpp */; };83 82 7A5623111AD5AF3E0096B920 /* MenuTypesForMouseEvents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A5623101AD5AF3E0096B920 /* MenuTypesForMouseEvents.cpp */; }; 84 83 7A99D9941AD4A29D00373141 /* MenuTypesForMouseEvents.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7A99D9931AD4A29D00373141 /* MenuTypesForMouseEvents.mm */; }; … … 612 611 76E182DE15475A8300F1FADD /* auto-submitting-form.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "auto-submitting-form.html"; sourceTree = "<group>"; }; 613 612 7A1458FB1AD5C03500E06772 /* mouse-button-listener.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "mouse-button-listener.html"; sourceTree = "<group>"; }; 614 7A38D7E51C752D5F004F157D /* HashCountedSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HashCountedSet.cpp; sourceTree = "<group>"; };615 613 7A5623101AD5AF3E0096B920 /* MenuTypesForMouseEvents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MenuTypesForMouseEvents.cpp; sourceTree = "<group>"; }; 616 614 7A99D9931AD4A29D00373141 /* MenuTypesForMouseEvents.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MenuTypesForMouseEvents.mm; sourceTree = "<group>"; }; … … 1231 1229 E4A757D3178AEA5B00B5D7A4 /* Deque.cpp */, 1232 1230 1AA9E55714980A9900001A8A /* Functional.cpp */, 1233 7A38D7E51C752D5F004F157D /* HashCountedSet.cpp */,1234 1231 0BCD833414857CE400EA2003 /* HashMap.cpp */, 1235 1232 26B2DFF815BDE599004F691D /* HashSet.cpp */, … … 1867 1864 1A4F81CC1BDFFD37004E672E /* RemoteObjectRegistry.mm in Sources */, 1868 1865 51CB4AD81B3A079C00C1B1C6 /* ModalAlertsSPI.cpp in Sources */, 1869 7A38D7E61C752D5F004F157D /* HashCountedSet.cpp in Sources */,1870 1866 9B7916501BD89D0D00D50B8F /* FirstResponderScrollingPosition.mm in Sources */, 1871 1867 1CF0D3791BBF2F3D00B4EF54 /* WKRetainPtr.cpp in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.