Index: content/common/child_thread.cc |
diff --git a/content/common/child_thread.cc b/content/common/child_thread.cc |
index 92773642517aa1782c7db0237f09ce4ffef257f5..b701ba2663bcab81335b7f033cadf2064fc6ed23 100644 |
--- a/content/common/child_thread.cc |
+++ b/content/common/child_thread.cc |
@@ -27,6 +27,10 @@ |
#include "content/common/handle_enumerator_win.h" |
#endif |
+#if defined(USE_TCMALLOC) |
+#include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" |
+#endif |
+ |
using tracked_objects::ThreadData; |
ChildThread::ChildThread() { |
@@ -191,6 +195,9 @@ bool ChildThread::OnMessageReceived(const IPC::Message& msg) { |
IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData, |
OnGetChildProfilerData) |
IPC_MESSAGE_HANDLER(ChildProcessMsg_DumpHandles, OnDumpHandles) |
+#if defined(USE_TCMALLOC) |
+ IPC_MESSAGE_HANDLER(ChildProcessMsg_GetTcmallocStats, OnGetTcmallocStats) |
+#endif |
IPC_MESSAGE_UNHANDLED(handled = false) |
IPC_END_MESSAGE_MAP() |
@@ -246,6 +253,16 @@ void ChildThread::OnDumpHandles() { |
NOTIMPLEMENTED(); |
} |
+#if defined(USE_TCMALLOC) |
+void ChildThread::OnGetTcmallocStats() { |
+ std::string result; |
+ char buffer[1024 * 32]; |
+ MallocExtension::instance()->GetStats(buffer, sizeof(buffer)); |
+ result.append(buffer); |
+ Send(new ChildProcessHostMsg_TcmallocStats(result)); |
+} |
+#endif |
+ |
ChildThread* ChildThread::current() { |
return ChildProcess::current()->main_thread(); |
} |