Commit 6ebabdce authored by Michael Chang's avatar Michael Chang Committed by Commit Bot

Chromium Updater fix app unregister logic

App unregister logic had a gap in which apps were being
unregistered despite being on the machine. Also, changed
the method name to make it more accurate to what was
happening

Bug: 1056450
Change-Id: I6325c303c9a7693a13bcd44c8583b7ca4020c1fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2439798
Commit-Queue: Michael Chang <donchan@microsoft.com>
Reviewed-by: default avatarSorin Jianu <sorin@chromium.org>
Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812123}
parent de5eb6f7
...@@ -33,7 +33,7 @@ ControlServiceInProcess::ControlServiceInProcess( ...@@ -33,7 +33,7 @@ ControlServiceInProcess::ControlServiceInProcess(
void ControlServiceInProcess::Run(base::OnceClosure callback) { void ControlServiceInProcess::Run(base::OnceClosure callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
RemoveApps(); UnregisterMissingApps();
MaybeCheckForUpdates(std::move(callback)); MaybeCheckForUpdates(std::move(callback));
} }
...@@ -79,14 +79,14 @@ void ControlServiceInProcess::MaybeCheckForUpdates(base::OnceClosure callback) { ...@@ -79,14 +79,14 @@ void ControlServiceInProcess::MaybeCheckForUpdates(base::OnceClosure callback) {
base::BindOnce(std::move(callback)), config_)); base::BindOnce(std::move(callback)), config_));
} }
void ControlServiceInProcess::RemoveApps() { void ControlServiceInProcess::UnregisterMissingApps() {
for (const auto& app_id : persisted_data_->GetAppIds()) { for (const auto& app_id : persisted_data_->GetAppIds()) {
// Skip if app_id is equal to updater app id. // Skip if app_id is equal to updater app id.
if (app_id == kUpdaterAppId) if (app_id == kUpdaterAppId)
continue; continue;
const base::FilePath ecp = persisted_data_->GetExistenceCheckerPath(app_id); const base::FilePath ecp = persisted_data_->GetExistenceCheckerPath(app_id);
if (!ecp.empty() && base::PathExists(ecp)) { if (!ecp.empty() && !base::PathExists(ecp)) {
if (!persisted_data_->RemoveApp(app_id)) if (!persisted_data_->RemoveApp(app_id))
VLOG(0) << "Could not remove registration of app " << app_id; VLOG(0) << "Could not remove registration of app " << app_id;
} }
......
...@@ -41,7 +41,7 @@ class ControlServiceInProcess : public ControlService { ...@@ -41,7 +41,7 @@ class ControlServiceInProcess : public ControlService {
// Provides a way to remove apps from the persisted data if the app is no // Provides a way to remove apps from the persisted data if the app is no
// longer installed on the machine. // longer installed on the machine.
void RemoveApps(); void UnregisterMissingApps();
scoped_refptr<updater::Configurator> config_; scoped_refptr<updater::Configurator> config_;
scoped_refptr<updater::PersistedData> persisted_data_; scoped_refptr<updater::PersistedData> persisted_data_;
......
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