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

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

Issue 2136563002: Remove calls to MessageLoop::current() in base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: restore dns_config_service_posix_unittest.cc Created 4 years, 5 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
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"
7 #include "base/time/time.h" 8 #include "base/time/time.h"
8 #include "build/build_config.h" 9 #include "build/build_config.h"
9 10
10 namespace base { 11 namespace base {
11 12
12 #if defined(ENABLE_BATTERY_MONITORING) 13 #if defined(ENABLE_BATTERY_MONITORING)
13 // The amount of time (in ms) to wait before running the initial 14 // The amount of time (in ms) to wait before running the initial
14 // battery check. 15 // battery check.
15 static int kDelayedBatteryCheckMs = 10 * 1000; 16 static int kDelayedBatteryCheckMs = 10 * 1000;
16 #endif // defined(ENABLE_BATTERY_MONITORING) 17 #endif // defined(ENABLE_BATTERY_MONITORING)
17 18
18 PowerMonitorDeviceSource::PowerMonitorDeviceSource() { 19 PowerMonitorDeviceSource::PowerMonitorDeviceSource() {
19 DCHECK(MessageLoop::current()); 20 DCHECK(ThreadTaskRunnerHandle::IsSet());
20 #if defined(ENABLE_BATTERY_MONITORING) 21 #if defined(ENABLE_BATTERY_MONITORING)
21 delayed_battery_check_.Start(FROM_HERE, 22 delayed_battery_check_.Start(FROM_HERE,
22 base::TimeDelta::FromMilliseconds(kDelayedBatteryCheckMs), this, 23 base::TimeDelta::FromMilliseconds(kDelayedBatteryCheckMs), this,
23 &PowerMonitorDeviceSource::BatteryCheck); 24 &PowerMonitorDeviceSource::BatteryCheck);
24 #endif // defined(ENABLE_BATTERY_MONITORING) 25 #endif // defined(ENABLE_BATTERY_MONITORING)
25 #if defined(OS_MACOSX) 26 #if defined(OS_MACOSX)
26 PlatformInit(); 27 PlatformInit();
27 #endif 28 #endif
28 } 29 }
29 30
30 PowerMonitorDeviceSource::~PowerMonitorDeviceSource() { 31 PowerMonitorDeviceSource::~PowerMonitorDeviceSource() {
31 #if defined(OS_MACOSX) 32 #if defined(OS_MACOSX)
32 PlatformDestroy(); 33 PlatformDestroy();
33 #endif 34 #endif
34 } 35 }
35 36
36 void PowerMonitorDeviceSource::BatteryCheck() { 37 void PowerMonitorDeviceSource::BatteryCheck() {
37 ProcessPowerEvent(PowerMonitorSource::POWER_STATE_EVENT); 38 ProcessPowerEvent(PowerMonitorSource::POWER_STATE_EVENT);
38 } 39 }
39 40
40 } // namespace base 41 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698