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) { | 16 : BrowserMessageFilter(MemoryBenchmarkMsgStart) { |
17 } | 17 } |
18 | 18 |
19 bool MemoryBenchmarkMessageFilter::OnMessageReceived( | 19 bool MemoryBenchmarkMessageFilter::OnMessageReceived( |
20 const IPC::Message& message, | 20 const IPC::Message& message) { |
21 bool* message_was_ok) { | |
22 bool handled = true; | 21 bool handled = true; |
23 IPC_BEGIN_MESSAGE_MAP_EX(MemoryBenchmarkMessageFilter, | 22 IPC_BEGIN_MESSAGE_MAP(MemoryBenchmarkMessageFilter, message) |
24 message, | |
25 *message_was_ok) | |
26 IPC_MESSAGE_HANDLER(MemoryBenchmarkHostMsg_HeapProfilerDump, | 23 IPC_MESSAGE_HANDLER(MemoryBenchmarkHostMsg_HeapProfilerDump, |
27 OnHeapProfilerDump) | 24 OnHeapProfilerDump) |
28 IPC_MESSAGE_UNHANDLED(handled = false) | 25 IPC_MESSAGE_UNHANDLED(handled = false) |
29 IPC_END_MESSAGE_MAP() | 26 IPC_END_MESSAGE_MAP() |
30 return handled; | 27 return handled; |
31 } | 28 } |
32 | 29 |
33 MemoryBenchmarkMessageFilter::~MemoryBenchmarkMessageFilter() { | 30 MemoryBenchmarkMessageFilter::~MemoryBenchmarkMessageFilter() { |
34 } | 31 } |
35 | 32 |
36 void MemoryBenchmarkMessageFilter::OnHeapProfilerDump( | 33 void MemoryBenchmarkMessageFilter::OnHeapProfilerDump( |
37 const std::string& reason) { | 34 const std::string& reason) { |
38 ::HeapProfilerDump(reason.c_str()); | 35 ::HeapProfilerDump(reason.c_str()); |
39 } | 36 } |
40 | 37 |
41 } // namespace content | 38 } // namespace content |
42 | 39 |
43 #endif // defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) | 40 #endif // defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) |
OLD | NEW |