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

Unified Diff: chrome/browser/chromeos/policy/remote_commands/device_command_reboot_job.cc

Issue 1923943003: Add logging to remote commands (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Syslog logging in upload_job_impl Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
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 e31443d1607d3f953ae2405d7b86cc5c0500d03b..3084afae754bb57829bd9f5646cbd23e13108fd6 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
@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/bind.h"
+#include "base/chromeos/logging.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/single_thread_task_runner.h"
@@ -53,6 +54,8 @@ bool DeviceCommandRebootJob::IsExpired(base::TimeTicks now) {
void DeviceCommandRebootJob::RunImpl(
const CallbackWithResult& succeeded_callback,
const CallbackWithResult& failed_callback) {
+ CHROMEOS_SYSLOG(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 +66,25 @@ 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()) {
+ CHROMEOS_SYSLOG(WARNING) << "Ignoring reboot command issued " << delta
+ << " before current boot time";
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) {
+ 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() {
« no previous file with comments | « base/chromeos/logging.h ('k') | chrome/browser/chromeos/policy/remote_commands/device_command_screenshot_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698