Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_POWER_DATA_PROVIDER_H_ | |
| 6 #define CONTENT_BROWSER_POWER_DATA_PROVIDER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/time/time.h" | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 // A class used to monitor the power usage and tell profiler the power data | |
|
qsr
2014/01/22 15:30:01
The comment seems not to apply to this object. Thi
| |
| 15 struct PowerEvent { | |
| 16 enum Type { | |
| 17 // Total power of SoC. including CPU, GT and others on the chip | |
| 18 SOC_PACKAGE, | |
| 19 | |
| 20 // Count the number of known PowerEvent | |
| 21 ID_COUNT | |
| 22 }; | |
| 23 | |
| 24 Type type; | |
| 25 base::TimeTicks time; | |
| 26 double value; // power | |
| 27 }; | |
| 28 | |
| 29 // A class used to GET power usage | |
|
qsr
2014/01/22 15:30:01
No need for uppercase.
| |
| 30 class PowerDataProvider { | |
| 31 public: | |
| 32 virtual ~PowerDataProvider() { } | |
| 33 | |
| 34 // Return true when success | |
|
qsr
2014/01/22 15:30:01
Can you be more precise and what this method those
| |
| 35 virtual bool GetData(PowerEvent*) = 0; | |
| 36 | |
| 37 virtual bool IsDummy() const { return false; } | |
|
qsr
2014/01/22 15:30:01
You might not nee a dummy provider in fact, and so
| |
| 38 | |
| 39 protected: | |
| 40 PowerDataProvider() { } | |
|
qsr
2014/01/22 15:30:01
I'm not sure you want to protect this. When writin
| |
| 41 | |
| 42 private: | |
| 43 friend class PowerDataProviderFactory; | |
| 44 DISALLOW_COPY_AND_ASSIGN(PowerDataProvider); | |
| 45 }; | |
| 46 | |
| 47 // A dummy data provider | |
| 48 class PowerDataProviderDummy : public PowerDataProvider { | |
| 49 public: | |
| 50 virtual ~PowerDataProviderDummy() { } | |
| 51 | |
| 52 virtual bool IsDummy() const OVERRIDE { return true; } | |
| 53 | |
| 54 virtual bool GetData(PowerEvent* data) OVERRIDE { | |
| 55 return false; | |
| 56 } | |
| 57 | |
| 58 protected: | |
| 59 PowerDataProviderDummy() { } | |
| 60 | |
| 61 private: | |
| 62 friend class PowerDataProviderFactory; | |
| 63 DISALLOW_COPY_AND_ASSIGN(PowerDataProviderDummy); | |
| 64 }; | |
| 65 | |
| 66 class PowerDataProviderFactory { | |
| 67 public: | |
| 68 static PowerDataProvider* Create(); | |
|
qsr
2014/01/22 15:30:01
You can return a scoped_ptr<PowerDataProvider> her
| |
| 69 | |
| 70 private: | |
| 71 PowerDataProviderFactory() { } | |
| 72 DISALLOW_COPY_AND_ASSIGN(PowerDataProviderFactory); | |
| 73 }; | |
| 74 | |
| 75 } // namespace content | |
| 76 | |
| 77 #endif // CONTENT_BROWSER_POWER_DATA_PROVIDER_H_ | |
| OLD | NEW |