Chromium Code Reviews| Index: chrome/browser/chromeos/policy/remote_commands/device_command_reboot_job.cc |
| diff --git a/chrome/browser/chromeos/policy/remote_commands/device_command_reboot_job.cc b/chrome/browser/chromeos/policy/remote_commands/device_command_reboot_job.cc |
| index 44b74b66c81004eaedb24de8eb7497ba6f4802b7..7d3c5f48b85713b3673220d91a64bef5a475bc66 100644 |
| --- a/chrome/browser/chromeos/policy/remote_commands/device_command_reboot_job.cc |
| +++ b/chrome/browser/chromeos/policy/remote_commands/device_command_reboot_job.cc |
| @@ -53,6 +53,8 @@ bool DeviceCommandRebootJob::IsExpired(base::TimeTicks now) { |
| void DeviceCommandRebootJob::RunImpl( |
| const CallbackWithResult& succeeded_callback, |
| const CallbackWithResult& failed_callback) { |
| + LOG(WARNING) << "Running reboot command."; |
| + |
| // Determines the time delta between the command having been issued and the |
| // boot time of the system. |
| const base::TimeDelta uptime = base::SysInfo::Uptime(); |
| @@ -63,18 +65,24 @@ void DeviceCommandRebootJob::RunImpl( |
| // performed and we invoke it. |kMinimumUptimeInMinutes| defines a lower limit |
| // on the uptime to avoid uninterruptable reboot loops. |
| if (delta > base::TimeDelta()) { |
| + LOG(WARNING) << "Reboot command already has been executed."; |
|
Andrew T Wilson (Slow)
2016/05/04 14:43:22
Change this to something like: "Ignoring reboot co
Marton Hunyady
2016/05/09 13:48:15
Done.
|
| base::ThreadTaskRunnerHandle::Get()->PostTask( |
| FROM_HERE, base::Bind(succeeded_callback, nullptr)); |
| return; |
| } |
| const base::TimeDelta kZeroTimeDelta; |
| - reboot_timer_.Start( |
| - FROM_HERE, |
| + base::TimeDelta reboot_delay = |
| std::max(base::TimeDelta::FromMinutes(kMinimumUptimeInMinutes) - uptime, |
| - kZeroTimeDelta), |
| - base::Bind(&DeviceCommandRebootJob::Reboot, |
| - weak_ptr_factory_.GetWeakPtr())); |
| + kZeroTimeDelta); |
| + if (reboot_delay > kZeroTimeDelta) { |
| + LOG(WARNING) << "Rebooting in " << reboot_delay << "."; |
|
Andrew T Wilson (Slow)
2016/05/04 14:43:22
Add a unit here, e.g. "Rebooting in 1234 msecs."
Marton Hunyady
2016/05/09 13:48:15
reboot_delay is a base::TimeDelta, so it currently
|
| + } else { |
| + LOG(WARNING) << "Rebooting immediately."; |
| + } |
| + reboot_timer_.Start(FROM_HERE, reboot_delay, |
| + base::Bind(&DeviceCommandRebootJob::Reboot, |
| + weak_ptr_factory_.GetWeakPtr())); |
| } |
| void DeviceCommandRebootJob::TerminateImpl() { |