Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2153)

Unified Diff: Source/wtf/HashMapTest.cpp

Issue 1058653004: Destruct all instances of value types in WTF::HashTable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed heap case Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/wtf/HashTable.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/HashMapTest.cpp
diff --git a/Source/wtf/HashMapTest.cpp b/Source/wtf/HashMapTest.cpp
index c808f483b1af62641bef594bf80b16f789da358a..6fe352e06ab685ad4be453f54e746d88b5a2c234 100644
--- a/Source/wtf/HashMapTest.cpp
+++ b/Source/wtf/HashMapTest.cpp
@@ -284,4 +284,22 @@ TEST(HashMapTest, AddResultVectorValue)
EXPECT_EQ(11, map.find(1)->value.first());
}
+class InstanceCounter {
+public:
+ InstanceCounter() { ++counter; }
+ InstanceCounter(const InstanceCounter& another) { ++counter; }
+ ~InstanceCounter() { --counter; }
+ static int counter;
+};
+int InstanceCounter::counter = 0;
+
+TEST(HashMapTest, ValueTypeDestructed)
+{
+ InstanceCounter::counter = 0;
+ HashMap<int, InstanceCounter> map;
+ map.set(1, InstanceCounter());
+ map.clear();
+ EXPECT_EQ(0, InstanceCounter::counter);
+}
+
} // namespace
« no previous file with comments | « no previous file | Source/wtf/HashTable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698