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

Unified Diff: content/app/content_main_runner.cc

Issue 10411047: Type profiler by intercepting 'new' and 'delete' expressions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix IsAvailable Created 8 years, 3 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: 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);

Powered by Google App Engine
This is Rietveld 408576698