Chromium Code Reviews| 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 |
| + * |