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

Side by Side Diff: components/power/origin_power_map.h

Issue 514433002: Clear power consumption auditing when you clear history. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_POWER_ORIGIN_POWER_MAP_H_ 5 #ifndef COMPONENTS_POWER_ORIGIN_POWER_MAP_H_
6 #define COMPONENTS_POWER_ORIGIN_POWER_MAP_H_ 6 #define COMPONENTS_POWER_ORIGIN_POWER_MAP_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/callback_list.h" 10 #include "base/callback_list.h"
(...skipping 25 matching lines...) Expand all
36 PercentOriginMap GetPercentOriginMap(); 36 PercentOriginMap GetPercentOriginMap();
37 37
38 // Adds a callback for the completion of a round of updates to |origin_map_|. 38 // Adds a callback for the completion of a round of updates to |origin_map_|.
39 scoped_ptr<Subscription> AddPowerConsumptionUpdatedCallback( 39 scoped_ptr<Subscription> AddPowerConsumptionUpdatedCallback(
40 const base::Closure& callback); 40 const base::Closure& callback);
41 41
42 // Notifies observers to let them know that the origin power map has finished 42 // Notifies observers to let them know that the origin power map has finished
43 // updating for all origins this cycle. 43 // updating for all origins this cycle.
44 void OnAllOriginsUpdated(); 44 void OnAllOriginsUpdated();
45 45
46 // Clears all URLs out of the map.
47 void ClearOriginMap();
48
46 private: 49 private:
47 // OriginMap maps a URL to the amount of power consumed by the URL using the 50 // OriginMap maps a URL to the amount of power consumed by the URL using the
48 // same units as |total_consumed_|. 51 // same units as |total_consumed_|.
49 typedef std::map<GURL, double> OriginMap; 52 typedef std::map<GURL, double> OriginMap;
50 OriginMap origin_map_; 53 OriginMap origin_map_;
51 54
52 // Total amount of power consumed using units determined by 55 // Total amount of power consumed using units determined by
53 // the power heuristics available to the platform. 56 // the power heuristics available to the platform.
54 double total_consumed_; 57 double total_consumed_;
55 58
56 base::CallbackList<void(void)> callback_list_; 59 base::CallbackList<void(void)> callback_list_;
57 60
58 DISALLOW_COPY_AND_ASSIGN(OriginPowerMap); 61 DISALLOW_COPY_AND_ASSIGN(OriginPowerMap);
59 }; 62 };
60 63
61 } // namespace power 64 } // namespace power
62 65
63 #endif // COMPONENTS_POWER_ORIGIN_POWER_MAP_H_ 66 #endif // COMPONENTS_POWER_ORIGIN_POWER_MAP_H_
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.cc ('k') | components/power/origin_power_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698