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

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

Issue 2594833002: Allow PowerMonitorDeviceSource to be used from sequenced tasks. (Closed)
Patch Set: Created 4 years 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_device_source.h ('k') | no next file » | 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_device_source.h" 5 #include "base/power_monitor/power_monitor_device_source.h"
6 6
7 #include "base/threading/thread_task_runner_handle.h"
8
9 namespace base { 7 namespace base {
10 8
11 PowerMonitorDeviceSource::PowerMonitorDeviceSource() { 9 PowerMonitorDeviceSource::PowerMonitorDeviceSource() {
12 DCHECK(ThreadTaskRunnerHandle::IsSet());
13
14 #if defined(OS_MACOSX) 10 #if defined(OS_MACOSX)
15 PlatformInit(); 11 PlatformInit();
16 #endif 12 #endif
17 13
18 #if defined(OS_WIN) || defined(OS_MACOSX) 14 #if defined(OS_WIN) || defined(OS_MACOSX)
19 // Provide the correct battery status if possible. Others platforms, such as 15 // Provide the correct battery status if possible. Others platforms, such as
20 // Android and ChromeOS, will update their status once their backends are 16 // Android and ChromeOS, will update their status once their backends are
21 // actually initialized. 17 // actually initialized.
22 SetInitialOnBatteryPowerState(IsOnBatteryPowerImpl()); 18 SetInitialOnBatteryPowerState(IsOnBatteryPowerImpl());
23 #endif 19 #endif
24 } 20 }
25 21
26 PowerMonitorDeviceSource::~PowerMonitorDeviceSource() { 22 PowerMonitorDeviceSource::~PowerMonitorDeviceSource() {
27 #if defined(OS_MACOSX) 23 #if defined(OS_MACOSX)
28 PlatformDestroy(); 24 PlatformDestroy();
29 #endif 25 #endif
30 } 26 }
31 27
32 } // namespace base 28 } // namespace base
OLDNEW
« no previous file with comments | « base/power_monitor/power_monitor_device_source.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698