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

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

Issue 106223002: chrome power profiler chrome side changes (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..c362ebc2c7da80cb9b30d3eeb2325ac42c17df70
--- /dev/null
+++ b/content/public/browser/power_data_provider.h
@@ -0,0 +1,77 @@
+// 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_BROWSER_POWER_DATA_PROVIDER_H_
+#define CONTENT_BROWSER_POWER_DATA_PROVIDER_H_
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "base/time/time.h"
+
+namespace content {
+
+// 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
+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;
+ double value; // power
+};
+
+// A class used to GET power usage
qsr 2014/01/22 15:30:01 No need for uppercase.
+class PowerDataProvider {
+ public:
+ virtual ~PowerDataProvider() { }
+
+ // Return true when success
qsr 2014/01/22 15:30:01 Can you be more precise and what this method those
+ virtual bool GetData(PowerEvent*) = 0;
+
+ virtual bool IsDummy() const { return false; }
qsr 2014/01/22 15:30:01 You might not nee a dummy provider in fact, and so
+
+ protected:
+ PowerDataProvider() { }
qsr 2014/01/22 15:30:01 I'm not sure you want to protect this. When writin
+
+ private:
+ friend class PowerDataProviderFactory;
+ DISALLOW_COPY_AND_ASSIGN(PowerDataProvider);
+};
+
+// A dummy data provider
+class PowerDataProviderDummy : public PowerDataProvider {
+ public:
+ virtual ~PowerDataProviderDummy() { }
+
+ virtual bool IsDummy() const OVERRIDE { return true; }
+
+ virtual bool GetData(PowerEvent* data) OVERRIDE {
+ return false;
+ }
+
+ protected:
+ PowerDataProviderDummy() { }
+
+ private:
+ friend class PowerDataProviderFactory;
+ DISALLOW_COPY_AND_ASSIGN(PowerDataProviderDummy);
+};
+
+class PowerDataProviderFactory {
+ public:
+ static PowerDataProvider* Create();
qsr 2014/01/22 15:30:01 You can return a scoped_ptr<PowerDataProvider> her
+
+ private:
+ PowerDataProviderFactory() { }
+ DISALLOW_COPY_AND_ASSIGN(PowerDataProviderFactory);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_POWER_DATA_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698