Chromium Code Reviews| Index: components/power/origin_power_map.h |
| diff --git a/components/power/origin_power_map.h b/components/power/origin_power_map.h |
| index 0936be46d8af98264316927e9e404a7bba9da170..b043d3869a0185b4aae3627dcb551eef59323788 100644 |
| --- a/components/power/origin_power_map.h |
| +++ b/components/power/origin_power_map.h |
| @@ -7,6 +7,7 @@ |
| #include <map> |
| +#include "base/callback_list.h" |
| #include "components/keyed_service/core/keyed_service.h" |
| #include "url/gurl.h" |
| @@ -17,6 +18,7 @@ namespace power { |
| class OriginPowerMap : public KeyedService { |
| public: |
| typedef std::map<GURL, int> PercentOriginMap; |
| + typedef base::CallbackList<void(void)>::Subscription Subscription; |
| OriginPowerMap(); |
| virtual ~OriginPowerMap(); |
| @@ -33,6 +35,15 @@ class OriginPowerMap : public KeyedService { |
| // consumed. |
| PercentOriginMap GetPercentOriginMap(); |
| + // Adds a callback for when the power consumption for the map finishes |
|
Daniel Erat
2014/09/02 17:14:39
nit: maybe something like "Adds a callback for the
Daniel Nishi
2014/09/02 17:32:48
Done.
|
| + // updating. |
| + scoped_ptr<Subscription> AddPowerConsumptionUpdatedCallback( |
| + const base::Closure& callback); |
| + |
| + // Notifies observers to let them know that the origin power map has finished |
| + // updating for all origins this cycle. |
| + void OnAllOriginsUpdated(); |
| + |
| private: |
| // OriginMap maps a URL to the amount of power consumed by the URL using the |
| // same units as |total_consumed_|. |
| @@ -43,6 +54,8 @@ class OriginPowerMap : public KeyedService { |
| // the power heuristics available to the platform. |
| double total_consumed_; |
| + base::CallbackList<void(void)> callback_list_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(OriginPowerMap); |
| }; |