| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/memory_benchmark_message_filter.h" | 5 #include "content/browser/renderer_host/memory_benchmark_message_filter.h" |
| 6 | 6 |
| 7 #include "content/common/memory_benchmark_messages.h" | 7 #include "content/common/memory_benchmark_messages.h" |
| 8 | 8 |
| 9 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) | 9 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) |
| 10 | 10 |
| 11 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" | 11 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 MemoryBenchmarkMessageFilter::MemoryBenchmarkMessageFilter() | 15 MemoryBenchmarkMessageFilter::MemoryBenchmarkMessageFilter() { |
| 16 : BrowserMessageFilter(MemoryBenchmarkMsgStart) { | |
| 17 } | 16 } |
| 18 | 17 |
| 19 bool MemoryBenchmarkMessageFilter::OnMessageReceived( | 18 bool MemoryBenchmarkMessageFilter::OnMessageReceived( |
| 20 const IPC::Message& message, | 19 const IPC::Message& message, |
| 21 bool* message_was_ok) { | 20 bool* message_was_ok) { |
| 22 bool handled = true; | 21 bool handled = true; |
| 23 IPC_BEGIN_MESSAGE_MAP_EX(MemoryBenchmarkMessageFilter, | 22 IPC_BEGIN_MESSAGE_MAP_EX(MemoryBenchmarkMessageFilter, |
| 24 message, | 23 message, |
| 25 *message_was_ok) | 24 *message_was_ok) |
| 26 IPC_MESSAGE_HANDLER(MemoryBenchmarkHostMsg_HeapProfilerDump, | 25 IPC_MESSAGE_HANDLER(MemoryBenchmarkHostMsg_HeapProfilerDump, |
| 27 OnHeapProfilerDump) | 26 OnHeapProfilerDump) |
| 28 IPC_MESSAGE_UNHANDLED(handled = false) | 27 IPC_MESSAGE_UNHANDLED(handled = false) |
| 29 IPC_END_MESSAGE_MAP() | 28 IPC_END_MESSAGE_MAP() |
| 30 return handled; | 29 return handled; |
| 31 } | 30 } |
| 32 | 31 |
| 33 MemoryBenchmarkMessageFilter::~MemoryBenchmarkMessageFilter() { | 32 MemoryBenchmarkMessageFilter::~MemoryBenchmarkMessageFilter() { |
| 34 } | 33 } |
| 35 | 34 |
| 36 void MemoryBenchmarkMessageFilter::OnHeapProfilerDump( | 35 void MemoryBenchmarkMessageFilter::OnHeapProfilerDump( |
| 37 const std::string& reason) { | 36 const std::string& reason) { |
| 38 ::HeapProfilerDump(reason.c_str()); | 37 ::HeapProfilerDump(reason.c_str()); |
| 39 } | 38 } |
| 40 | 39 |
| 41 } // namespace content | 40 } // namespace content |
| 42 | 41 |
| 43 #endif // defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) | 42 #endif // defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) |
| OLD | NEW |