| 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 3084afae754bb57829bd9f5646cbd23e13108fd6..04e3994651e750b7479b608f93e1f9305b76f6ed 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
|
| @@ -25,16 +25,11 @@ namespace {
|
| // queue will consider this command expired if the command has not been started.
|
| const int kCommandExpirationTimeInMinutes = 10;
|
|
|
| -// Determines the minimum uptime after which a reboot might be scheduled. Note:
|
| -// |kCommandExpirationTimeInMinutes| >= |kMinimumUptimeInMinutes| as
|
| -// otherwise, a valid command issued right after boot may time out.
|
| -const int kMinimumUptimeInMinutes = 10;
|
| -
|
| } // namespace
|
|
|
| DeviceCommandRebootJob::DeviceCommandRebootJob(
|
| chromeos::PowerManagerClient* power_manager_client)
|
| - : power_manager_client_(power_manager_client), weak_ptr_factory_(this) {
|
| + : power_manager_client_(power_manager_client) {
|
| CHECK(power_manager_client_);
|
| }
|
|
|
| @@ -63,8 +58,7 @@ void DeviceCommandRebootJob::RunImpl(
|
| const base::TimeDelta delta = boot_time - issued_time();
|
| // If the reboot command was issued before the system booted, we inform the
|
| // server that the reboot succeeded. Otherwise, the reboot must still be
|
| - // performed and we invoke it. |kMinimumUptimeInMinutes| defines a lower limit
|
| - // on the uptime to avoid uninterruptable reboot loops.
|
| + // performed and we invoke it.
|
| if (delta > base::TimeDelta()) {
|
| CHROMEOS_SYSLOG(WARNING) << "Ignoring reboot command issued " << delta
|
| << " before current boot time";
|
| @@ -73,30 +67,12 @@ void DeviceCommandRebootJob::RunImpl(
|
| return;
|
| }
|
|
|
| - const base::TimeDelta kZeroTimeDelta;
|
| - base::TimeDelta reboot_delay =
|
| - std::max(base::TimeDelta::FromMinutes(kMinimumUptimeInMinutes) - uptime,
|
| - kZeroTimeDelta);
|
| - if (reboot_delay > kZeroTimeDelta) {
|
| - CHROMEOS_SYSLOG(WARNING) << "Rebooting in " << reboot_delay << ".";
|
| - } else {
|
| - CHROMEOS_SYSLOG(WARNING) << "Rebooting immediately.";
|
| - }
|
| - reboot_timer_.Start(FROM_HERE, reboot_delay,
|
| - base::Bind(&DeviceCommandRebootJob::Reboot,
|
| - weak_ptr_factory_.GetWeakPtr()));
|
| -}
|
| -
|
| -void DeviceCommandRebootJob::TerminateImpl() {
|
| - weak_ptr_factory_.InvalidateWeakPtrs();
|
| + CHROMEOS_SYSLOG(WARNING) << "Rebooting immediately.";
|
| + power_manager_client_->RequestRestart();
|
| }
|
|
|
| base::TimeDelta DeviceCommandRebootJob::GetCommmandTimeout() const {
|
| - return base::TimeDelta::FromMinutes(kMinimumUptimeInMinutes);
|
| -}
|
| -
|
| -void DeviceCommandRebootJob::Reboot() const {
|
| - power_manager_client_->RequestRestart();
|
| + return base::TimeDelta::FromMinutes(kCommandExpirationTimeInMinutes);
|
| }
|
|
|
| } // namespace policy
|
|
|