OLD | NEW |
1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_ |
6 #define CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_ | 6 #define CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_ |
7 | 7 |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "base/tracked_objects.h" |
9 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
10 #include "content/public/browser/profiler_controller.h" | 11 #include "content/public/browser/profiler_controller.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 // ProfilerController's implementation. | 15 // ProfilerController's implementation. |
15 class CONTENT_EXPORT ProfilerControllerImpl : public ProfilerController { | 16 class CONTENT_EXPORT ProfilerControllerImpl : public ProfilerController { |
16 public: | 17 public: |
17 static ProfilerControllerImpl* GetInstance(); | 18 static ProfilerControllerImpl* GetInstance(); |
18 | 19 |
19 // Normally instantiated when the child process is launched. Only one instance | 20 // Normally instantiated when the child process is launched. Only one instance |
20 // should be created per process. | 21 // should be created per process. |
21 ProfilerControllerImpl(); | 22 ProfilerControllerImpl(); |
22 virtual ~ProfilerControllerImpl(); | 23 virtual ~ProfilerControllerImpl(); |
23 | 24 |
24 // Send number of pending processes to subscriber_. |end| is set to true if it | 25 // Send number of pending processes to subscriber_. |end| is set to true if it |
25 // is the last time. This is called on UI thread. | 26 // is the last time. This is called on UI thread. |
26 void OnPendingProcesses(int sequence_number, int pending_processes, bool end); | 27 void OnPendingProcesses(int sequence_number, int pending_processes, bool end); |
27 | 28 |
28 // Send profiler_data back to subscriber_. subscriber_ assumes the ownership | 29 // Send profiler_data back to subscriber_. subscriber_ assumes the ownership |
29 // of profiler_data. This is called on UI thread. | 30 // of profiler_data. This is called on UI thread. |
30 void OnProfilerDataCollected(int sequence_number, | 31 void OnProfilerDataCollected(int sequence_number, |
31 base::DictionaryValue* profiler_data); | 32 base::DictionaryValue* profiler_data); |
32 | 33 |
33 // ProfilerController implementation: | 34 // ProfilerController implementation: |
34 virtual void Register(ProfilerSubscriber* subscriber) OVERRIDE; | 35 virtual void Register(ProfilerSubscriber* subscriber) OVERRIDE; |
35 virtual void Unregister(ProfilerSubscriber* subscriber) OVERRIDE; | 36 virtual void Unregister(ProfilerSubscriber* subscriber) OVERRIDE; |
36 virtual void GetProfilerData(int sequence_number) OVERRIDE; | 37 virtual void GetProfilerData(int sequence_number) OVERRIDE; |
37 virtual void SetProfilerStatus(bool enable) OVERRIDE; | 38 virtual void SetProfilerStatus( |
| 39 tracked_objects::ThreadData::Status status) OVERRIDE; |
38 | 40 |
39 private: | 41 private: |
40 friend struct DefaultSingletonTraits<ProfilerControllerImpl>; | 42 friend struct DefaultSingletonTraits<ProfilerControllerImpl>; |
41 | 43 |
42 // Contact child processes and get their profiler data. | 44 // Contact child processes and get their profiler data. |
43 void GetProfilerDataFromChildProcesses(int sequence_number); | 45 void GetProfilerDataFromChildProcesses(int sequence_number); |
44 | 46 |
45 // Contact child processes and set profiler status to |enable|. | 47 // Contact child processes and set profiler status to |enable|. |
46 void SetProfilerStatusInChildProcesses(bool enable); | 48 void SetProfilerStatusInChildProcesses( |
| 49 tracked_objects::ThreadData::Status status); |
47 | 50 |
48 ProfilerSubscriber* subscriber_; | 51 ProfilerSubscriber* subscriber_; |
49 | 52 |
50 DISALLOW_COPY_AND_ASSIGN(ProfilerControllerImpl); | 53 DISALLOW_COPY_AND_ASSIGN(ProfilerControllerImpl); |
51 }; | 54 }; |
52 | 55 |
53 } // namespace content | 56 } // namespace content |
54 | 57 |
55 #endif // CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_ | 58 #endif // CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_ |
56 | 59 |
OLD | NEW |