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

Unified Diff: content/browser/profiler_message_filter.cc

Issue 8588023: Collect profiler stats from browser child processes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/profiler_message_filter.cc
===================================================================
--- content/browser/profiler_message_filter.cc (revision 0)
+++ content/browser/profiler_message_filter.cc (revision 0)
@@ -0,0 +1,46 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/profiler_message_filter.h"
+
+#include "base/tracked_objects.h"
+#include "base/values.h"
+#include "content/browser/profiler_controller_impl.h"
+#include "content/common/child_process_messages.h"
+
+using content::BrowserThread;
+
+ProfilerMessageFilter::ProfilerMessageFilter() {
+}
+
+ProfilerMessageFilter::~ProfilerMessageFilter() {
+}
+
+void ProfilerMessageFilter::OnChannelConnected(int32 peer_pid) {
+ BrowserMessageFilter::OnChannelConnected(peer_pid);
+
+ bool enable = tracked_objects::ThreadData::tracking_status();
+ Send(new ChildProcessMsg_SetProfilerStatus(enable));
+}
+
+bool ProfilerMessageFilter::OnMessageReceived(const IPC::Message& message,
+ bool* message_was_ok) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP_EX(ProfilerMessageFilter, message, *message_was_ok)
+ IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildProfilerData,
+ OnChildProfilerData)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP_EX()
+ return handled;
+}
+
+void ProfilerMessageFilter::OnChildProfilerData(
+ int sequence_number,
+ const base::DictionaryValue& profiler_data) {
+ base::DictionaryValue* dictionary_value = new base::DictionaryValue;
+ dictionary_value->MergeDictionary(&profiler_data);
+ // OnProfilerDataCollected assumes the ownership of profiler_data.
+ content::ProfilerControllerImpl::GetInstance()->OnProfilerDataCollected(
+ sequence_number, dictionary_value);
+}
Property changes on: content\browser\profiler_message_filter.cc
___________________________________________________________________
Added: svn:executable
+ *
« no previous file with comments | « content/browser/profiler_message_filter.h ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698