Index: Source/wtf/Vector.h |
diff --git a/Source/wtf/Vector.h b/Source/wtf/Vector.h |
index ab18fe5fe421fae435d5627c5adcc6542d981021..e42413f9a46fa79d8cc96824953218af7d0b029b 100644 |
--- a/Source/wtf/Vector.h |
+++ b/Source/wtf/Vector.h |
@@ -675,6 +675,11 @@ static const size_t kInitialVectorSize = WTF_VECTOR_INITIAL_SIZE; |
void reserveCapacity(size_t newCapacity); |
void reserveInitialCapacity(size_t initialCapacity); |
void shrinkToFit() { shrinkCapacity(size()); } |
+ void shrinkToReasonableCapacity() |
+ { |
+ if (size() * 2 < capacity()) |
+ shrinkCapacity(size() + size() / 4 + 1); |
abarth-chromium
2014/04/17 19:21:36
Is there a problem with integer overflow in this c
|
+ } |
void clear() { shrinkCapacity(0); } |