Commit 66ed7cb1 authored by Sorin Jianu's avatar Sorin Jianu Committed by Commit Bot

Fix --ua.

It's been failing because of breaking threading preconditions
when creating the configurator.

Bug: 1059138
Change-Id: I021c8bbf000d1c7372d3cbf9b821e57ea188a0b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2091941Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747865}
parent 33469df1
......@@ -19,12 +19,21 @@ namespace updater {
class AppUpdateAll : public App {
private:
~AppUpdateAll() override = default;
// Overrides for App.
void FirstTaskRun() override;
void Initialize() override;
scoped_refptr<Configurator> config_;
};
void AppUpdateAll::Initialize() {
config_ = base::MakeRefCounted<Configurator>();
}
// AppUpdateAll triggers an update of all registered applications.
void AppUpdateAll::FirstTaskRun() {
CreateUpdateService()->UpdateAll(base::BindOnce(
CreateUpdateService(config_)->UpdateAll(base::BindOnce(
[](base::OnceCallback<void(int)> quit, update_client::Error error) {
VLOG(0) << "UpdateAll complete: error = " << static_cast<int>(error);
std::move(quit).Run(static_cast<int>(error));
......
......@@ -7,11 +7,18 @@
#include <memory>
#include "base/memory/scoped_refptr.h"
namespace update_client {
class Configurator;
} // namespace update_client
namespace updater {
class UpdateService;
// A factory method to create an UpdateService class instance.
std::unique_ptr<UpdateService> CreateUpdateService();
std::unique_ptr<UpdateService> CreateUpdateService(
scoped_refptr<update_client::Configurator> config);
} // namespace updater
......
......@@ -4,11 +4,13 @@
#include "chrome/updater/update_apps.h"
#include "chrome/updater/configurator.h"
#include "chrome/updater/mac/update_service_out_of_process.h"
namespace updater {
std::unique_ptr<UpdateService> CreateUpdateService() {
std::unique_ptr<UpdateService> CreateUpdateService(
scoped_refptr<update_client::Configurator> config) {
return std::make_unique<UpdateServiceOutOfProcess>();
}
......
......@@ -10,11 +10,11 @@
namespace updater {
std::unique_ptr<UpdateService> CreateUpdateService() {
std::unique_ptr<UpdateService> CreateUpdateService(
scoped_refptr<update_client::Configurator> config) {
// TODO(crbug.com/1048653): Try to connect to an existing OOP service. For
// now, run an in-process service.
return std::make_unique<UpdateServiceInProcess>(
base::MakeRefCounted<Configurator>());
return std::make_unique<UpdateServiceInProcess>(config);
}
} // 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