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

Side by Side 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 persistence. 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 CHROME_BROWSER_POWER_ORIGIN_POWER_MAP_H_
6 #define CHROME_BROWSER_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 class PrefService;
14
15 namespace base {
16 class DictionaryValue;
17 }
18
19 namespace user_prefs {
20 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.
21 }
22
23 // Tracks app and website origins and how much power they are consuming while
24 // running.
25 class OriginPowerMap : public KeyedService {
26 public:
27 typedef std::map<GURL, int> PercentOriginMap;
28
29 explicit OriginPowerMap();
sky 2014/08/08 19:12:25 remove explicit
Daniel Nishi 2014/08/08 19:41:05 Done.
30 virtual ~OriginPowerMap();
31
32 // Returns the integer percentage usage of the total power consumed by a
33 // given origin.
34 int GetPowerForOrigin(const GURL& origin);
35
36 // Add a certain amount of power consumption to a given origin.
37 // |power| is a platform-specific heuristic estimating power consumption.
38 void AddPowerForOrigin(const GURL& origin, double power);
39
40 // Return a map of all origins to the integer percentage usage of power
41 // consumed.
42 scoped_ptr<const PercentOriginMap> GetPercentOriginMap();
43
44 private:
45 typedef std::map<GURL, double> OriginMap;
46 OriginMap origin_map_;
47
48 // The total amount of power consumed since the last wipe.
49 double total_consumed_;
50
51 DISALLOW_COPY_AND_ASSIGN(OriginPowerMap);
52 };
53
54 #endif // CHROME_BROWSER_POWER_ORIGIN_POWER_MAP_H_
OLDNEW
« 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