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

Side by Side Diff: components/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: Address comments. 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_POWER_ORIGIN_POWER_MAP_H_
6 #define COMPONENTS_POWER_ORIGIN_POWER_MAP_H_
7
8 #include <map>
9
10 #include "components/keyed_service/core/keyed_service.h"
11 #include "url/gurl.h"
12
13 namespace power {
14
15 // Tracks app and website origins and how much power they are consuming while
16 // running.
17 class OriginPowerMap : public KeyedService {
18 public:
19 typedef std::map<GURL, int> PercentOriginMap;
20
21 OriginPowerMap();
22 virtual ~OriginPowerMap();
23
24 // Returns the integer percentage usage of the total power consumed by a
25 // given URL's origin.
26 int GetPowerForOrigin(const GURL& url);
27
28 // Adds a certain amount of power consumption to a given URL's origin.
29 // |power| is a platform-specific heuristic estimating power consumption.
30 void AddPowerForOrigin(const GURL& url, double power);
31
32 // Returns a map of all origins to the integer percentage usage of power
33 // consumed.
34 PercentOriginMap GetPercentOriginMap();
35
36 private:
37 // OriginMap maps a URL to the platform specific metric of power consumed.
Daniel Erat 2014/08/12 18:40:18 could you be more specific about how these values
Daniel Nishi 2014/08/12 19:57:34 I've upped the comments.
38 typedef std::map<GURL, double> OriginMap;
39 OriginMap origin_map_;
40
41 // The total amount of power consumed since the last wipe.
42 double total_consumed_;
43
44 DISALLOW_COPY_AND_ASSIGN(OriginPowerMap);
45 };
46
47 } // namespace power
48
49 #endif // COMPONENTS_POWER_ORIGIN_POWER_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698