Index: chrome/browser/power/origin_power_map.h |
diff --git a/chrome/browser/power/origin_power_map.h b/chrome/browser/power/origin_power_map.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d97008cbd927a45ed91c2eb703f6962ee3da3cd9 |
--- /dev/null |
+++ b/chrome/browser/power/origin_power_map.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 CHROME_BROWSER_POWER_ORIGIN_POWER_MAP_H_ |
+#define CHROME_BROWSER_POWER_ORIGIN_POWER_MAP_H_ |
+ |
+#include <map> |
+ |
+#include "components/keyed_service/core/keyed_service.h" |
+#include "url/gurl.h" |
+ |
+class PrefService; |
+ |
+namespace base { |
+class DictionaryValue; |
+} |
+ |
+namespace user_prefs { |
+class PrefRegistrySyncable; |
sky
2014/08/08 19:12:25
Remove all the forward declarations that are no lo
Daniel Nishi
2014/08/08 19:41:05
Done.
|
+} |
+ |
+// Tracks app and website origins and how much power they are consuming while |
+// running. |
+class OriginPowerMap : public KeyedService { |
+ public: |
+ typedef std::map<GURL, int> PercentOriginMap; |
+ |
+ explicit OriginPowerMap(); |
sky
2014/08/08 19:12:25
remove explicit
Daniel Nishi
2014/08/08 19:41:05
Done.
|
+ virtual ~OriginPowerMap(); |
+ |
+ // Returns the integer percentage usage of the total power consumed by a |
+ // given origin. |
+ int GetPowerForOrigin(const GURL& origin); |
+ |
+ // Add a certain amount of power consumption to a given origin. |
+ // |power| is a platform-specific heuristic estimating power consumption. |
+ void AddPowerForOrigin(const GURL& origin, double power); |
+ |
+ // Return a map of all origins to the integer percentage usage of power |
+ // consumed. |
+ scoped_ptr<const PercentOriginMap> GetPercentOriginMap(); |
+ |
+ private: |
+ typedef std::map<GURL, double> OriginMap; |
+ OriginMap origin_map_; |
+ |
+ // The total amount of power consumed since the last wipe. |
+ double total_consumed_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(OriginPowerMap); |
+}; |
+ |
+#endif // CHROME_BROWSER_POWER_ORIGIN_POWER_MAP_H_ |