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

Unified Diff: third_party/WebKit/Source/platform/heap/HeapTest.cpp

Issue 1410223006: Zero-initialize persistent heap vector inline backing buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for unit test, handle ANNOTATE_CONTIGUOUS_CONTAINER's non-support of inline buffers Created 5 years, 2 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 | « third_party/WebKit/Source/platform/heap/Handle.h ('k') | third_party/WebKit/Source/wtf/Vector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/HeapTest.cpp
diff --git a/third_party/WebKit/Source/platform/heap/HeapTest.cpp b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
index 87fdcaa18331296c7c03e9537de14ed1f26e1592..340b1cf0d002ed9ff07eee6918d1908a86f49192 100644
--- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp
+++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
@@ -6434,4 +6434,34 @@ TEST(HeapTest, CrossThreadWeakPersistent)
parkMainThread();
}
+class TestPersistentHeapVectorWithUnusedSlots : public PersistentHeapVector<VectorObject, 16> {
+public:
+ void checkUnused()
+ {
+ checkUnusedSlots(end(), end() + (capacity() - size()));
+ }
+};
+
+TEST(HeapTest, TestPersistentHeapVectorWithUnusedSlots)
+{
+ TestPersistentHeapVectorWithUnusedSlots vector1;
+ TestPersistentHeapVectorWithUnusedSlots vector2(vector1);
+
+ vector1.checkUnused();
+ vector2.checkUnused();
+
+ vector2.append(VectorObject());
+ vector2.checkUnused();
+
+ EXPECT_EQ(0u, vector1.size());
+
+ EXPECT_EQ(1u, vector2.size());
+// TODO(Oilpan): when Vector.h's contiguous container support no longer disables
+// Vector<>s with inline capacity, remove.
+#if !defined(ANNOTATE_CONTIGUOUS_CONTAINER)
+ EXPECT_EQ(16u, vector1.capacity());
+ EXPECT_EQ(16u, vector2.capacity());
+#endif
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Handle.h ('k') | third_party/WebKit/Source/wtf/Vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698