OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "base/power_monitor/power_monitor.h" | 5 #include "base/power_monitor/power_monitor.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/power_monitor/power_monitor_source.h" | 9 #include "base/power_monitor/power_monitor_source.h" |
10 | 10 |
11 namespace base { | 11 namespace base { |
12 | 12 |
13 static PowerMonitor* g_power_monitor = NULL; | 13 static PowerMonitor* g_power_monitor = NULL; |
14 | 14 |
15 PowerMonitor::PowerMonitor(scoped_ptr<PowerMonitorSource> source) | 15 PowerMonitor::PowerMonitor(std::unique_ptr<PowerMonitorSource> source) |
16 : observers_(new ObserverListThreadSafe<PowerObserver>()), | 16 : observers_(new ObserverListThreadSafe<PowerObserver>()), |
17 source_(std::move(source)) { | 17 source_(std::move(source)) { |
18 DCHECK(!g_power_monitor); | 18 DCHECK(!g_power_monitor); |
19 g_power_monitor = this; | 19 g_power_monitor = this; |
20 } | 20 } |
21 | 21 |
22 PowerMonitor::~PowerMonitor() { | 22 PowerMonitor::~PowerMonitor() { |
23 DCHECK_EQ(this, g_power_monitor); | 23 DCHECK_EQ(this, g_power_monitor); |
24 g_power_monitor = NULL; | 24 g_power_monitor = NULL; |
25 } | 25 } |
(...skipping 30 matching lines...) Expand all Loading... |
56 DVLOG(1) << "Power Suspending"; | 56 DVLOG(1) << "Power Suspending"; |
57 observers_->Notify(FROM_HERE, &PowerObserver::OnSuspend); | 57 observers_->Notify(FROM_HERE, &PowerObserver::OnSuspend); |
58 } | 58 } |
59 | 59 |
60 void PowerMonitor::NotifyResume() { | 60 void PowerMonitor::NotifyResume() { |
61 DVLOG(1) << "Power Resuming"; | 61 DVLOG(1) << "Power Resuming"; |
62 observers_->Notify(FROM_HERE, &PowerObserver::OnResume); | 62 observers_->Notify(FROM_HERE, &PowerObserver::OnResume); |
63 } | 63 } |
64 | 64 |
65 } // namespace base | 65 } // namespace base |
OLD | NEW |