Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Unified Diff: content/public/browser/power_data_provider.h

Issue 140583003: Chrome power profiler service (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..fd271954f1c6b128a5ead00f68d164382fdd9f78
--- /dev/null
+++ b/content/public/browser/power_data_provider.h
@@ -0,0 +1,54 @@
+// 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 {
+ // 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;
qsr 2014/01/23 12:50:06 Comment on those 2 values, especially the |value|
Pan 2014/01/25 09:35:53 Done.
+ double value;
+};
+
+// a class used to GET power usage.
+class PowerDataProvider {
+ public:
+ PowerDataProvider() { }
+ 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 ownship to PowerProfilerService.
+ static scoped_ptr<PowerDataProvider> Create();
+
+ private:
+ PowerDataProviderFactory() { }
+ DISALLOW_COPY_AND_ASSIGN(PowerDataProviderFactory);
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_POWER_DATA_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698