IndexedDBFactory now ForceCloses databases.
[chromium-blink-merge.git] / content / browser / profiler_message_filter.cc
blobadea8e71fa04c7de706e0a6958abafb7c6890109
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
3 // found in the LICENSE file.
5 #include "content/browser/profiler_message_filter.h"
7 #include "base/tracked_objects.h"
8 #include "content/browser/profiler_controller_impl.h"
9 #include "content/browser/tcmalloc_internals_request_job.h"
10 #include "content/common/child_process_messages.h"
12 namespace content {
14 ProfilerMessageFilter::ProfilerMessageFilter(int process_type)
15 : process_type_(process_type) {
18 void ProfilerMessageFilter::OnChannelConnected(int32 peer_pid) {
19 tracked_objects::ThreadData::Status status =
20 tracked_objects::ThreadData::status();
21 Send(new ChildProcessMsg_SetProfilerStatus(status));
24 bool ProfilerMessageFilter::OnMessageReceived(const IPC::Message& message,
25 bool* message_was_ok) {
26 bool handled = true;
27 IPC_BEGIN_MESSAGE_MAP_EX(ProfilerMessageFilter, message, *message_was_ok)
28 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildProfilerData,
29 OnChildProfilerData)
30 #if defined(USE_TCMALLOC)
31 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_TcmallocStats, OnTcmallocStats)
32 #endif
33 IPC_MESSAGE_UNHANDLED(handled = false)
34 IPC_END_MESSAGE_MAP_EX()
35 return handled;
38 ProfilerMessageFilter::~ProfilerMessageFilter() {}
40 void ProfilerMessageFilter::OnChildProfilerData(
41 int sequence_number,
42 const tracked_objects::ProcessDataSnapshot& profiler_data) {
43 ProfilerControllerImpl::GetInstance()->OnProfilerDataCollected(
44 sequence_number, profiler_data, process_type_);
47 #if defined(USE_TCMALLOC)
48 void ProfilerMessageFilter::OnTcmallocStats(const std::string& output) {
49 AboutTcmallocOutputs::GetInstance()->OnStatsForChildProcess(
50 peer_pid(), process_type_, output);
52 #endif