OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/profiler_message_filter.h" |
| 6 |
| 7 #include "base/tracked_objects.h" |
| 8 #include "content/browser/profiler_controller.h" |
| 9 #include "content/common/child_process_messages.h" |
| 10 |
| 11 using content::BrowserThread; |
| 12 |
| 13 ProfilerMessageFilter::ProfilerMessageFilter() { |
| 14 } |
| 15 |
| 16 ProfilerMessageFilter::~ProfilerMessageFilter() { |
| 17 } |
| 18 |
| 19 bool ProfilerMessageFilter::OnMessageReceived(const IPC::Message& message, |
| 20 bool* message_was_ok) { |
| 21 // Always on IO thread (BrowserMessageFilter guarantee). |
| 22 bool handled = true; |
| 23 IPC_BEGIN_MESSAGE_MAP_EX(ProfilerMessageFilter, message, *message_was_ok) |
| 24 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildProfilerData, |
| 25 OnChildProfilerData) |
| 26 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_IsProfilerEnabled, |
| 27 OnIsProfilerEnabled) |
| 28 IPC_MESSAGE_UNHANDLED(handled = false) |
| 29 IPC_END_MESSAGE_MAP_EX() |
| 30 return handled; |
| 31 } |
| 32 |
| 33 void ProfilerMessageFilter::OnChildProfilerData( |
| 34 int sequence_number, |
| 35 const std::string& profiler_data) { |
| 36 ProfilerController::GetInstance()->OnProfilerDataCollected( |
| 37 sequence_number, profiler_data); |
| 38 } |
| 39 |
| 40 void ProfilerMessageFilter::OnIsProfilerEnabled( |
| 41 base::ProcessId child_process_id) { |
| 42 ProfilerController::GetInstance()->OnIsProfilerEnabled(child_process_id); |
| 43 } |
OLD | NEW |