Title: [237461] trunk
- Revision
- 237461
- Author
- [email protected]
- Date
- 2018-10-26 09:27:23 -0700 (Fri, 26 Oct 2018)
Log Message
hashSet.remove(hashSet.random()) doesn't build
https://bugs.webkit.org/show_bug.cgi?id=190953
Reviewed by Chris Dumez.
Source/WTF:
* wtf/HashSet.h:
Remove non-const random(). HashSet only returns const iterators (it is immutable via iterator).
* wtf/HashTable.h:
(WTF::HashTable::random const):
Invoke const_iterator() by using static_cast<> instead of trying to do it directly.
Tools:
* TestWebKitAPI/Tests/WTF/HashSet.cpp:
(TestWebKitAPI::TEST):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (237460 => 237461)
--- trunk/Source/WTF/ChangeLog 2018-10-26 15:34:18 UTC (rev 237460)
+++ trunk/Source/WTF/ChangeLog 2018-10-26 16:27:23 UTC (rev 237461)
@@ -1,3 +1,19 @@
+2018-10-26 Antti Koivisto <[email protected]>
+
+ hashSet.remove(hashSet.random()) doesn't build
+ https://bugs.webkit.org/show_bug.cgi?id=190953
+
+ Reviewed by Chris Dumez.
+
+ * wtf/HashSet.h:
+
+ Remove non-const random(). HashSet only returns const iterators (it is immutable via iterator).
+
+ * wtf/HashTable.h:
+ (WTF::HashTable::random const):
+
+ Invoke const_iterator() by using static_cast<> instead of trying to do it directly.
+
2018-10-26 Alicia Boya GarcĂa <[email protected]>
[MSE][WTF][Media] Invalid MediaTime should be falsy
Modified: trunk/Source/WTF/wtf/HashSet.h (237460 => 237461)
--- trunk/Source/WTF/wtf/HashSet.h 2018-10-26 15:34:18 UTC (rev 237460)
+++ trunk/Source/WTF/wtf/HashSet.h 2018-10-26 16:27:23 UTC (rev 237461)
@@ -68,8 +68,7 @@
iterator begin() const;
iterator end() const;
- iterator random() { return m_impl.random(); }
- const_iterator random() const { return m_impl.random(); }
+ iterator random() const { return m_impl.random(); }
iterator find(const ValueType&) const;
bool contains(const ValueType&) const;
Modified: trunk/Source/WTF/wtf/HashTable.h (237460 => 237461)
--- trunk/Source/WTF/wtf/HashTable.h 2018-10-26 15:34:18 UTC (rev 237460)
+++ trunk/Source/WTF/wtf/HashTable.h 2018-10-26 16:27:23 UTC (rev 237461)
@@ -390,7 +390,7 @@
return it;
}
- const_iterator random() const { return const_cast<HashTable*>(this)->random().const_iterator(); }
+ const_iterator random() const { return static_cast<const_iterator>(const_cast<HashTable*>(this)->random()); }
unsigned size() const { return m_keyCount; }
unsigned capacity() const { return m_tableSize; }
Modified: trunk/Tools/ChangeLog (237460 => 237461)
--- trunk/Tools/ChangeLog 2018-10-26 15:34:18 UTC (rev 237460)
+++ trunk/Tools/ChangeLog 2018-10-26 16:27:23 UTC (rev 237461)
@@ -1,3 +1,13 @@
+2018-10-26 Antti Koivisto <[email protected]>
+
+ hashSet.remove(hashSet.random()) doesn't build
+ https://bugs.webkit.org/show_bug.cgi?id=190953
+
+ Reviewed by Chris Dumez.
+
+ * TestWebKitAPI/Tests/WTF/HashSet.cpp:
+ (TestWebKitAPI::TEST):
+
2018-10-26 Zalan Bujtas <[email protected]>
[LFC][IFC] Layout floats as part of the inline content
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/HashSet.cpp (237460 => 237461)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/HashSet.cpp 2018-10-26 15:34:18 UTC (rev 237460)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/HashSet.cpp 2018-10-26 16:27:23 UTC (rev 237461)
@@ -457,4 +457,13 @@
set1.remove(10);
}
+TEST(WTF_HashSet, RemoveRandom)
+{
+ HashSet<unsigned> set1 { 1, 2, 3 };
+ set1.remove(set1.random());
+ set1.remove(set1.random());
+ set1.remove(set1.random());
+ ASSERT_TRUE(set1.isEmpty());
+}
+
} // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes