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

Unified Diff: third_party/tcmalloc/chromium/src/google/heap-checker.h

Issue 9320005: [NOT TO COMMIT!] Replace third_party/tcmalloc/chromium with tcmalloc r136 (the latest). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 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
Index: third_party/tcmalloc/chromium/src/google/heap-checker.h
diff --git a/third_party/tcmalloc/chromium/src/google/heap-checker.h b/third_party/tcmalloc/chromium/src/google/heap-checker.h
index f46f353a822e55326c789dff5b0f04d92541314b..92bfea1aa2b01cb9b8ef2d57aa9c18fc9ac182ba 100644
--- a/third_party/tcmalloc/chromium/src/google/heap-checker.h
+++ b/third_party/tcmalloc/chromium/src/google/heap-checker.h
@@ -181,17 +181,22 @@ class PERFTOOLS_DLL_DECL HeapLeakChecker {
};
// Ignore an object located at 'ptr' (can go at the start or into the object)
- // as well as all heap objects (transitively) referenced from it
- // for the purposes of heap leak checking.
- // If 'ptr' does not point to an active allocated object
- // at the time of this call, it is ignored;
- // but if it does, the object must not get deleted from the heap later on;
- // it must also be not already ignored at the time of this call.
+ // as well as all heap objects (transitively) referenced from it for the
+ // purposes of heap leak checking. Returns 'ptr' so that one can write
+ // static T* obj = IgnoreObject(new T(...));
+ //
+ // If 'ptr' does not point to an active allocated object at the time of this
+ // call, it is ignored; but if it does, the object must not get deleted from
+ // the heap later on.
//
// See also HiddenPointer, below, if you need to prevent a pointer from
// being traversed by the heap checker but do not wish to transitively
// whitelist objects referenced through it.
- static void IgnoreObject(const void* ptr);
+ template <typename T>
+ static T* IgnoreObject(T* ptr) {
+ DoIgnoreObject(static_cast<const void*>(const_cast<const T*>(ptr)));
+ return ptr;
+ }
// Undo what an earlier IgnoreObject() call promised and asked to do.
// At the time of this call 'ptr' must point at or inside of an active
@@ -199,12 +204,6 @@ class PERFTOOLS_DLL_DECL HeapLeakChecker {
static void UnIgnoreObject(const void* ptr);
// ----------------------------------------------------------------------- //
- // Initialization; to be called from main() only.
-
- // Full starting of recommended whole-program checking.
- static void InternalInitStart();
-
- // ----------------------------------------------------------------------- //
// Internal types defined in .cc
class Allocator;
@@ -227,6 +226,9 @@ class PERFTOOLS_DLL_DECL HeapLeakChecker {
// Helper for *NoLeaks and *SameHeap
bool DoNoLeaks(ShouldSymbolize should_symbolize);
+ // Helper for NoGlobalLeaks, also called by the global destructor.
+ static bool NoGlobalLeaksMaybeSymbolize(ShouldSymbolize should_symbolize);
+
// These used to be public, but they are now deprecated.
// Will remove entirely when all internal uses are fixed.
// In the meantime, use friendship so the unittest can still test them.
@@ -240,8 +242,8 @@ class PERFTOOLS_DLL_DECL HeapLeakChecker {
friend int main(int, char**);
- // Helper for DisableChecksIn
- static void DisableChecksInLocked(const char* pattern);
+ // Actually implements IgnoreObject().
+ static void DoIgnoreObject(const void* ptr);
// Disable checks based on stack trace entry at a depth <=
// max_depth. Used to hide allocations done inside some special
@@ -286,10 +288,6 @@ class PERFTOOLS_DLL_DECL HeapLeakChecker {
// are being used.
static void IgnoreLiveObjectsLocked(const char* name, const char* name2);
- // Runs REGISTER_HEAPCHECK_CLEANUP cleanups and potentially
- // calls DoMainHeapCheck
- static void RunHeapCleanups();
-
// Do the overall whole-program heap leak check if needed;
// returns true when did the leak check.
static bool DoMainHeapCheck();
@@ -348,6 +346,13 @@ class PERFTOOLS_DLL_DECL HeapLeakChecker {
// This gets to execute after destructors for all global objects
friend void HeapLeakChecker_AfterDestructors();
+ // Full starting of recommended whole-program checking.
+ friend void HeapLeakChecker_InternalInitStart();
+
+ // Runs REGISTER_HEAPCHECK_CLEANUP cleanups and potentially
+ // calls DoMainHeapCheck
+ friend void HeapLeakChecker_RunHeapCleanups();
+
// ----------------------------------------------------------------------- //
// Member data.
« no previous file with comments | « third_party/tcmalloc/chromium/src/debugallocation.cc ('k') | third_party/tcmalloc/chromium/src/google/malloc_extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698