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 96a440765a11a1cd6bbcfc8ed511021cbc9b1031..7708f6ca8d45e58ee3b5872441b51f63b5dde331 100644 |
--- a/third_party/WebKit/Source/wtf/Vector.h |
+++ b/third_party/WebKit/Source/wtf/Vector.h |
@@ -335,6 +335,8 @@ class VectorBufferBase { |
public: |
void allocateBuffer(size_t newCapacity) { |
DCHECK(newCapacity); |
+ DCHECK(newCapacity <= |
Yuta Kitamura
2017/01/30 07:19:42
nit+optional: Use DCHECK_LE?
sof
2017/01/31 21:01:43
yes, done.
|
+ Allocator::template maxElementCountInBackingStore<T>()); |
size_t sizeToAllocate = allocationSize(newCapacity); |
if (hasInlineCapacity) |
m_buffer = |
@@ -999,6 +1001,12 @@ class Vector |
void reverse(); |
+ // Maximum element count supported; allocating a vector |
+ // buffer with a larger count will fail. |
+ static size_t maxCapacity() { |
+ return Allocator::template maxElementCountInBackingStore<T>(); |
+ } |
+ |
template <typename VisitorDispatcher> |
void trace(VisitorDispatcher); |