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_PUBLIC_BROWSER_POWER_DATA_PROVIDER_H_ | |
| 6 #define CONTENT_PUBLIC_BROWSER_POWER_DATA_PROVIDER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/time/time.h" | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 struct PowerEvent { | |
| 15 enum Type { | |
|
qsr
2014/01/27 10:01:47
You should remove Type. Right now you have a singl
Pan
2014/01/28 09:58:04
Yes, it is a little weird to have only one type in
| |
| 16 // Total power of SoC. including CPU, GT and others on the chip. | |
| 17 SOC_PACKAGE, | |
| 18 | |
| 19 // Count the number of known PowerEvent. | |
| 20 ID_COUNT | |
| 21 }; | |
| 22 | |
| 23 Type type; | |
| 24 base::TimeTicks time; // Time that power data was read. | |
| 25 | |
| 26 // Power value between last event to this one, in watt, | |
|
qsr
2014/01/27 10:01:47
What does Power value mean? Power consumption migh
Pan
2014/01/28 09:58:04
For SOC_PACKAGE power, it means power consumed in
| |
| 27 // so value of the first event that observer received should be ignored. | |
| 28 double value; | |
| 29 }; | |
| 30 | |
| 31 // a class used to GET power usage. | |
| 32 class PowerDataProvider { | |
| 33 public: | |
| 34 PowerDataProvider() { } | |
|
qsr
2014/01/27 10:01:47
No spaces inside {}, here and everywhere on this C
Pan
2014/01/28 13:32:58
Done.
| |
| 35 virtual ~PowerDataProvider() { } | |
| 36 | |
| 37 // Return true when success, it fills a single PowerEvent, which should be | |
| 38 // allocated by its caller. | |
| 39 virtual bool GetData(PowerEvent*) = 0; | |
| 40 | |
| 41 private: | |
| 42 DISALLOW_COPY_AND_ASSIGN(PowerDataProvider); | |
| 43 }; | |
| 44 | |
| 45 class PowerDataProviderFactory { | |
| 46 public: | |
| 47 // Create a provider, and transfer the ownership to PowerProfilerService. | |
| 48 static scoped_ptr<PowerDataProvider> Create(); | |
| 49 | |
| 50 private: | |
| 51 PowerDataProviderFactory() { } | |
| 52 DISALLOW_COPY_AND_ASSIGN(PowerDataProviderFactory); | |
| 53 }; | |
| 54 | |
| 55 } // namespace content | |
| 56 | |
| 57 #endif // CONTENT_PUBLIC_BROWSER_POWER_DATA_PROVIDER_H_ | |
| OLD | NEW |