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

Unified Diff: Source/platform/PurgeableVectorTest.cpp

Issue 177213007: Simplify DefaultAllocator::Quantizer using partitionAllocActualSize() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased + adjusted PurgeableVector test Created 6 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 | « no previous file | Source/wtf/DefaultAllocator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/PurgeableVectorTest.cpp
diff --git a/Source/platform/PurgeableVectorTest.cpp b/Source/platform/PurgeableVectorTest.cpp
index bdb594aacf799f31bf08b74f475bf9e628ad9a20..b0d2de8fa301461bfe4e80a466fd66f5bf08736d 100644
--- a/Source/platform/PurgeableVectorTest.cpp
+++ b/Source/platform/PurgeableVectorTest.cpp
@@ -177,12 +177,17 @@ TEST_P(PurgeableVectorTestWithPlatformSupport, reserveCapacityUsesExactCapacityW
EXPECT_EQ(data, purgeableVector.data());
EXPECT_EQ(0, memcmp(purgeableVector.data(), testData.data(), testData.size()));
- // Appending one extra byte should cause a reallocation since the first
- // allocation happened while the purgeable vector was empty. This behavior
- // helps us guarantee that there is no memory waste on very small vectors
- // (which SharedBuffer requires).
- purgeableVector.append(testData.data(), 1);
- EXPECT_NE(data, purgeableVector.data());
+ // This test is not reliable if the PurgeableVector uses a plain WTF::Vector
+ // for storage, as it does if discardable memory is not supported; the vectors
+ // capacity will always be expanded to fill the PartitionAlloc bucket.
+ if (isDiscardableMemorySupported()) {
+ // Appending one extra byte should cause a reallocation since the first
+ // allocation happened while the purgeable vector was empty. This behavior
+ // helps us guarantee that there is no memory waste on very small vectors
+ // (which SharedBuffer requires).
+ purgeableVector.append(testData.data(), 1);
+ EXPECT_NE(data, purgeableVector.data());
+ }
}
TEST_P(PurgeableVectorTestWithPlatformSupport, appendReservesCapacityIfNeeded)
« no previous file with comments | « no previous file | Source/wtf/DefaultAllocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698