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/tracked_objects.h" | 7 #include "base/tracked_objects.h" |
8 #include "content/browser/profiler_controller_impl.h" | 8 #include "content/browser/profiler_controller_impl.h" |
9 #include "content/common/child_process_messages.h" | 9 #include "content/common/child_process_messages.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 ProfilerMessageFilter::ProfilerMessageFilter(content::ProcessType process_type) | 13 ProfilerMessageFilter::ProfilerMessageFilter(content::ProcessType process_type) |
14 : BrowserMessageFilter(ChildProcessMsgStart), process_type_(process_type) { | 14 : BrowserMessageFilter(ChildProcessMsgStart), process_type_(process_type) { |
15 } | 15 } |
16 | 16 |
17 void ProfilerMessageFilter::OnChannelConnected(int32 peer_pid) { | 17 void ProfilerMessageFilter::OnChannelConnected(int32_t peer_pid) { |
18 tracked_objects::ThreadData::Status status = | 18 tracked_objects::ThreadData::Status status = |
19 tracked_objects::ThreadData::status(); | 19 tracked_objects::ThreadData::status(); |
20 Send(new ChildProcessMsg_SetProfilerStatus(status)); | 20 Send(new ChildProcessMsg_SetProfilerStatus(status)); |
21 } | 21 } |
22 | 22 |
23 bool ProfilerMessageFilter::OnMessageReceived(const IPC::Message& message) { | 23 bool ProfilerMessageFilter::OnMessageReceived(const IPC::Message& message) { |
24 bool handled = true; | 24 bool handled = true; |
25 IPC_BEGIN_MESSAGE_MAP(ProfilerMessageFilter, message) | 25 IPC_BEGIN_MESSAGE_MAP(ProfilerMessageFilter, message) |
26 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildProfilerData, | 26 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildProfilerData, |
27 OnChildProfilerData) | 27 OnChildProfilerData) |
28 IPC_MESSAGE_UNHANDLED(handled = false) | 28 IPC_MESSAGE_UNHANDLED(handled = false) |
29 IPC_END_MESSAGE_MAP() | 29 IPC_END_MESSAGE_MAP() |
30 return handled; | 30 return handled; |
31 } | 31 } |
32 | 32 |
33 ProfilerMessageFilter::~ProfilerMessageFilter() {} | 33 ProfilerMessageFilter::~ProfilerMessageFilter() {} |
34 | 34 |
35 void ProfilerMessageFilter::OnChildProfilerData( | 35 void ProfilerMessageFilter::OnChildProfilerData( |
36 int sequence_number, | 36 int sequence_number, |
37 const tracked_objects::ProcessDataSnapshot& profiler_data) { | 37 const tracked_objects::ProcessDataSnapshot& profiler_data) { |
38 ProfilerControllerImpl::GetInstance()->OnProfilerDataCollected( | 38 ProfilerControllerImpl::GetInstance()->OnProfilerDataCollected( |
39 sequence_number, profiler_data, process_type_); | 39 sequence_number, profiler_data, process_type_); |
40 } | 40 } |
41 | 41 |
42 } | 42 } |
OLD | NEW |