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

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: Remove a line from GYPI that shouldn't have been in this patch. 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..b6448fd7f4e162b7f91447a44b08df77b5f82f42
--- /dev/null
+++ b/chrome/browser/power/origin_power_map.h
@@ -0,0 +1,58 @@
+// 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 "base/memory/ref_counted.h"
sky 2014/08/06 23:59:23 Do you really need the ref_counted include?
Daniel Nishi 2014/08/07 21:15:08 Unnecessary include removed.
+#include "components/keyed_service/core/keyed_service.h"
+#include "url/gurl.h"
+
+class PrefService;
+
+namespace base {
+class DictionaryValue;
+}
+
+namespace user_prefs {
+class PrefRegistrySyncable;
+}
+
+// Tracks app and website origins and how much power they are consuming while
+// running.
+class OriginPowerMap : public KeyedService {
+ public:
+ explicit OriginPowerMap(PrefService* prefs);
+ virtual ~OriginPowerMap();
+
+ typedef std::map<GURL, int> ScaledOriginMap;
sky 2014/08/06 23:59:23 typedefs should be first in a section (see style g
sky 2014/08/06 23:59:23 Why is this named Scaled? Percent would be more me
Daniel Nishi 2014/08/07 21:15:08 I was thinking that since it was scaled to 100 as
Daniel Nishi 2014/08/07 21:15:08 Typedefs moved up.
+
+ // 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.
+ void AddPowerForOrigin(const GURL& origin, double power);
sky 2014/08/06 23:59:23 Document what |power| means here. It's worth a des
Daniel Nishi 2014/08/07 21:15:08 Since the definition of |power| is platform specif
+
+ // Return a map of all origins to the integer percentage usage of power
+ // consumed.
+ scoped_ptr<ScaledOriginMap> GetScaledOriginMap();
sky 2014/08/06 23:59:23 nit: const
Daniel Nishi 2014/08/07 21:15:08 Done.
+ void SavePrefs();
+
+ // Register per-profile preferences for the power consumed by origin.
+ static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
+
+ private:
+ typedef std::map<GURL, double> OriginMap;
+ OriginMap origin_map_;
+
+ // The total amount of power consumed since the last wipe.
+ double total_consumed_;
+
+ PrefService* prefs_;
+};
sky 2014/08/06 23:59:23 DISALLOW_...
Daniel Nishi 2014/08/07 21:15:08 Done.
+
+#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