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

Unified Diff: chrome/browser/power/origin_power_map.h

Issue 447053002: Add Origin Power Map to Store Battery Auditing Data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/power/origin_power_map.cc » ('j') | chrome/browser/power/origin_power_map.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..91b9bc804662eb00f6b4f2db5f8cbd0b9313d9d8
--- /dev/null
+++ b/chrome/browser/power/origin_power_map.h
@@ -0,0 +1,44 @@
+// 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"
+
+// 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;
+
+ OriginPowerMap();
+ virtual ~OriginPowerMap();
+
+ // Returns the integer percentage usage of the total power consumed by a
+ // given URL's origin.
+ int GetPowerForOrigin(const GURL& url);
+
+ // Add a certain amount of power consumption to a given URL's origin.
+ // |power| is a platform-specific heuristic estimating power consumption.
+ void AddPowerForOrigin(const GURL& url, double power);
+
+ // Return a map of all origins to the integer percentage usage of power
+ // consumed.
+ scoped_ptr<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_
« no previous file with comments | « no previous file | chrome/browser/power/origin_power_map.cc » ('j') | chrome/browser/power/origin_power_map.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698