Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: content/browser/profiler_message_filter.cc

Issue 10041017: Show gpu process stats in about:tcmalloc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: with correct (?) layering Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/process_util.h"
8 #include "content/browser/profiler_controller_impl.h" 9 #include "content/browser/profiler_controller_impl.h"
9 #include "content/common/child_process_messages.h" 10 #include "content/common/child_process_messages.h"
10 11
11 namespace content { 12 namespace content {
12 13
13 ProfilerMessageFilter::ProfilerMessageFilter(ProcessType process_type) 14 ProfilerMessageFilter::ProfilerMessageFilter(ProcessType process_type)
14 : process_type_(process_type) { 15 : process_type_(process_type) {
15 } 16 }
16 17
17 ProfilerMessageFilter::~ProfilerMessageFilter() { 18 ProfilerMessageFilter::~ProfilerMessageFilter() {
18 } 19 }
19 20
20 void ProfilerMessageFilter::OnChannelConnected(int32 peer_pid) { 21 void ProfilerMessageFilter::OnChannelConnected(int32 peer_pid) {
21 BrowserMessageFilter::OnChannelConnected(peer_pid); 22 BrowserMessageFilter::OnChannelConnected(peer_pid);
22 23
23 tracked_objects::ThreadData::Status status = 24 tracked_objects::ThreadData::Status status =
24 tracked_objects::ThreadData::status(); 25 tracked_objects::ThreadData::status();
25 Send(new ChildProcessMsg_SetProfilerStatus(status)); 26 Send(new ChildProcessMsg_SetProfilerStatus(status));
26 } 27 }
27 28
28 bool ProfilerMessageFilter::OnMessageReceived(const IPC::Message& message, 29 bool ProfilerMessageFilter::OnMessageReceived(const IPC::Message& message,
29 bool* message_was_ok) { 30 bool* message_was_ok) {
30 bool handled = true; 31 bool handled = true;
31 IPC_BEGIN_MESSAGE_MAP_EX(ProfilerMessageFilter, message, *message_was_ok) 32 IPC_BEGIN_MESSAGE_MAP_EX(ProfilerMessageFilter, message, *message_was_ok)
32 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildProfilerData, 33 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildProfilerData,
33 OnChildProfilerData) 34 OnChildProfilerData)
35 #if defined(USE_TCMALLOC)
36 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_TcmallocStats, OnTcmallocStats)
37 #endif
34 IPC_MESSAGE_UNHANDLED(handled = false) 38 IPC_MESSAGE_UNHANDLED(handled = false)
35 IPC_END_MESSAGE_MAP_EX() 39 IPC_END_MESSAGE_MAP_EX()
36 return handled; 40 return handled;
37 } 41 }
38 42
39 void ProfilerMessageFilter::OnChildProfilerData( 43 void ProfilerMessageFilter::OnChildProfilerData(
40 int sequence_number, 44 int sequence_number,
41 const tracked_objects::ProcessDataSnapshot& profiler_data) { 45 const tracked_objects::ProcessDataSnapshot& profiler_data) {
42 ProfilerControllerImpl::GetInstance()->OnProfilerDataCollected( 46 ProfilerControllerImpl::GetInstance()->OnProfilerDataCollected(
43 sequence_number, profiler_data, process_type_); 47 sequence_number, profiler_data, process_type_);
44 } 48 }
45 49
50 #if defined(USE_TCMALLOC)
51 void ProfilerMessageFilter::OnTcmallocStats(const std::string& output) {
52 base::ProcessId pid = base::GetProcId(peer_handle());
53 ProfilerControllerImpl::GetInstance()->OnTcmallocStatsCollected(
54 pid, process_type_, output);
46 } 55 }
56 #endif
57
58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698