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

Unified Diff: third_party/WebKit/Source/wtf/Vector.h

Issue 2710183002: WTF::Vector: Enable static_asserts in a Vector constructor.
Patch Set: Add a "temporarily allowed" rule in DEPS. Created 3 years, 10 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/core/layout/line/RootInlineBox.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/Vector.h
diff --git a/third_party/WebKit/Source/wtf/Vector.h b/third_party/WebKit/Source/wtf/Vector.h
index 77f86edc6667b9cb5fd5a9b5b3981a5605de3c28..11285caedd6f703b59dca8ed73ed9ab1c3bc6e7d 100644
--- a/third_party/WebKit/Source/wtf/Vector.h
+++ b/third_party/WebKit/Source/wtf/Vector.h
@@ -1194,21 +1194,18 @@ inline Vector<T, inlineCapacity, Allocator>::Vector(size_t size) : Base(size) {
template <typename T, size_t inlineCapacity, typename Allocator>
inline Vector<T, inlineCapacity, Allocator>::Vector(size_t size, const T& val)
: Base(size) {
- // TODO(yutak): Introduce these assertions. Some use sites call this function
- // in the context where T is an incomplete type.
- //
- // static_assert(!std::is_polymorphic<T>::value ||
- // !VectorTraits<T>::canInitializeWithMemset,
- // "Cannot initialize with memset if there is a vtable");
- // static_assert(Allocator::isGarbageCollected ||
- // !AllowsOnlyPlacementNew<T>::value ||
- // !IsTraceable<T>::value,
- // "Cannot put DISALLOW_NEW_EXCEPT_PLACEMENT_NEW objects that "
- // "have trace methods into an off-heap Vector");
- // static_assert(Allocator::isGarbageCollected ||
- // !IsPointerToGarbageCollectedType<T>::value,
- // "Cannot put raw pointers to garbage-collected classes into "
- // "an off-heap Vector. Use HeapVector<Member<T>> instead.");
+ static_assert(!std::is_polymorphic<T>::value ||
+ !VectorTraits<T>::canInitializeWithMemset,
+ "Cannot initialize with memset if there is a vtable");
+ static_assert(Allocator::isGarbageCollected ||
+ !AllowsOnlyPlacementNew<T>::value ||
+ !IsTraceable<T>::value,
+ "Cannot put DISALLOW_NEW_EXCEPT_PLACEMENT_NEW objects that "
+ "have trace methods into an off-heap Vector");
+ static_assert(Allocator::isGarbageCollected ||
+ !IsPointerToGarbageCollectedType<T>::value,
+ "Cannot put raw pointers to garbage-collected classes into "
+ "an off-heap Vector. Use HeapVector<Member<T>> instead.");
ANNOTATE_NEW_BUFFER(begin(), capacity(), size);
m_size = size;
« no previous file with comments | « third_party/WebKit/Source/core/layout/line/RootInlineBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698