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

Unified Diff: content/browser/profiler_controller_impl.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_controller_impl.cc
===================================================================
--- content/browser/profiler_controller_impl.cc (revision 0)
+++ content/browser/profiler_controller_impl.cc (revision 0)
@@ -0,0 +1,54 @@
+// 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_controller_impl.h"
+
+#include "base/values.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/profiler_subscriber.h"
+
+using content::BrowserThread;
+
+ProfilerControllerImpl::ProfilerControllerImpl() : subscriber_(NULL) {
+}
+
+ProfilerControllerImpl::~ProfilerControllerImpl() {
+}
+
+ProfilerControllerImpl* ProfilerControllerImpl::GetInstance() {
+ return Singleton<ProfilerControllerImpl>::get();
+}
+
+content::ProfilerController* content::ProfilerController::GetInstance() {
jam 2011/11/28 15:17:34 by convention, put statics at top of the funcitons
ramant (doing other things) 2011/11/29 01:32:20 Done.
+ return ProfilerControllerImpl::GetInstance();
+}
+
+void ProfilerControllerImpl::Register(ProfilerSubscriber* subscriber) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(!subscriber_);
+ subscriber_ = subscriber;
+}
+
+void ProfilerControllerImpl::Unregister(ProfilerSubscriber* subscriber) {
+ if (subscriber == subscriber_) {
+ subscriber_ = NULL;
+ }
+}
+
+void ProfilerControllerImpl::OnPendingProcesses(int sequence_number,
+ int pending_processes) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ if (subscriber_) {
+ subscriber_->OnPendingProcesses(sequence_number, pending_processes);
+ }
+}
+
+void ProfilerControllerImpl::OnProfilerDataCollected(
+ int sequence_number,
+ const base::DictionaryValue& profiler_data) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ if (subscriber_) {
+ subscriber_->OnProfilerDataCollected(sequence_number, profiler_data);
jam 2011/11/28 15:17:34 why call the subscriber on the IO thread? the inte
ramant (doing other things) 2011/11/29 01:32:20 Done.
+ }
+}
Property changes on: content\browser\profiler_controller_impl.cc
___________________________________________________________________
Added: svn:executable
+ *

Powered by Google App Engine
This is Rietveld 408576698