Commit 0ce7f732 authored by Mila Green's avatar Mila Green Committed by Commit Bot

UpdateApps now uses a factory to create an UpdateService.

The Mac implementation uses the out of process service.
Win still doesn't have that, so the implementation is unchanged.

Bug: 1048653
Change-Id: I70227020f79fc164b361cfcb998a041528a89dd9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2078907
Commit-Queue: Mila Green <milagreen@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarSorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745996}
parent 8f2936db
...@@ -12,6 +12,8 @@ import("//testing/test.gni") ...@@ -12,6 +12,8 @@ import("//testing/test.gni")
# dependencies are modified until a presubmit is written to automatically # dependencies are modified until a presubmit is written to automatically
# check that the C++ includes match the build dependency graph. # check that the C++ includes match the build dependency graph.
set_sources_assignment_filter([])
# TODO(sorin): make the code build on Linux. https://crbug.com/1014320 # TODO(sorin): make the code build on Linux. https://crbug.com/1014320
group("updater") { group("updater") {
if (is_win) { if (is_win) {
...@@ -72,8 +74,6 @@ if (is_win || is_mac) { ...@@ -72,8 +74,6 @@ if (is_win || is_mac) {
"configurator.h", "configurator.h",
"installer.cc", "installer.cc",
"installer.h", "installer.h",
"installer_mac.cc",
"installer_win.cc",
"update_apps.cc", "update_apps.cc",
"update_apps.h", "update_apps.h",
"update_service_in_process.cc", "update_service_in_process.cc",
...@@ -82,6 +82,20 @@ if (is_win || is_mac) { ...@@ -82,6 +82,20 @@ if (is_win || is_mac) {
"updater.h", "updater.h",
] ]
if (is_mac) {
sources += [
"installer_mac.cc",
"update_apps_mac.mm",
]
}
if (is_win) {
sources += [
"installer_win.cc",
"update_apps_win.cc",
]
}
deps = [ deps = [
":base", ":base",
":version_header", ":version_header",
...@@ -103,6 +117,7 @@ if (is_win || is_mac) { ...@@ -103,6 +117,7 @@ if (is_win || is_mac) {
deps += [ deps += [
"//chrome/updater/mac:installer_sources", "//chrome/updater/mac:installer_sources",
"//chrome/updater/mac:network_fetcher_sources", "//chrome/updater/mac:network_fetcher_sources",
"//chrome/updater/mac:update_service_client_sources",
"//chrome/updater/mac:updater_setup_sources", "//chrome/updater/mac:updater_setup_sources",
] ]
} }
......
...@@ -37,11 +37,12 @@ source_set("update_service_client_sources") { ...@@ -37,11 +37,12 @@ source_set("update_service_client_sources") {
deps = [ deps = [
"//base", "//base",
"//chrome/updater:base", "//chrome/updater:base",
"//chrome/updater:lib",
"//chrome/updater:version_header", "//chrome/updater:version_header",
"//chrome/updater/server", "//chrome/updater/server",
"//components/update_client", "//components/update_client",
] ]
libs = [ "Foundation.framework" ]
} }
source_set("updater_tests") { source_set("updater_tests") {
......
...@@ -5,10 +5,11 @@ ...@@ -5,10 +5,11 @@
#ifndef CHROME_UPDATER_MAC_UPDATE_SERVICE_OUT_OF_PROCESS_H_ #ifndef CHROME_UPDATER_MAC_UPDATE_SERVICE_OUT_OF_PROCESS_H_
#define CHROME_UPDATER_MAC_UPDATE_SERVICE_OUT_OF_PROCESS_H_ #define CHROME_UPDATER_MAC_UPDATE_SERVICE_OUT_OF_PROCESS_H_
#import <Foundation/Foundation.h>
#include "base/callback_forward.h" #include "base/callback_forward.h"
#include "base/mac/scoped_nsobject.h" #include "base/mac/scoped_nsobject.h"
#include "base/memory/ref_counted.h" #include "base/sequence_checker.h"
#import "chrome/updater/server/mac/service_protocol.h"
#include "chrome/updater/update_service.h" #include "chrome/updater/update_service.h"
@class CRUUpdateServiceOutOfProcessImpl; @class CRUUpdateServiceOutOfProcessImpl;
......
...@@ -4,15 +4,16 @@ ...@@ -4,15 +4,16 @@
#include "chrome/updater/mac/update_service_out_of_process.h" #include "chrome/updater/mac/update_service_out_of_process.h"
#import <Foundation/Foundation.h>
#include <string> #include <string>
#include "base/bind.h" #include "base/bind.h"
#include "base/callback.h" #include "base/callback.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/mac/scoped_nsobject.h" #include "base/mac/scoped_nsobject.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/sequenced_task_runner_handle.h"
#import "chrome/updater/server/mac/service_protocol.h" #import "chrome/updater/server/mac/service_protocol.h"
#include "chrome/updater/updater_version.h" #include "chrome/updater/updater_version.h"
#include "components/update_client/update_client_errors.h" #include "components/update_client/update_client_errors.h"
......
...@@ -9,22 +9,16 @@ ...@@ -9,22 +9,16 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/task/single_thread_task_executor.h" #include "base/task/single_thread_task_executor.h"
#include "chrome/updater/configurator.h" #include "chrome/updater/update_service.h"
#include "chrome/updater/update_service_in_process.h"
namespace updater { namespace updater {
int UpdateApps() { int UpdateApps() {
// TODO(crbug.com/1048653): Try to connect to an existing OOP service. For
// now, run an in-process service.
base::SingleThreadTaskExecutor main_task_executor; base::SingleThreadTaskExecutor main_task_executor;
base::RunLoop runloop; base::RunLoop runloop;
auto service = std::make_unique<UpdateServiceInProcess>( std::unique_ptr<UpdateService> service = CreateUpdateService();
base::MakeRefCounted<Configurator>());
service->UpdateAll(base::BindOnce( service->UpdateAll(base::BindOnce(
[](base::OnceClosure quit, update_client::Error error) { [](base::OnceClosure quit, update_client::Error error) {
VLOG(0) << "UpdateAll complete: error = " << static_cast<int>(error); VLOG(0) << "UpdateAll complete: error = " << static_cast<int>(error);
......
...@@ -5,7 +5,13 @@ ...@@ -5,7 +5,13 @@
#ifndef CHROME_UPDATER_UPDATE_APPS_H_ #ifndef CHROME_UPDATER_UPDATE_APPS_H_
#define CHROME_UPDATER_UPDATE_APPS_H_ #define CHROME_UPDATER_UPDATE_APPS_H_
#include <memory>
namespace updater { namespace updater {
class UpdateService;
// A factory method to create an UpdateService class instance.
std::unique_ptr<UpdateService> CreateUpdateService();
// Updates all registered applications. // Updates all registered applications.
int UpdateApps(); int UpdateApps();
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/updater/update_apps.h"
#include "chrome/updater/mac/update_service_out_of_process.h"
namespace updater {
std::unique_ptr<UpdateService> CreateUpdateService() {
return std::make_unique<UpdateServiceOutOfProcess>();
}
} // namespace updater
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/updater/update_apps.h"
#include "base/memory/scoped_refptr.h"
#include "chrome/updater/configurator.h"
#include "chrome/updater/update_service_in_process.h"
namespace updater {
std::unique_ptr<UpdateService> CreateUpdateService() {
// 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>());
}
} // 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