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

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: 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 // Tracks app and website origins and how much power they are consuming while
14 // running.
15 class OriginPowerMap : public KeyedService {
16 public:
17 typedef std::map<GURL, int> PercentOriginMap;
18
19 OriginPowerMap();
20 virtual ~OriginPowerMap();
21
22 // Returns the integer percentage usage of the total power consumed by a
23 // given URL's origin.
24 int GetPowerForOrigin(const GURL& url);
25
26 // Add a certain amount of power consumption to a given URL's origin.
27 // |power| is a platform-specific heuristic estimating power consumption.
28 void AddPowerForOrigin(const GURL& url, double power);
29
30 // Return a map of all origins to the integer percentage usage of power
31 // consumed.
32 scoped_ptr<PercentOriginMap> GetPercentOriginMap();
33
34 private:
35 typedef std::map<GURL, double> OriginMap;
36 OriginMap origin_map_;
37
38 // The total amount of power consumed since the last wipe.
39 double total_consumed_;
40
41 DISALLOW_COPY_AND_ASSIGN(OriginPowerMap);
42 };
43
44 #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