OLD | NEW |
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 CHROME_BROWSER_POWER_USAGE_MONITOR_POWER_USAGE_MONITOR_H_ | 5 #ifndef CHROME_BROWSER_POWER_USAGE_MONITOR_POWER_USAGE_MONITOR_H_ |
6 #define CHROME_BROWSER_POWER_USAGE_MONITOR_POWER_USAGE_MONITOR_H_ | 6 #define CHROME_BROWSER_POWER_USAGE_MONITOR_POWER_USAGE_MONITOR_H_ |
7 | 7 |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 double discharge_amount() const { | 55 double discharge_amount() const { |
56 return initial_battery_level_ - current_battery_level_; | 56 return initial_battery_level_ - current_battery_level_; |
57 } | 57 } |
58 | 58 |
59 // Start monitoring power usage. | 59 // Start monitoring power usage. |
60 // Note that the actual monitoring will be delayed until 30 minutes after | 60 // Note that the actual monitoring will be delayed until 30 minutes after |
61 // system boot. | 61 // system boot. |
62 void Start(); | 62 void Start(); |
63 | 63 |
64 void SetSystemInterfaceForTest(std::unique_ptr<SystemInterface> interface); | 64 void SetSystemInterfaceForTest( |
| 65 std::unique_ptr<SystemInterface> system_interface); |
65 | 66 |
66 // Overridden from base::PowerObserver: | 67 // Overridden from base::PowerObserver: |
67 void OnPowerStateChange(bool on_battery_power) override; | 68 void OnPowerStateChange(bool on_battery_power) override; |
68 void OnResume() override; | 69 void OnResume() override; |
69 void OnSuspend() override; | 70 void OnSuspend() override; |
70 | 71 |
71 // Overridden from NotificationObserver: | 72 // Overridden from NotificationObserver: |
72 void Observe(int type, | 73 void Observe(int type, |
73 const content::NotificationSource& source, | 74 const content::NotificationSource& source, |
74 const content::NotificationDetails& details) override; | 75 const content::NotificationDetails& details) override; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 base::Time start_discharge_time_; | 121 base::Time start_discharge_time_; |
121 | 122 |
122 // IDs of live renderer processes. | 123 // IDs of live renderer processes. |
123 base::hash_set<int> live_renderer_ids_; | 124 base::hash_set<int> live_renderer_ids_; |
124 | 125 |
125 private: | 126 private: |
126 DISALLOW_COPY_AND_ASSIGN(PowerUsageMonitor); | 127 DISALLOW_COPY_AND_ASSIGN(PowerUsageMonitor); |
127 }; | 128 }; |
128 | 129 |
129 #endif // CHROME_BROWSER_POWER_USAGE_MONITOR_POWER_USAGE_MONITOR_H_ | 130 #endif // CHROME_BROWSER_POWER_USAGE_MONITOR_POWER_USAGE_MONITOR_H_ |
OLD | NEW |