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")
# dependencies are modified until a presubmit is written to automatically
# 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
group("updater") {
if (is_win) {
......@@ -72,8 +74,6 @@ if (is_win || is_mac) {
"configurator.h",
"installer.cc",
"installer.h",
"installer_mac.cc",
"installer_win.cc",
"update_apps.cc",
"update_apps.h",
"update_service_in_process.cc",
......@@ -82,6 +82,20 @@ if (is_win || is_mac) {
"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 = [
":base",
":version_header",
......@@ -103,6 +117,7 @@ if (is_win || is_mac) {
deps += [
"//chrome/updater/mac:installer_sources",
"//chrome/updater/mac:network_fetcher_sources",
"//chrome/updater/mac:update_service_client_sources",
"//chrome/updater/mac:updater_setup_sources",
]
}
......
......@@ -37,11 +37,12 @@ source_set("update_service_client_sources") {
deps = [
"//base",
"//chrome/updater:base",
"//chrome/updater:lib",
"//chrome/updater:version_header",
"//chrome/updater/server",
"//components/update_client",
]
libs = [ "Foundation.framework" ]
}
source_set("updater_tests") {
......
......@@ -5,10 +5,11 @@
#ifndef 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/mac/scoped_nsobject.h"
#include "base/memory/ref_counted.h"
#import "chrome/updater/server/mac/service_protocol.h"
#include "base/sequence_checker.h"
#include "chrome/updater/update_service.h"
@class CRUUpdateServiceOutOfProcessImpl;
......
......@@ -4,15 +4,16 @@
#include "chrome/updater/mac/update_service_out_of_process.h"
#import <Foundation/Foundation.h>
#include <string>
#include "base/bind.h"
#include "base/callback.h"
#include "base/logging.h"
#include "base/mac/scoped_nsobject.h"
#include "base/memory/scoped_refptr.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"
#include "chrome/updater/updater_version.h"
#include "components/update_client/update_client_errors.h"
......
......@@ -9,22 +9,16 @@
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_executor.h"
#include "chrome/updater/configurator.h"
#include "chrome/updater/update_service_in_process.h"
#include "chrome/updater/update_service.h"
namespace updater {
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::RunLoop runloop;
auto service = std::make_unique<UpdateServiceInProcess>(
base::MakeRefCounted<Configurator>());
std::unique_ptr<UpdateService> service = CreateUpdateService();
service->UpdateAll(base::BindOnce(
[](base::OnceClosure quit, update_client::Error error) {
VLOG(0) << "UpdateAll complete: error = " << static_cast<int>(error);
......
......@@ -5,7 +5,13 @@
#ifndef CHROME_UPDATER_UPDATE_APPS_H_
#define CHROME_UPDATER_UPDATE_APPS_H_
#include <memory>
namespace updater {
class UpdateService;
// A factory method to create an UpdateService class instance.
std::unique_ptr<UpdateService> CreateUpdateService();
// Updates all registered applications.
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