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

Side by Side Diff: content/browser/power_usage_monitor_impl.h

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « content/browser/power_save_blocker_x11.cc ('k') | content/browser/power_usage_monitor_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CONTENT_BROWSER_POWER_USAGE_MONITOR_IMPL_H_ 5 #ifndef CONTENT_BROWSER_POWER_USAGE_MONITOR_IMPL_H_
6 #define CONTENT_BROWSER_POWER_USAGE_MONITOR_IMPL_H_ 6 #define CONTENT_BROWSER_POWER_USAGE_MONITOR_IMPL_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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 double discharge_amount() const { 57 double discharge_amount() const {
58 return initial_battery_level_ - current_battery_level_; 58 return initial_battery_level_ - current_battery_level_;
59 } 59 }
60 60
61 // Start monitoring power usage. 61 // Start monitoring power usage.
62 // Note that the actual monitoring will be delayed until 30 minutes after 62 // Note that the actual monitoring will be delayed until 30 minutes after
63 // system boot. 63 // system boot.
64 void Start(); 64 void Start();
65 65
66 void SetSystemInterfaceForTest(scoped_ptr<SystemInterface> interface); 66 void SetSystemInterfaceForTest(std::unique_ptr<SystemInterface> interface);
67 67
68 // Overridden from base::PowerObserver: 68 // Overridden from base::PowerObserver:
69 void OnPowerStateChange(bool on_battery_power) override; 69 void OnPowerStateChange(bool on_battery_power) override;
70 void OnResume() override; 70 void OnResume() override;
71 void OnSuspend() override; 71 void OnSuspend() override;
72 72
73 // Overridden from NotificationObserver: 73 // Overridden from NotificationObserver:
74 void Observe(int type, 74 void Observe(int type,
75 const NotificationSource& source, 75 const NotificationSource& source,
76 const NotificationDetails& details) override; 76 const NotificationDetails& details) override;
77 77
78 private: 78 private:
79 friend class PowerUsageMonitorTest; 79 friend class PowerUsageMonitorTest;
80 FRIEND_TEST_ALL_PREFIXES(PowerUsageMonitorTest, OnBatteryStatusUpdate); 80 FRIEND_TEST_ALL_PREFIXES(PowerUsageMonitorTest, OnBatteryStatusUpdate);
81 FRIEND_TEST_ALL_PREFIXES(PowerUsageMonitorTest, OnRenderProcessNotification); 81 FRIEND_TEST_ALL_PREFIXES(PowerUsageMonitorTest, OnRenderProcessNotification);
82 82
83 // Start monitoring system power usage. 83 // Start monitoring system power usage.
84 // This function may be called after a delay, see Start() for details. 84 // This function may be called after a delay, see Start() for details.
85 void StartInternal(); 85 void StartInternal();
86 86
87 void OnBatteryStatusUpdate(const device::BatteryStatus& status); 87 void OnBatteryStatusUpdate(const device::BatteryStatus& status);
88 void OnRenderProcessNotification(int type, int rph_id); 88 void OnRenderProcessNotification(int type, int rph_id);
89 89
90 void DischargeStarted(double battery_level); 90 void DischargeStarted(double battery_level);
91 void WallPowerConnected(double battery_level); 91 void WallPowerConnected(double battery_level);
92 92
93 void CancelPendingHistogramReporting(); 93 void CancelPendingHistogramReporting();
94 94
95 device::BatteryStatusService::BatteryUpdateCallback callback_; 95 device::BatteryStatusService::BatteryUpdateCallback callback_;
96 scoped_ptr<device::BatteryStatusService::BatteryUpdateSubscription> 96 std::unique_ptr<device::BatteryStatusService::BatteryUpdateSubscription>
97 subscription_; 97 subscription_;
98 98
99 NotificationRegistrar registrar_; 99 NotificationRegistrar registrar_;
100 100
101 scoped_ptr<SystemInterface> system_interface_; 101 std::unique_ptr<SystemInterface> system_interface_;
102 102
103 // True if monitoring was started (Start() called). 103 // True if monitoring was started (Start() called).
104 bool started_; 104 bool started_;
105 105
106 // True if collecting metrics for the current discharge cycle e.g. if no 106 // True if collecting metrics for the current discharge cycle e.g. if no
107 // renderers are open we don't keep track of discharge. 107 // renderers are open we don't keep track of discharge.
108 bool tracking_discharge_; 108 bool tracking_discharge_;
109 109
110 // True if the system is running on battery power, false if on wall power. 110 // True if the system is running on battery power, false if on wall power.
111 bool on_battery_power_; 111 bool on_battery_power_;
(...skipping 12 matching lines...) Expand all
124 // IDs of live renderer processes. 124 // IDs of live renderer processes.
125 base::hash_set<int> live_renderer_ids_; 125 base::hash_set<int> live_renderer_ids_;
126 126
127 private: 127 private:
128 DISALLOW_COPY_AND_ASSIGN(PowerUsageMonitor); 128 DISALLOW_COPY_AND_ASSIGN(PowerUsageMonitor);
129 }; 129 };
130 130
131 } // namespace content 131 } // namespace content
132 132
133 #endif // CONTENT_BROWSER_POWER_USAGE_MONITOR_IMPL_H_ 133 #endif // CONTENT_BROWSER_POWER_USAGE_MONITOR_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/power_save_blocker_x11.cc ('k') | content/browser/power_usage_monitor_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698