Index: chrome/browser/chromeos/policy/status_uploader.cc |
diff --git a/chrome/browser/chromeos/policy/status_uploader.cc b/chrome/browser/chromeos/policy/status_uploader.cc |
index 0c42579c80b2a9cfca3f18b12147f6e9412bf4cc..b27faf4d4bcdd6ddbe562a9b5e48af82d87d3ede 100644 |
--- a/chrome/browser/chromeos/policy/status_uploader.cc |
+++ b/chrome/browser/chromeos/policy/status_uploader.cc |
@@ -84,12 +84,15 @@ StatusUploader::~StatusUploader() { |
MediaCaptureDevicesDispatcher::GetInstance()->RemoveObserver(this); |
} |
-void StatusUploader::ScheduleNextStatusUpload() { |
+void StatusUploader::ScheduleNextStatusUpload(bool immediately) { |
// Calculate when to fire off the next update (if it should have already |
// happened, this yields a TimeDelta of kMinUploadScheduleDelayMs). |
base::TimeDelta delay = std::max( |
(last_upload_ + upload_frequency_) - base::Time::NowFromSystemTime(), |
base::TimeDelta::FromMilliseconds(kMinUploadScheduleDelayMs)); |
+ // If we want an immediate status upload, set delay to 0. |
+ if (immediately) |
+ delay = base::TimeDelta(); |
upload_callback_.Reset(base::Bind(&StatusUploader::UploadStatus, |
Andrew T Wilson (Slow)
2017/03/20 16:33:10
My main concern here is that we could have a statu
Ivan Šandrk
2017/03/20 17:48:53
I think it should actually be safe, but I haven't
|
base::Unretained(this))); |
task_runner_->PostDelayedTask(FROM_HERE, upload_callback_.callback(), delay); |
@@ -172,6 +175,10 @@ void StatusUploader::OnRequestUpdate(int render_process_id, |
} |
} |
+void StatusUploader::ScheduleNextStatusUploadImmediately() { |
+ ScheduleNextStatusUpload(true); |
+} |
+ |
void StatusUploader::UploadStatus() { |
// Gather status in the background. |
collector_->GetDeviceAndSessionStatusAsync(base::Bind( |