Chromium Code Reviews| Index: content/common/child_thread.cc |
| diff --git a/content/common/child_thread.cc b/content/common/child_thread.cc |
| index 92773642517aa1782c7db0237f09ce4ffef257f5..8d7f177b7342d9e43b9938b30c6040e598bc74c4 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,17 @@ void ChildThread::OnDumpHandles() { |
| NOTIMPLEMENTED(); |
| } |
| +#if defined(USE_TCMALLOC) |
| +void ChildThread::OnGetTcmallocStats() |
| +{ |
|
jam
2012/04/24 20:14:08
nit: on previous line
|
| + 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(); |
| } |