|
OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/browser/profiler_controller_impl.h" | |
6 | |
7 #include "base/values.h" | |
8 #include "content/public/browser/browser_thread.h" | |
9 #include "content/public/browser/profiler_subscriber.h" | |
10 | |
11 using content::BrowserThread; | |
12 | |
13 ProfilerControllerImpl::ProfilerControllerImpl() : subscriber_(NULL) { | |
14 } | |
15 | |
16 ProfilerControllerImpl::~ProfilerControllerImpl() { | |
17 } | |
18 | |
19 ProfilerControllerImpl* ProfilerControllerImpl::GetInstance() { | |
20 return Singleton<ProfilerControllerImpl>::get(); | |
21 } | |
22 | |
23 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.
| |
24 return ProfilerControllerImpl::GetInstance(); | |
25 } | |
26 | |
27 void ProfilerControllerImpl::Register(ProfilerSubscriber* subscriber) { | |
28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
29 DCHECK(!subscriber_); | |
30 subscriber_ = subscriber; | |
31 } | |
32 | |
33 void ProfilerControllerImpl::Unregister(ProfilerSubscriber* subscriber) { | |
34 if (subscriber == subscriber_) { | |
35 subscriber_ = NULL; | |
36 } | |
37 } | |
38 | |
39 void ProfilerControllerImpl::OnPendingProcesses(int sequence_number, | |
40 int pending_processes) { | |
41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
42 if (subscriber_) { | |
43 subscriber_->OnPendingProcesses(sequence_number, pending_processes); | |
44 } | |
45 } | |
46 | |
47 void ProfilerControllerImpl::OnProfilerDataCollected( | |
48 int sequence_number, | |
49 const base::DictionaryValue& profiler_data) { | |
50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
51 if (subscriber_) { | |
52 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.
| |
53 } | |
54 } | |
OLD | NEW |