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

Side by Side Diff: base/power_monitor/power_monitor.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 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 | « base/power_monitor/power_monitor.h ('k') | base/power_monitor/power_monitor_unittest.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 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
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
OLDNEW
« no previous file with comments | « base/power_monitor/power_monitor.h ('k') | base/power_monitor/power_monitor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698