Index: content/public/browser/power_data_provider.h |
diff --git a/content/public/browser/power_data_provider.h b/content/public/browser/power_data_provider.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..76cb6f6f0533beb3d8581b033eb47b643145f6b5 |
--- /dev/null |
+++ b/content/public/browser/power_data_provider.h |
@@ -0,0 +1,57 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_PUBLIC_BROWSER_POWER_DATA_PROVIDER_H_ |
+#define CONTENT_PUBLIC_BROWSER_POWER_DATA_PROVIDER_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/time/time.h" |
+ |
+namespace content { |
+ |
+struct PowerEvent { |
+ 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
|
+ // Total power of SoC. including CPU, GT and others on the chip. |
+ SOC_PACKAGE, |
+ |
+ // Count the number of known PowerEvent. |
+ ID_COUNT |
+ }; |
+ |
+ Type type; |
+ base::TimeTicks time; // Time that power data was read. |
+ |
+ // 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
|
+ // so value of the first event that observer received should be ignored. |
+ double value; |
+}; |
+ |
+// a class used to GET power usage. |
+class PowerDataProvider { |
+ public: |
+ 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.
|
+ virtual ~PowerDataProvider() { } |
+ |
+ // Return true when success, it fills a single PowerEvent, which should be |
+ // allocated by its caller. |
+ virtual bool GetData(PowerEvent*) = 0; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(PowerDataProvider); |
+}; |
+ |
+class PowerDataProviderFactory { |
+ public: |
+ // Create a provider, and transfer the ownership to PowerProfilerService. |
+ static scoped_ptr<PowerDataProvider> Create(); |
+ |
+ private: |
+ PowerDataProviderFactory() { } |
+ DISALLOW_COPY_AND_ASSIGN(PowerDataProviderFactory); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_PUBLIC_BROWSER_POWER_DATA_PROVIDER_H_ |