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

Unified Diff: third_party/tcmalloc/chromium/src/tests/malloc_extension_test.cc

Issue 7430007: Merge tcmalloc r111 (perftools v. 1.8) with the chromium/ branch. Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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
Index: third_party/tcmalloc/chromium/src/tests/malloc_extension_test.cc
===================================================================
--- third_party/tcmalloc/chromium/src/tests/malloc_extension_test.cc (revision 94429)
+++ third_party/tcmalloc/chromium/src/tests/malloc_extension_test.cc (working copy)
@@ -55,6 +55,14 @@
ASSERT_TRUE(MallocExtension::instance()->VerifyAllMemory());
ASSERT_TRUE(MallocExtension_VerifyAllMemory());
+ ASSERT_EQ(MallocExtension::kOwned,
+ MallocExtension::instance()->GetOwnership(a));
+ // TODO(csilvers): this relies on undocumented behavior that
+ // GetOwnership works on stack-allocated variables. Use a better test.
+ ASSERT_EQ(MallocExtension::kNotOwned,
+ MallocExtension::instance()->GetOwnership(&cxx_bytes_used));
+ ASSERT_EQ(MallocExtension::kNotOwned,
+ MallocExtension::instance()->GetOwnership(NULL));
ASSERT_GE(MallocExtension::instance()->GetAllocatedSize(a), 1000);
// This is just a sanity check. If we allocated too much, tcmalloc is broken
ASSERT_LE(MallocExtension::instance()->GetAllocatedSize(a), 5000);
@@ -68,12 +76,24 @@
}
// Check the c-shim version too.
+ ASSERT_EQ(MallocExtension_kOwned, MallocExtension_GetOwnership(a));
+ ASSERT_EQ(MallocExtension_kNotOwned,
+ MallocExtension_GetOwnership(&cxx_bytes_used));
+ ASSERT_EQ(MallocExtension_kNotOwned, MallocExtension_GetOwnership(NULL));
ASSERT_GE(MallocExtension_GetAllocatedSize(a), 1000);
ASSERT_LE(MallocExtension_GetAllocatedSize(a), 5000);
ASSERT_GE(MallocExtension_GetEstimatedAllocatedSize(1000), 1000);
free(a);
+ // Verify that the .cc file and .h file have the same enum values.
+ ASSERT_EQ(static_cast<int>(MallocExtension::kUnknownOwnership),
+ static_cast<int>(MallocExtension_kUnknownOwnership));
+ ASSERT_EQ(static_cast<int>(MallocExtension::kOwned),
+ static_cast<int>(MallocExtension_kOwned));
+ ASSERT_EQ(static_cast<int>(MallocExtension::kNotOwned),
+ static_cast<int>(MallocExtension_kNotOwned));
+
printf("DONE\n");
return 0;
}

Powered by Google App Engine
This is Rietveld 408576698