OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/profiler_message_filter.h" | 5 #include "content/browser/profiler_message_filter.h" |
6 | 6 |
| 7 #include "base/metrics/call_stack_profile_params.h" |
7 #include "base/tracked_objects.h" | 8 #include "base/tracked_objects.h" |
8 #include "content/browser/profiler_controller_impl.h" | 9 #include "content/browser/profiler_controller_impl.h" |
9 #include "content/browser/tcmalloc_internals_request_job.h" | 10 #include "content/browser/tcmalloc_internals_request_job.h" |
10 #include "content/common/child_process_messages.h" | 11 #include "content/common/child_process_messages.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 ProfilerMessageFilter::ProfilerMessageFilter(content::ProcessType process_type) | 15 ProfilerMessageFilter::ProfilerMessageFilter(content::ProcessType process_type) |
15 : BrowserMessageFilter(ChildProcessMsgStart), process_type_(process_type) { | 16 : BrowserMessageFilter(ChildProcessMsgStart), process_type_(process_type) { |
16 } | 17 } |
17 | 18 |
18 void ProfilerMessageFilter::OnChannelConnected(int32 peer_pid) { | 19 void ProfilerMessageFilter::OnChannelConnected(int32 peer_pid) { |
19 tracked_objects::ThreadData::Status status = | 20 tracked_objects::ThreadData::Status status = |
20 tracked_objects::ThreadData::status(); | 21 tracked_objects::ThreadData::status(); |
21 Send(new ChildProcessMsg_SetProfilerStatus(status)); | 22 Send(new ChildProcessMsg_SetProfilerStatus(status)); |
22 } | 23 } |
23 | 24 |
24 bool ProfilerMessageFilter::OnMessageReceived(const IPC::Message& message) { | 25 bool ProfilerMessageFilter::OnMessageReceived(const IPC::Message& message) { |
25 bool handled = true; | 26 bool handled = true; |
26 IPC_BEGIN_MESSAGE_MAP(ProfilerMessageFilter, message) | 27 IPC_BEGIN_MESSAGE_MAP(ProfilerMessageFilter, message) |
27 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildProfilerData, | 28 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildProfilerData, |
28 OnChildProfilerData) | 29 OnChildProfilerData) |
| 30 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildStackProfilerData, |
| 31 OnChildStackProfilerData) |
29 #if defined(USE_TCMALLOC) | 32 #if defined(USE_TCMALLOC) |
30 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_TcmallocStats, OnTcmallocStats) | 33 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_TcmallocStats, OnTcmallocStats) |
31 #endif | 34 #endif |
32 IPC_MESSAGE_UNHANDLED(handled = false) | 35 IPC_MESSAGE_UNHANDLED(handled = false) |
33 IPC_END_MESSAGE_MAP() | 36 IPC_END_MESSAGE_MAP() |
34 return handled; | 37 return handled; |
35 } | 38 } |
36 | 39 |
37 ProfilerMessageFilter::~ProfilerMessageFilter() {} | 40 ProfilerMessageFilter::~ProfilerMessageFilter() {} |
38 | 41 |
39 void ProfilerMessageFilter::OnChildProfilerData( | 42 void ProfilerMessageFilter::OnChildProfilerData( |
40 int sequence_number, | 43 int sequence_number, |
41 const tracked_objects::ProcessDataSnapshot& profiler_data) { | 44 const tracked_objects::ProcessDataSnapshot& profiler_data) { |
42 ProfilerControllerImpl::GetInstance()->OnProfilerDataCollected( | 45 ProfilerControllerImpl::GetInstance()->OnProfilerDataCollected( |
43 sequence_number, profiler_data, process_type_); | 46 sequence_number, profiler_data, process_type_); |
44 } | 47 } |
45 | 48 |
| 49 void ProfilerMessageFilter::OnChildStackProfilerData( |
| 50 const base::StackSamplingProfiler::CallStackProfiles& profiler_data, |
| 51 const base::CallStackProfileParams& params, |
| 52 base::TimeTicks start_timestamp) {} |
| 53 |
46 #if defined(USE_TCMALLOC) | 54 #if defined(USE_TCMALLOC) |
47 void ProfilerMessageFilter::OnTcmallocStats(const std::string& output) { | 55 void ProfilerMessageFilter::OnTcmallocStats(const std::string& output) { |
48 AboutTcmallocOutputs::GetInstance()->OnStatsForChildProcess( | 56 AboutTcmallocOutputs::GetInstance()->OnStatsForChildProcess( |
49 peer_pid(), process_type_, output); | 57 peer_pid(), process_type_, output); |
50 } | 58 } |
51 #endif | 59 #endif |
52 | 60 |
53 } | 61 } |
OLD | NEW |