Commit 0e38f00c authored by Sorin Jianu's avatar Sorin Jianu Committed by Commit Bot

Add sequence checkers to ControlServiceimpl.

Bug: 1141936
Change-Id: I9c1d9c61d55f3c862e791dc071011a215e68c945
Fixed: 1141936
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2495519Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820408}
parent 44931e57
......@@ -27,8 +27,7 @@ ControlServiceImpl::ControlServiceImpl(
scoped_refptr<updater::Configurator> config)
: config_(config),
persisted_data_(
base::MakeRefCounted<PersistedData>(config_->GetPrefService())),
main_task_runner_(base::SequencedTaskRunnerHandle::Get()) {}
base::MakeRefCounted<PersistedData>(config_->GetPrefService())) {}
void ControlServiceImpl::Run(base::OnceClosure callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
......@@ -44,6 +43,8 @@ void ControlServiceImpl::InitializeUpdateService(base::OnceClosure callback) {
}
void ControlServiceImpl::MaybeCheckForUpdates(base::OnceClosure callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
const base::Time lastUpdateTime =
config_->GetPrefService()->GetTime(kPrefUpdateTime);
......@@ -54,7 +55,8 @@ void ControlServiceImpl::MaybeCheckForUpdates(base::OnceClosure callback) {
base::TimeDelta::FromSeconds(config_->NextCheckDelay())) {
VLOG(0) << "Skipping checking for updates: "
<< timeSinceUpdate.InMinutes();
main_task_runner_->PostTask(FROM_HERE, std::move(callback));
base::SequencedTaskRunnerHandle::Get()->PostTask(FROM_HERE,
std::move(callback));
return;
}
......@@ -79,6 +81,7 @@ void ControlServiceImpl::MaybeCheckForUpdates(base::OnceClosure callback) {
}
void ControlServiceImpl::UnregisterMissingApps() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
for (const auto& app_id : persisted_data_->GetAppIds()) {
// Skip if app_id is equal to updater app id.
if (app_id == kUpdaterAppId)
......
......@@ -10,10 +10,6 @@
#include "base/sequence_checker.h"
#include "chrome/updater/control_service.h"
namespace base {
class SequencedTaskRunner;
}
namespace updater {
class Configurator;
......@@ -45,7 +41,6 @@ class ControlServiceImpl : public ControlService {
scoped_refptr<updater::Configurator> config_;
scoped_refptr<updater::PersistedData> persisted_data_;
scoped_refptr<base::SequencedTaskRunner> main_task_runner_;
};
} // namespace updater
......
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