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

Unified Diff: webrtc/base/buffer_unittest.cc

Issue 2078873005: rtc::Buffer: Grow capacity by at least 1.5x to prevent quadratic behavior (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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
« webrtc/base/buffer.h ('K') | « webrtc/base/buffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/buffer_unittest.cc
diff --git a/webrtc/base/buffer_unittest.cc b/webrtc/base/buffer_unittest.cc
index e9a853c6153f311610609713a514ebaffc687e74..bd095a6b0954a5a9dc907ba7aeb4e9db38bc5ae3 100644
--- a/webrtc/base/buffer_unittest.cc
+++ b/webrtc/base/buffer_unittest.cc
@@ -68,7 +68,7 @@ TEST(BufferTest, TestSetData) {
Buffer buf(kTestData + 4, 7);
buf.SetData(kTestData, 9);
EXPECT_EQ(buf.size(), 9u);
- EXPECT_EQ(buf.capacity(), 9u);
+ EXPECT_EQ(buf.capacity(), 7u * 3 / 2);
EXPECT_EQ(0, memcmp(buf.data(), kTestData, 9));
}
@@ -95,7 +95,7 @@ TEST(BufferTest, TestSetSizeLarger) {
EXPECT_EQ(buf.capacity(), 15u);
buf.SetSize(20);
EXPECT_EQ(buf.size(), 20u);
- EXPECT_EQ(buf.capacity(), 20u); // Has grown.
+ EXPECT_EQ(buf.capacity(), 15u * 3 / 2); // Has grown.
EXPECT_EQ(0, memcmp(buf.data(), kTestData, 15));
}
« webrtc/base/buffer.h ('K') | « webrtc/base/buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698