| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_POWER_PROFILER_POWER_PROFILER_SERVICE_H_ | 5 #ifndef CONTENT_BROWSER_POWER_PROFILER_POWER_PROFILER_SERVICE_H_ |
| 6 #define CONTENT_BROWSER_POWER_PROFILER_POWER_PROFILER_SERVICE_H_ | 6 #define CONTENT_BROWSER_POWER_PROFILER_POWER_PROFILER_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 11 #include "base/task_runner.h" | 11 #include "base/task_runner.h" |
| 12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
| 13 #include "content/browser/power_profiler/power_data_provider.h" | 13 #include "content/browser/power_profiler/power_data_provider.h" |
| 14 #include "content/browser/power_profiler/power_profiler_observer.h" | 14 #include "content/browser/power_profiler/power_profiler_observer.h" |
| 15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 // A class used to query power information and notify the observers. | 19 // A class used to query power information and notify the observers. |
| 20 class CONTENT_EXPORT PowerProfilerService { | 20 class CONTENT_EXPORT PowerProfilerService { |
| 21 public: | 21 public: |
| 22 static PowerProfilerService* GetInstance(); | 22 static PowerProfilerService* GetInstance(); |
| 23 | 23 |
| 24 // Add and remove an observer. | 24 // Add and remove an observer. |
| 25 void AddObserver(PowerProfilerObserver* observer); | 25 void AddObserver(PowerProfilerObserver* observer); |
| 26 void RemoveObserver(PowerProfilerObserver* observer); | 26 void RemoveObserver(PowerProfilerObserver* observer); |
| 27 bool HasObserver(PowerProfilerObserver* observer) const { |
| 28 return observers_.HasObserver(observer); |
| 29 } |
| 27 | 30 |
| 28 bool IsAvailable(); | 31 bool IsAvailable(); |
| 29 | 32 |
| 30 virtual ~PowerProfilerService(); | 33 virtual ~PowerProfilerService(); |
| 31 | 34 |
| 32 private: | 35 private: |
| 33 enum Status { | 36 enum Status { |
| 34 UNINITIALIZED, | 37 UNINITIALIZED, |
| 35 INITIALIZED, // Initialized, profiling has not started. | 38 INITIALIZED, // Initialized, profiling has not started. |
| 36 PROFILING | 39 PROFILING |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 ObserverList<PowerProfilerObserver> observers_; | 71 ObserverList<PowerProfilerObserver> observers_; |
| 69 | 72 |
| 70 scoped_ptr<PowerDataProvider> data_provider_; | 73 scoped_ptr<PowerDataProvider> data_provider_; |
| 71 | 74 |
| 72 DISALLOW_COPY_AND_ASSIGN(PowerProfilerService); | 75 DISALLOW_COPY_AND_ASSIGN(PowerProfilerService); |
| 73 }; | 76 }; |
| 74 | 77 |
| 75 } // namespace content | 78 } // namespace content |
| 76 | 79 |
| 77 #endif // CONTENT_BROWSER_POWER_PROFILER_POWER_PROFILER_SERVICE_H_ | 80 #endif // CONTENT_BROWSER_POWER_PROFILER_POWER_PROFILER_SERVICE_H_ |
| OLD | NEW |