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

Unified Diff: base/allocator/allocator_unittest.cc

Issue 774683003: Remove tcmalloc when not being used. Restore shim on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add realloc death test. nits. Created 5 years, 11 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 | « base/allocator/allocator_shim_win.cc ('k') | base/allocator/generic_allocators.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/allocator/allocator_unittest.cc
diff --git a/base/allocator/allocator_unittest.cc b/base/allocator/allocator_unittest.cc
index a39b8384452bdf8bdf7247bda4c1a88b5d8c4d58..9471e954247a4a45599ae6a5bde93d717fc85e0d 100644
--- a/base/allocator/allocator_unittest.cc
+++ b/base/allocator/allocator_unittest.cc
@@ -280,7 +280,7 @@ static void TestCalloc(size_t n, size_t s, bool ok) {
} else {
EXPECT_NE(reinterpret_cast<void*>(NULL), p) <<
"calloc(n, s) should succeed";
- for (int i = 0; i < n*s; i++) {
+ for (size_t i = 0; i < n*s; i++) {
EXPECT_EQ('\0', p[i]);
}
free(p);
@@ -347,19 +347,19 @@ static void TestNothrowNew(void* (*func)(size_t)) {
//-----------------------------------------------------------------------------
TEST(Atomics, AtomicIncrementWord) {
- TestAtomicIncrement<AtomicWord>();
+ TestAtomicIncrement<base::subtle::AtomicWord>();
}
TEST(Atomics, AtomicIncrement32) {
- TestAtomicIncrement<Atomic32>();
+ TestAtomicIncrement<base::subtle::Atomic32>();
}
TEST(Atomics, AtomicOpsWord) {
- TestAtomicIncrement<AtomicWord>();
+ TestAtomicIncrement<base::subtle::AtomicWord>();
}
TEST(Atomics, AtomicOps32) {
- TestAtomicIncrement<Atomic32>();
+ TestAtomicIncrement<base::subtle::Atomic32>();
}
TEST(Allocators, Malloc) {
@@ -458,6 +458,9 @@ TEST(Allocators, Realloc2) {
free(p);
}
+// tcmalloc uses these semantics but system allocators can return NULL for
+// realloc(ptr, 0).
+#if defined(USE_TCMALLOC)
TEST(Allocators, ReallocZero) {
// Test that realloc to zero does not return NULL.
for (int size = 0; size >= 0; size = NextSize(size)) {
@@ -469,6 +472,7 @@ TEST(Allocators, ReallocZero) {
free(ptr);
}
}
+#endif
#ifdef WIN32
// Test recalloc
« no previous file with comments | « base/allocator/allocator_shim_win.cc ('k') | base/allocator/generic_allocators.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698