Commit eecf5735 authored by Sorin Jianu's avatar Sorin Jianu Committed by Commit Bot

Invoke the callback when the update check is skipped.

Bug: 1113862
Change-Id: I0ec30cbaeab8ace6de40661548e239860672e2bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2341391Reviewed-by: default avatarS. Ganesh <ganesh@chromium.org>
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795651}
parent af4f12ef
...@@ -29,28 +29,33 @@ void ControlServiceInProcess::Run(base::OnceClosure callback) { ...@@ -29,28 +29,33 @@ void ControlServiceInProcess::Run(base::OnceClosure callback) {
const base::TimeDelta timeSinceUpdate = const base::TimeDelta timeSinceUpdate =
base::Time::NowFromSystemTime() - lastUpdateTime; base::Time::NowFromSystemTime() - lastUpdateTime;
if (timeSinceUpdate >= if (base::TimeDelta() < timeSinceUpdate &&
base::TimeDelta::FromSeconds(config_->NextCheckDelay()) || timeSinceUpdate <
timeSinceUpdate < base::TimeDelta()) { base::TimeDelta::FromSeconds(config_->NextCheckDelay())) {
scoped_refptr<UpdateServiceInProcess> update_service = VLOG(0) << "Skipping checking for updates: "
base::MakeRefCounted<UpdateServiceInProcess>(config_); << timeSinceUpdate.InMinutes();
main_task_runner_->PostTask(FROM_HERE, std::move(callback));
update_service->UpdateAll( return;
base::BindRepeating([](UpdateService::UpdateState) {}),
base::BindOnce(
[](base::OnceClosure closure,
scoped_refptr<updater::Configurator> config,
UpdateService::Result result) {
const int exit_code = static_cast<int>(result);
VLOG(0) << "UpdateAll complete: exit_code = " << exit_code;
if (result == UpdateService::Result::kSuccess) {
config->GetPrefService()->SetTime(
kPrefUpdateTime, base::Time::NowFromSystemTime());
}
std::move(closure).Run();
},
base::BindOnce(std::move(callback)), config_));
} }
scoped_refptr<UpdateServiceInProcess> update_service =
base::MakeRefCounted<UpdateServiceInProcess>(config_);
update_service->UpdateAll(
base::BindRepeating([](UpdateService::UpdateState) {}),
base::BindOnce(
[](base::OnceClosure closure,
scoped_refptr<updater::Configurator> config,
UpdateService::Result result) {
const int exit_code = static_cast<int>(result);
VLOG(0) << "UpdateAll complete: exit_code = " << exit_code;
if (result == UpdateService::Result::kSuccess) {
config->GetPrefService()->SetTime(
kPrefUpdateTime, base::Time::NowFromSystemTime());
}
std::move(closure).Run();
},
base::BindOnce(std::move(callback)), config_));
} }
void ControlServiceInProcess::Uninitialize() { void ControlServiceInProcess::Uninitialize() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment