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

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

Issue 9702014: [UMA] Use proper C++ objects to serialize tracked_objects across process boundaries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Write JSON unit test and update profiler.js Created 8 years, 9 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/values.h"
9 #include "content/browser/profiler_controller_impl.h" 8 #include "content/browser/profiler_controller_impl.h"
10 #include "content/common/child_process_messages.h" 9 #include "content/common/child_process_messages.h"
11 10
12 using content::BrowserMessageFilter; 11 namespace content {
13 using content::BrowserThread;
14 12
15 ProfilerMessageFilter::ProfilerMessageFilter() { 13 ProfilerMessageFilter::ProfilerMessageFilter() {
16 } 14 }
17 15
18 ProfilerMessageFilter::~ProfilerMessageFilter() { 16 ProfilerMessageFilter::~ProfilerMessageFilter() {
19 } 17 }
20 18
21 void ProfilerMessageFilter::OnChannelConnected(int32 peer_pid) { 19 void ProfilerMessageFilter::OnChannelConnected(int32 peer_pid) {
22 BrowserMessageFilter::OnChannelConnected(peer_pid); 20 BrowserMessageFilter::OnChannelConnected(peer_pid);
23 21
24 tracked_objects::ThreadData::Status status = 22 tracked_objects::ThreadData::Status status =
25 tracked_objects::ThreadData::status(); 23 tracked_objects::ThreadData::status();
26 Send(new ChildProcessMsg_SetProfilerStatus(status)); 24 Send(new ChildProcessMsg_SetProfilerStatus(status));
27 } 25 }
28 26
29 bool ProfilerMessageFilter::OnMessageReceived(const IPC::Message& message, 27 bool ProfilerMessageFilter::OnMessageReceived(const IPC::Message& message,
30 bool* message_was_ok) { 28 bool* message_was_ok) {
31 bool handled = true; 29 bool handled = true;
32 IPC_BEGIN_MESSAGE_MAP_EX(ProfilerMessageFilter, message, *message_was_ok) 30 IPC_BEGIN_MESSAGE_MAP_EX(ProfilerMessageFilter, message, *message_was_ok)
33 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildProfilerData, 31 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildProfilerData,
34 OnChildProfilerData) 32 OnChildProfilerData)
35 IPC_MESSAGE_UNHANDLED(handled = false) 33 IPC_MESSAGE_UNHANDLED(handled = false)
36 IPC_END_MESSAGE_MAP_EX() 34 IPC_END_MESSAGE_MAP_EX()
37 return handled; 35 return handled;
38 } 36 }
39 37
40 void ProfilerMessageFilter::OnChildProfilerData( 38 void ProfilerMessageFilter::OnChildProfilerData(
41 int sequence_number, 39 int sequence_number,
42 const base::DictionaryValue& profiler_data) { 40 const tracked_objects::SerializedProcessData& profiler_data,
43 base::DictionaryValue* dictionary_value = new base::DictionaryValue; 41 content::ProcessType process_type) {
44 dictionary_value->MergeDictionary(&profiler_data); 42 ProfilerControllerImpl::GetInstance()->OnProfilerDataCollected(
45 // OnProfilerDataCollected assumes the ownership of profiler_data. 43 sequence_number, profiler_data, process_type);
46 content::ProfilerControllerImpl::GetInstance()->OnProfilerDataCollected(
47 sequence_number, dictionary_value);
48 } 44 }
45
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698