Index: content/app/content_main_runner.cc |
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc |
index 4d76ab1f5170d86e479d12bfb8e9bd007a88ab05..3c96036d88e5b206d56d1bd8a9479a2065b0da16 100644 |
--- a/content/app/content_main_runner.cc |
+++ b/content/app/content_main_runner.cc |
@@ -48,6 +48,9 @@ |
#if defined(USE_TCMALLOC) |
#include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" |
+#if defined(TYPE_PROFILING) |
+#include "base/allocator/type_profiler_tcmalloc.h" |
+#endif |
#endif |
#if defined(OS_WIN) |
@@ -440,13 +443,22 @@ static void ReleaseFreeMemoryThunk() { |
const char** argv, |
ContentMainDelegate* delegate) OVERRIDE { |
- // NOTE(willchan): One might ask why this call is done here rather than in |
- // process_util_linux.cc with the definition of |
+ // NOTE(willchan): One might ask why these TCMalloc-related calls are done |
+ // here rather than in process_util_linux.cc with the definition of |
// EnableTerminationOnOutOfMemory(). That's because base shouldn't have a |
// dependency on TCMalloc. Really, we ought to have our allocator shim code |
// implement this EnableTerminationOnOutOfMemory() function. Whateverz. |
// This works for now. |
#if !defined(OS_MACOSX) && defined(USE_TCMALLOC) |
+ |
+#if defined(TYPE_PROFILING) |
+ bool is_type_profiler_initialized = |
+ base::type_profiler::InterceptFunctions::SetFunctions( |
+ base::type_profiler::NewInterceptForTCMalloc, |
+ base::type_profiler::DeleteInterceptForTCMalloc); |
+ DCHECK(is_type_profiler_initialized); |
+#endif |
+ |
// For tcmalloc, we need to tell it to behave like new. |
tc_set_new_mode(1); |