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

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: fixed 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
« no previous file with comments | « build/common.gypi ('k') | third_party/tcmalloc/chromium/src/gperftools/type_profiler_map.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/app/content_main_runner.cc
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index aabe6a311be2ac8d26a7dd4f6334cbff8e195a26..98b6dd8f8be41feb0d53589414d5125f1c6c67e0 100644
--- a/content/app/content_main_runner.cc
+++ b/content/app/content_main_runner.cc
@@ -49,6 +49,10 @@
#if defined(USE_TCMALLOC)
#include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h"
+#if defined(TYPE_PROFILING)
+#include "base/allocator/type_profiler.h"
+#include "base/allocator/type_profiler_tcmalloc.h"
+#endif
#endif
#if defined(OS_WIN)
@@ -503,13 +507,20 @@ 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)
+ base::type_profiler::InterceptFunctions::SetFunctions(
+ base::type_profiler::NewInterceptForTCMalloc,
+ base::type_profiler::DeleteInterceptForTCMalloc);
+#endif
+
// For tcmalloc, we need to tell it to behave like new.
tc_set_new_mode(1);
« no previous file with comments | « build/common.gypi ('k') | third_party/tcmalloc/chromium/src/gperftools/type_profiler_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698