Commit 00e85a6a authored by Sorin Jianu's avatar Sorin Jianu Committed by Commit Bot

Rename {control,update} services.

This is renaming the out-of-process artifacts as `proxy`, to indicate
that they are communicating via RPC with the rest of the system.

The in-process entities are renamed as `impl`, to suggest that they
are implementations of functionality provided by the
corresponding interfaces.

Bug: 1121297
Change-Id: I50a62fb19d56e455cd9e001b7642cef85f114e3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2490677Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819919}
parent a846df30
......@@ -94,8 +94,8 @@ if (is_win || is_mac) {
"app/app_wake.h",
"configurator.cc",
"configurator.h",
"control_service_in_process.cc",
"control_service_in_process.h",
"control_service_impl.cc",
"control_service_impl.h",
"crx_downloader_factory.h",
"external_constants.cc",
"external_constants.h",
......@@ -111,8 +111,8 @@ if (is_win || is_mac) {
"setup.h",
"tag.cc",
"tag.h",
"update_service_in_process.cc",
"update_service_in_process.h",
"update_service_impl.cc",
"update_service_impl.h",
"updater.cc",
"updater.h",
]
......@@ -133,10 +133,10 @@ if (is_win || is_mac) {
"launchd_util.cc",
"launchd_util.h",
"lib_util_mac.mm",
"mac/control_service_out_of_process.h",
"mac/control_service_out_of_process.mm",
"mac/update_service_out_of_process.h",
"mac/update_service_out_of_process.mm",
"mac/control_service_proxy.h",
"mac/control_service_proxy.mm",
"mac/update_service_proxy.h",
"mac/update_service_proxy.mm",
"prefs_mac.mm",
"service_factory_mac.mm",
"setup_mac.mm",
......@@ -316,7 +316,7 @@ if (is_win || is_mac) {
"external_constants_mac_unittest.mm",
"mac/scoped_xpc_service_mock.h",
"mac/scoped_xpc_service_mock.mm",
"mac/update_service_out_of_process_test.mm",
"mac/update_service_proxy_test.mm",
"test/integration_tests_mac.mm",
]
......
......@@ -18,7 +18,7 @@
#import "chrome/updater/configurator.h"
#import "chrome/updater/mac/xpc_service_names.h"
#include "chrome/updater/prefs.h"
#include "chrome/updater/update_service_in_process.h"
#include "chrome/updater/update_service_impl.h"
namespace base {
class SequencedTaskRunner;
......
......@@ -21,11 +21,11 @@
#include "chrome/updater/app/server/mac/service_delegate.h"
#include "chrome/updater/configurator.h"
#include "chrome/updater/constants.h"
#include "chrome/updater/control_service_in_process.h"
#include "chrome/updater/control_service_impl.h"
#include "chrome/updater/mac/setup/setup.h"
#import "chrome/updater/mac/xpc_service_names.h"
#include "chrome/updater/prefs.h"
#include "chrome/updater/update_service_in_process.h"
#include "chrome/updater/update_service_impl.h"
namespace updater {
......@@ -58,7 +58,7 @@ void AppServerMac::ActiveDuty() {
@autoreleasepool {
// Sets up a listener and delegate for the CRUControlling XPC connection.
control_service_delegate_.reset([[CRUControlServiceXPCDelegate alloc]
initWithControlService:base::MakeRefCounted<ControlServiceInProcess>(
initWithControlService:base::MakeRefCounted<ControlServiceImpl>(
config_)
appServer:scoped_refptr<AppServerMac>(this)]);
......@@ -74,8 +74,7 @@ void AppServerMac::ActiveDuty() {
// Sets up a listener and delegate for the CRUUpdateChecking XPC
// connection.
update_check_delegate_.reset([[CRUUpdateCheckServiceXPCDelegate alloc]
initWithUpdateService:base::MakeRefCounted<UpdateServiceInProcess>(
config_)
initWithUpdateService:base::MakeRefCounted<UpdateServiceImpl>(config_)
appServer:scoped_refptr<AppServerMac>(this)]);
update_check_listener_.reset([[NSXPCListener alloc]
......
......@@ -94,7 +94,7 @@ HRESULT UpdaterImpl::GetVersion(BSTR* version) {
DCHECK(version);
// Return the hardcoded version instead of calling the corresponding
// non-blocking function of `UpdateServiceInProcess`. This results in some
// non-blocking function of `UpdateServiceImpl`. This results in some
// code duplication but it avoids the complexities of making this function
// non-blocking.
*version =
......
......@@ -20,9 +20,9 @@
#include "chrome/updater/app/server/win/com_classes.h"
#include "chrome/updater/app/server/win/com_classes_legacy.h"
#include "chrome/updater/configurator.h"
#include "chrome/updater/control_service_in_process.h"
#include "chrome/updater/control_service_impl.h"
#include "chrome/updater/prefs.h"
#include "chrome/updater/update_service_in_process.h"
#include "chrome/updater/update_service_impl.h"
#include "chrome/updater/win/constants.h"
#include "chrome/updater/win/wrl_module.h"
#include "components/prefs/pref_service.h"
......@@ -162,8 +162,8 @@ void ComServerApp::ActiveDuty() {
return;
}
main_task_runner_ = base::SequencedTaskRunnerHandle::Get();
update_service_ = base::MakeRefCounted<UpdateServiceInProcess>(config_);
control_service_ = base::MakeRefCounted<ControlServiceInProcess>(config_);
update_service_ = base::MakeRefCounted<UpdateServiceImpl>(config_);
control_service_ = base::MakeRefCounted<ControlServiceImpl>(config_);
CreateWRLModule();
HRESULT hr = RegisterClassObjects();
if (FAILED(hr))
......
......@@ -17,7 +17,7 @@ class ControlService : public base::RefCountedThreadSafe<ControlService> {
// Runs the ControlService and checks for updates if needed.
virtual void Run(base::OnceClosure callback) = 0;
// When ControlServiceOutOfProcess::InitializeUpdateService is invoked, the
// When ControlServiceProxy::InitializeUpdateService is invoked, the
// server will wake and do its ModeCheck. As a result, the candidate can be
// qualified and promoted (thus initializing the UpdateService for this
// candidate). This is intended as a way for --install and --register to have
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/updater/control_service_in_process.h"
#include "chrome/updater/control_service_impl.h"
#include <string>
#include <vector>
......@@ -18,33 +18,32 @@
#include "chrome/updater/constants.h"
#include "chrome/updater/persisted_data.h"
#include "chrome/updater/prefs.h"
#include "chrome/updater/update_service_in_process.h"
#include "chrome/updater/update_service_impl.h"
#include "components/prefs/pref_service.h"
namespace updater {
ControlServiceInProcess::ControlServiceInProcess(
ControlServiceImpl::ControlServiceImpl(
scoped_refptr<updater::Configurator> config)
: config_(config),
persisted_data_(
base::MakeRefCounted<PersistedData>(config_->GetPrefService())),
main_task_runner_(base::SequencedTaskRunnerHandle::Get()) {}
void ControlServiceInProcess::Run(base::OnceClosure callback) {
void ControlServiceImpl::Run(base::OnceClosure callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
UnregisterMissingApps();
MaybeCheckForUpdates(std::move(callback));
}
void ControlServiceInProcess::InitializeUpdateService(
base::OnceClosure callback) {
void ControlServiceImpl::InitializeUpdateService(base::OnceClosure callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
VLOG(1) << __func__;
std::move(callback).Run();
}
void ControlServiceInProcess::MaybeCheckForUpdates(base::OnceClosure callback) {
void ControlServiceImpl::MaybeCheckForUpdates(base::OnceClosure callback) {
const base::Time lastUpdateTime =
config_->GetPrefService()->GetTime(kPrefUpdateTime);
......@@ -59,8 +58,8 @@ void ControlServiceInProcess::MaybeCheckForUpdates(base::OnceClosure callback) {
return;
}
scoped_refptr<UpdateServiceInProcess> update_service =
base::MakeRefCounted<UpdateServiceInProcess>(config_);
scoped_refptr<UpdateServiceImpl> update_service =
base::MakeRefCounted<UpdateServiceImpl>(config_);
update_service->UpdateAll(
base::BindRepeating([](UpdateService::UpdateState) {}),
......@@ -79,7 +78,7 @@ void ControlServiceInProcess::MaybeCheckForUpdates(base::OnceClosure callback) {
base::BindOnce(std::move(callback)), config_));
}
void ControlServiceInProcess::UnregisterMissingApps() {
void ControlServiceImpl::UnregisterMissingApps() {
for (const auto& app_id : persisted_data_->GetAppIds()) {
// Skip if app_id is equal to updater app id.
if (app_id == kUpdaterAppId)
......@@ -93,12 +92,12 @@ void ControlServiceInProcess::UnregisterMissingApps() {
}
}
void ControlServiceInProcess::Uninitialize() {
void ControlServiceImpl::Uninitialize() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
PrefsCommitPendingWrites(config_->GetPrefService());
}
ControlServiceInProcess::~ControlServiceInProcess() {
ControlServiceImpl::~ControlServiceImpl() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
config_->GetPrefService()->SchedulePendingLossyWrites();
}
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_UPDATER_CONTROL_SERVICE_IN_PROCESS_H_
#define CHROME_UPDATER_CONTROL_SERVICE_IN_PROCESS_H_
#ifndef CHROME_UPDATER_CONTROL_SERVICE_IMPL_H_
#define CHROME_UPDATER_CONTROL_SERVICE_IMPL_H_
#include "base/callback_forward.h"
#include "base/memory/scoped_refptr.h"
......@@ -20,9 +20,9 @@ class Configurator;
class PersistedData;
// All functions and callbacks must be called on the same sequence.
class ControlServiceInProcess : public ControlService {
class ControlServiceImpl : public ControlService {
public:
explicit ControlServiceInProcess(scoped_refptr<updater::Configurator> config);
explicit ControlServiceImpl(scoped_refptr<updater::Configurator> config);
// Overrides for updater::ControlService.
void Run(base::OnceClosure callback) override;
......@@ -31,7 +31,7 @@ class ControlServiceInProcess : public ControlService {
void Uninitialize() override;
private:
~ControlServiceInProcess() override;
~ControlServiceImpl() override;
SEQUENCE_CHECKER(sequence_checker_);
......@@ -50,4 +50,4 @@ class ControlServiceInProcess : public ControlService {
} // namespace updater
#endif // CHROME_UPDATER_CONTROL_SERVICE_IN_PROCESS_H_
#endif // CHROME_UPDATER_CONTROL_SERVICE_IMPL_H_
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_UPDATER_MAC_CONTROL_SERVICE_OUT_OF_PROCESS_H_
#define CHROME_UPDATER_MAC_CONTROL_SERVICE_OUT_OF_PROCESS_H_
#ifndef CHROME_UPDATER_MAC_CONTROL_SERVICE_PROXY_H_
#define CHROME_UPDATER_MAC_CONTROL_SERVICE_PROXY_H_
#import <Foundation/Foundation.h>
......@@ -14,7 +14,7 @@
#include "chrome/updater/control_service.h"
#include "chrome/updater/service_scope.h"
@class CRUControlServiceOutOfProcessImpl;
@class CRUControlServiceProxyImpl;
namespace base {
class SequencedTaskRunner;
......@@ -23,9 +23,9 @@ class SequencedTaskRunner;
namespace updater {
// All functions and callbacks must be called on the same sequence.
class ControlServiceOutOfProcess : public ControlService {
class ControlServiceProxy : public ControlService {
public:
explicit ControlServiceOutOfProcess(ServiceScope scope);
explicit ControlServiceProxy(ServiceScope scope);
// Overrides for ControlService.
void Run(base::OnceClosure callback) override;
......@@ -33,14 +33,14 @@ class ControlServiceOutOfProcess : public ControlService {
void Uninitialize() override;
private:
~ControlServiceOutOfProcess() override;
~ControlServiceProxy() override;
SEQUENCE_CHECKER(sequence_checker_);
base::scoped_nsobject<CRUControlServiceOutOfProcessImpl> client_;
base::scoped_nsobject<CRUControlServiceProxyImpl> client_;
scoped_refptr<base::SequencedTaskRunner> callback_runner_;
};
} // namespace updater
#endif // CHROME_UPDATER_MAC_CONTROL_SERVICE_OUT_OF_PROCESS_H_
#endif // CHROME_UPDATER_MAC_CONTROL_SERVICE_PROXY_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/updater/mac/control_service_out_of_process.h"
#include "chrome/updater/mac/control_service_proxy.h"
#import <Foundation/Foundation.h>
......@@ -16,13 +16,13 @@
#include "chrome/updater/service_scope.h"
// Interface to communicate with the XPC Control Service.
@interface CRUControlServiceOutOfProcessImpl : NSObject <CRUControlling>
@interface CRUControlServiceProxyImpl : NSObject <CRUControlling>
- (instancetype)initPrivileged;
@end
@implementation CRUControlServiceOutOfProcessImpl {
@implementation CRUControlServiceProxyImpl {
base::scoped_nsobject<NSXPCConnection> _controlXPCConnection;
}
......@@ -88,19 +88,19 @@
namespace updater {
ControlServiceOutOfProcess::ControlServiceOutOfProcess(ServiceScope scope)
ControlServiceProxy::ControlServiceProxy(ServiceScope scope)
: callback_runner_(base::SequencedTaskRunnerHandle::Get()) {
switch (scope) {
case ServiceScope::kSystem:
client_.reset([[CRUControlServiceOutOfProcessImpl alloc] initPrivileged]);
client_.reset([[CRUControlServiceProxyImpl alloc] initPrivileged]);
break;
case ServiceScope::kUser:
client_.reset([[CRUControlServiceOutOfProcessImpl alloc] init]);
client_.reset([[CRUControlServiceProxyImpl alloc] init]);
break;
}
}
void ControlServiceOutOfProcess::Run(base::OnceClosure callback) {
void ControlServiceProxy::Run(base::OnceClosure callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
__block base::OnceClosure block_callback = std::move(callback);
......@@ -112,8 +112,7 @@ void ControlServiceOutOfProcess::Run(base::OnceClosure callback) {
[client_ performControlTasksWithReply:reply];
}
void ControlServiceOutOfProcess::InitializeUpdateService(
base::OnceClosure callback) {
void ControlServiceProxy::InitializeUpdateService(base::OnceClosure callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
__block base::OnceClosure block_callback = std::move(callback);
......@@ -125,11 +124,11 @@ void ControlServiceOutOfProcess::InitializeUpdateService(
[client_ performInitializeUpdateServiceWithReply:reply];
}
void ControlServiceOutOfProcess::Uninitialize() {
void ControlServiceProxy::Uninitialize() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
ControlServiceOutOfProcess::~ControlServiceOutOfProcess() {
ControlServiceProxy::~ControlServiceProxy() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_UPDATER_MAC_UPDATE_SERVICE_OUT_OF_PROCESS_H_
#define CHROME_UPDATER_MAC_UPDATE_SERVICE_OUT_OF_PROCESS_H_
#ifndef CHROME_UPDATER_MAC_UPDATE_SERVICE_PROXY_H_
#define CHROME_UPDATER_MAC_UPDATE_SERVICE_PROXY_H_
#import <Foundation/Foundation.h>
......@@ -17,7 +17,7 @@
#include "chrome/updater/service_scope.h"
#include "chrome/updater/update_service.h"
@class CRUUpdateServiceOutOfProcessImpl;
@class CRUUpdateServiceProxyImpl;
namespace base {
class SequencedTaskRunner;
......@@ -31,9 +31,9 @@ enum class Error;
namespace updater {
// All functions and callbacks must be called on the same sequence.
class UpdateServiceOutOfProcess : public UpdateService {
class UpdateServiceProxy : public UpdateService {
public:
explicit UpdateServiceOutOfProcess(ServiceScope scope);
explicit UpdateServiceProxy(ServiceScope scope);
// Overrides for UpdateService.
void GetVersion(
......@@ -49,14 +49,14 @@ class UpdateServiceOutOfProcess : public UpdateService {
void Uninitialize() override;
private:
~UpdateServiceOutOfProcess() override;
~UpdateServiceProxy() override;
SEQUENCE_CHECKER(sequence_checker_);
base::scoped_nsobject<CRUUpdateServiceOutOfProcessImpl> client_;
base::scoped_nsobject<CRUUpdateServiceProxyImpl> client_;
scoped_refptr<base::SequencedTaskRunner> callback_runner_;
};
} // namespace updater
#endif // CHROME_UPDATER_MAC_UPDATE_SERVICE_OUT_OF_PROCESS_H_
#endif // CHROME_UPDATER_MAC_UPDATE_SERVICE_PROXY_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/updater/mac/update_service_out_of_process.h"
#include "chrome/updater/mac/update_service_proxy.h"
#import <Foundation/Foundation.h>
......@@ -29,13 +29,13 @@
using base::SysUTF8ToNSString;
// Interface to communicate with the XPC Updater Service.
@interface CRUUpdateServiceOutOfProcessImpl : NSObject <CRUUpdateChecking>
@interface CRUUpdateServiceProxyImpl : NSObject <CRUUpdateChecking>
- (instancetype)initPrivileged;
@end
@implementation CRUUpdateServiceOutOfProcessImpl {
@implementation CRUUpdateServiceProxyImpl {
base::scoped_nsobject<NSXPCConnection> _updateCheckXPCConnection;
}
......@@ -144,19 +144,19 @@ using base::SysUTF8ToNSString;
namespace updater {
UpdateServiceOutOfProcess::UpdateServiceOutOfProcess(ServiceScope scope) {
UpdateServiceProxy::UpdateServiceProxy(ServiceScope scope) {
switch (scope) {
case ServiceScope::kSystem:
client_.reset([[CRUUpdateServiceOutOfProcessImpl alloc] initPrivileged]);
client_.reset([[CRUUpdateServiceProxyImpl alloc] initPrivileged]);
break;
case ServiceScope::kUser:
client_.reset([[CRUUpdateServiceOutOfProcessImpl alloc] init]);
client_.reset([[CRUUpdateServiceProxyImpl alloc] init]);
break;
}
callback_runner_ = base::SequencedTaskRunnerHandle::Get();
}
void UpdateServiceOutOfProcess::GetVersion(
void UpdateServiceProxy::GetVersion(
base::OnceCallback<void(const base::Version&)> callback) const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
......@@ -171,7 +171,7 @@ void UpdateServiceOutOfProcess::GetVersion(
[client_ getVersionWithReply:reply];
}
void UpdateServiceOutOfProcess::RegisterApp(
void UpdateServiceProxy::RegisterApp(
const RegistrationRequest& request,
base::OnceCallback<void(const RegistrationResponse&)> callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
......@@ -196,8 +196,8 @@ void UpdateServiceOutOfProcess::RegisterApp(
reply:reply];
}
void UpdateServiceOutOfProcess::UpdateAll(StateChangeCallback state_update,
Callback callback) {
void UpdateServiceProxy::UpdateAll(StateChangeCallback state_update,
Callback callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
__block base::OnceCallback<void(UpdateService::Result)> block_callback =
......@@ -215,10 +215,10 @@ void UpdateServiceOutOfProcess::UpdateAll(StateChangeCallback state_update,
[client_ checkForUpdatesWithUpdateState:stateObserver.get() reply:reply];
}
void UpdateServiceOutOfProcess::Update(const std::string& app_id,
UpdateService::Priority priority,
StateChangeCallback state_update,
Callback callback) {
void UpdateServiceProxy::Update(const std::string& app_id,
UpdateService::Priority priority,
StateChangeCallback state_update,
Callback callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
__block base::OnceCallback<void(UpdateService::Result)> block_callback =
......@@ -242,11 +242,11 @@ void UpdateServiceOutOfProcess::Update(const std::string& app_id,
reply:reply];
}
void UpdateServiceOutOfProcess::Uninitialize() {
void UpdateServiceProxy::Uninitialize() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
UpdateServiceOutOfProcess::~UpdateServiceOutOfProcess() {
UpdateServiceProxy::~UpdateServiceProxy() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/updater/mac/update_service_out_of_process.h"
#include "chrome/updater/mac/update_service_proxy.h"
#import <Foundation/Foundation.h>
......@@ -274,11 +274,11 @@ UpdateService::StateChangeCallback StateChangeTestEngine::Watch() {
#pragma mark Test fixture
class MacUpdateServiceOutOfProcessTest : public ::testing::Test {
class MacUpdateServiceProxyTest : public ::testing::Test {
protected:
void SetUp() override;
// Create an UpdateServiceOutOfProcess and store in service_. Must be
// Create an UpdateServiceProxy and store in service_. Must be
// called only on the task_environment_ sequence. SetUp() posts it.
void InitializeUpdateService();
......@@ -286,15 +286,15 @@ class MacUpdateServiceOutOfProcessTest : public ::testing::Test {
base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED};
ScopedXPCServiceMock mock_driver_ { @protocol (CRUUpdateChecking) };
std::unique_ptr<base::RunLoop> run_loop_;
scoped_refptr<UpdateServiceOutOfProcess> service_;
scoped_refptr<UpdateServiceProxy> service_;
}; // class MacUpdateOutOfProcessTest
void MacUpdateServiceOutOfProcessTest::SetUp() {
void MacUpdateServiceProxyTest::SetUp() {
run_loop_ = std::make_unique<base::RunLoop>();
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindLambdaForTesting([this]() {
service_ = base::MakeRefCounted<UpdateServiceOutOfProcess>(
ServiceScope::kUser);
service_ =
base::MakeRefCounted<UpdateServiceProxy>(ServiceScope::kUser);
}));
}
......@@ -445,7 +445,7 @@ StateChangeTestEngine::StatePair UpdatedStates(const std::string& app_id,
#pragma mark Test cases
TEST_F(MacUpdateServiceOutOfProcessTest, NoProductsUpdateAll) {
TEST_F(MacUpdateServiceProxyTest, NoProductsUpdateAll) {
ScopedXPCServiceMock::ConnectionMockRecord* conn_rec =
mock_driver_.PrepareNewMockConnection();
ScopedXPCServiceMock::RemoteObjectMockRecord* mock_rec =
......@@ -485,7 +485,7 @@ TEST_F(MacUpdateServiceOutOfProcessTest, NoProductsUpdateAll) {
mock_driver_.VerifyAll();
}
TEST_F(MacUpdateServiceOutOfProcessTest, SimpleProductUpdate) {
TEST_F(MacUpdateServiceProxyTest, SimpleProductUpdate) {
ScopedXPCServiceMock::ConnectionMockRecord* conn_rec =
mock_driver_.PrepareNewMockConnection();
ScopedXPCServiceMock::RemoteObjectMockRecord* mock_rec =
......
......@@ -3,18 +3,18 @@
// found in the LICENSE file.
#include "base/memory/ref_counted.h"
#include "chrome/updater/mac/control_service_out_of_process.h"
#include "chrome/updater/mac/update_service_out_of_process.h"
#include "chrome/updater/mac/control_service_proxy.h"
#include "chrome/updater/mac/update_service_proxy.h"
#include "chrome/updater/service_scope.h"
namespace updater {
scoped_refptr<UpdateService> CreateUpdateService() {
return base::MakeRefCounted<UpdateServiceOutOfProcess>(GetProcessScope());
return base::MakeRefCounted<UpdateServiceProxy>(GetProcessScope());
}
scoped_refptr<ControlService> CreateControlService() {
return base::MakeRefCounted<ControlServiceOutOfProcess>(GetProcessScope());
return base::MakeRefCounted<ControlServiceProxy>(GetProcessScope());
}
} // namespace updater
......@@ -6,8 +6,8 @@
#include "base/memory/ref_counted.h"
#include "base/no_destructor.h"
#include "chrome/updater/service_scope.h"
#include "chrome/updater/win/control_service_out_of_process.h"
#include "chrome/updater/win/update_service_out_of_process.h"
#include "chrome/updater/win/control_service_proxy.h"
#include "chrome/updater/win/update_service_proxy.h"
#include "chrome/updater/win/wrl_module.h"
namespace updater {
......@@ -32,12 +32,12 @@ class WRLModuleInitializer {
scoped_refptr<UpdateService> CreateUpdateService() {
WRLModuleInitializer::Get();
return base::MakeRefCounted<UpdateServiceOutOfProcess>(GetProcessScope());
return base::MakeRefCounted<UpdateServiceProxy>(GetProcessScope());
}
scoped_refptr<ControlService> CreateControlService() {
WRLModuleInitializer::Get();
return base::MakeRefCounted<ControlServiceOutOfProcess>(GetProcessScope());
return base::MakeRefCounted<ControlServiceProxy>(GetProcessScope());
}
} // namespace updater
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/updater/update_service_in_process.h"
#include "chrome/updater/update_service_impl.h"
#include <string>
#include <utility>
......@@ -145,7 +145,7 @@ std::vector<base::Optional<update_client::CrxComponent>> GetComponents(
} // namespace
UpdateServiceInProcess::UpdateServiceInProcess(
UpdateServiceImpl::UpdateServiceImpl(
scoped_refptr<update_client::Configurator> config)
: config_(config),
persisted_data_(
......@@ -153,7 +153,7 @@ UpdateServiceInProcess::UpdateServiceInProcess(
main_task_runner_(base::SequencedTaskRunnerHandle::Get()),
update_client_(update_client::UpdateClientFactory(config)) {}
void UpdateServiceInProcess::GetVersion(
void UpdateServiceImpl::GetVersion(
base::OnceCallback<void(const base::Version&)> callback) const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
main_task_runner_->PostTask(
......@@ -161,7 +161,7 @@ void UpdateServiceInProcess::GetVersion(
base::Version(UPDATER_VERSION_STRING)));
}
void UpdateServiceInProcess::RegisterApp(
void UpdateServiceImpl::RegisterApp(
const RegistrationRequest& request,
base::OnceCallback<void(const RegistrationResponse&)> callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
......@@ -178,8 +178,8 @@ void UpdateServiceInProcess::RegisterApp(
FROM_HERE, base::BindOnce(std::move(callback), RegistrationResponse(0)));
}
void UpdateServiceInProcess::UpdateAll(StateChangeCallback state_update,
Callback callback) {
void UpdateServiceImpl::UpdateAll(StateChangeCallback state_update,
Callback callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
const auto app_ids = persisted_data_->GetAppIds();
......@@ -191,10 +191,10 @@ void UpdateServiceInProcess::UpdateAll(StateChangeCallback state_update,
MakeUpdateClientCallback(std::move(callback)));
}
void UpdateServiceInProcess::Update(const std::string& app_id,
Priority priority,
StateChangeCallback state_update,
Callback callback) {
void UpdateServiceImpl::Update(const std::string& app_id,
Priority priority,
StateChangeCallback state_update,
Callback callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
update_client_->Update(
......@@ -204,12 +204,12 @@ void UpdateServiceInProcess::Update(const std::string& app_id,
MakeUpdateClientCallback(std::move(callback)));
}
void UpdateServiceInProcess::Uninitialize() {
void UpdateServiceImpl::Uninitialize() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
PrefsCommitPendingWrites(config_->GetPrefService());
}
UpdateServiceInProcess::~UpdateServiceInProcess() {
UpdateServiceImpl::~UpdateServiceImpl() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
config_->GetPrefService()->SchedulePendingLossyWrites();
}
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_UPDATER_UPDATE_SERVICE_IN_PROCESS_H_
#define CHROME_UPDATER_UPDATE_SERVICE_IN_PROCESS_H_
#ifndef CHROME_UPDATER_UPDATE_SERVICE_IMPL_H_
#define CHROME_UPDATER_UPDATE_SERVICE_IMPL_H_
#include <string>
#include <vector>
......@@ -16,7 +16,7 @@
namespace base {
class SequencedTaskRunner;
class Version;
}
} // namespace base
namespace update_client {
class Configurator;
......@@ -29,10 +29,9 @@ struct RegistrationRequest;
struct RegistrationResponse;
// All functions and callbacks must be called on the same sequence.
class UpdateServiceInProcess : public UpdateService {
class UpdateServiceImpl : public UpdateService {
public:
explicit UpdateServiceInProcess(
scoped_refptr<update_client::Configurator> config);
explicit UpdateServiceImpl(scoped_refptr<update_client::Configurator> config);
// Overrides for updater::UpdateService.
void GetVersion(
......@@ -49,7 +48,7 @@ class UpdateServiceInProcess : public UpdateService {
void Uninitialize() override;
private:
~UpdateServiceInProcess() override;
~UpdateServiceImpl() override;
SEQUENCE_CHECKER(sequence_checker_);
......@@ -61,4 +60,4 @@ class UpdateServiceInProcess : public UpdateService {
} // namespace updater
#endif // CHROME_UPDATER_UPDATE_SERVICE_IN_PROCESS_H_
#endif // CHROME_UPDATER_UPDATE_SERVICE_IMPL_H_
......@@ -76,8 +76,8 @@ source_set("constants") {
source_set("lib") {
sources = [
"action_handler.cc",
"control_service_out_of_process.cc",
"control_service_out_of_process.h",
"control_service_proxy.cc",
"control_service_proxy.h",
"group_policy_manager.cc",
"group_policy_manager.h",
"net/net_util.cc",
......@@ -104,8 +104,8 @@ source_set("lib") {
"setup/uninstall.h",
"task_scheduler.cc",
"task_scheduler.h",
"update_service_out_of_process.cc",
"update_service_out_of_process.h",
"update_service_proxy.cc",
"update_service_proxy.h",
"user_info.cc",
"user_info.h",
"util.cc",
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/updater/win/control_service_out_of_process.h"
#include "chrome/updater/win/control_service_proxy.h"
#include <windows.h>
#include <wrl/client.h>
......@@ -118,19 +118,19 @@ void UpdaterControlObserver::OnCompleteOnSTA() {
} // namespace
ControlServiceOutOfProcess::ControlServiceOutOfProcess(ServiceScope /*scope*/)
ControlServiceProxy::ControlServiceProxy(ServiceScope /*scope*/)
: com_task_runner_(
base::ThreadPool::CreateCOMSTATaskRunner(kComClientTraits)) {}
ControlServiceOutOfProcess::~ControlServiceOutOfProcess() {
ControlServiceProxy::~ControlServiceProxy() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
void ControlServiceOutOfProcess::Uninitialize() {
void ControlServiceProxy::Uninitialize() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
void ControlServiceOutOfProcess::Run(base::OnceClosure callback) {
void ControlServiceProxy::Run(base::OnceClosure callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Reposts the call to the COM task runner. Adapts |callback| so that
......@@ -138,7 +138,7 @@ void ControlServiceOutOfProcess::Run(base::OnceClosure callback) {
com_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&ControlServiceOutOfProcess::RunOnSTA, this,
&ControlServiceProxy::RunOnSTA, this,
base::BindOnce(
[](scoped_refptr<base::SequencedTaskRunner> taskrunner,
base::OnceClosure callback) {
......@@ -148,7 +148,7 @@ void ControlServiceOutOfProcess::Run(base::OnceClosure callback) {
base::SequencedTaskRunnerHandle::Get(), std::move(callback))));
}
void ControlServiceOutOfProcess::RunOnSTA(base::OnceClosure callback) {
void ControlServiceProxy::RunOnSTA(base::OnceClosure callback) {
DCHECK(com_task_runner_->BelongsToCurrentThread());
Microsoft::WRL::ComPtr<IUnknown> server;
......@@ -194,14 +194,13 @@ void ControlServiceOutOfProcess::RunOnSTA(base::OnceClosure callback) {
}
}
void ControlServiceOutOfProcess::InitializeUpdateService(
base::OnceClosure callback) {
void ControlServiceProxy::InitializeUpdateService(base::OnceClosure callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
com_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&ControlServiceOutOfProcess::InitializeUpdateServiceOnSTA, this,
&ControlServiceProxy::InitializeUpdateServiceOnSTA, this,
base::BindOnce(
[](scoped_refptr<base::SequencedTaskRunner> taskrunner,
base::OnceClosure callback) {
......@@ -211,7 +210,7 @@ void ControlServiceOutOfProcess::InitializeUpdateService(
base::SequencedTaskRunnerHandle::Get(), std::move(callback))));
}
void ControlServiceOutOfProcess::InitializeUpdateServiceOnSTA(
void ControlServiceProxy::InitializeUpdateServiceOnSTA(
base::OnceClosure callback) {
DCHECK(com_task_runner_->BelongsToCurrentThread());
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_UPDATER_WIN_CONTROL_SERVICE_OUT_OF_PROCESS_H_
#define CHROME_UPDATER_WIN_CONTROL_SERVICE_OUT_OF_PROCESS_H_
#ifndef CHROME_UPDATER_WIN_CONTROL_SERVICE_PROXY_H_
#define CHROME_UPDATER_WIN_CONTROL_SERVICE_PROXY_H_
#include "base/callback_forward.h"
#include "base/memory/scoped_refptr.h"
......@@ -18,9 +18,9 @@ class SingleThreadTaskRunner;
namespace updater {
// All functions and callbacks must be called on the same sequence.
class ControlServiceOutOfProcess : public ControlService {
class ControlServiceProxy : public ControlService {
public:
explicit ControlServiceOutOfProcess(ServiceScope scope);
explicit ControlServiceProxy(ServiceScope scope);
// Overrides for ControlService.
void Run(base::OnceClosure callback) override;
......@@ -28,7 +28,7 @@ class ControlServiceOutOfProcess : public ControlService {
void Uninitialize() override;
private:
~ControlServiceOutOfProcess() override;
~ControlServiceProxy() override;
// These function are invoked on the |com_task_runner_|.
void RunOnSTA(base::OnceClosure callback);
......@@ -44,4 +44,4 @@ class ControlServiceOutOfProcess : public ControlService {
} // namespace updater
#endif // CHROME_UPDATER_WIN_CONTROL_SERVICE_OUT_OF_PROCESS_H_
#endif // CHROME_UPDATER_WIN_CONTROL_SERVICE_PROXY_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/updater/win/update_service_out_of_process.h"
#include "chrome/updater/win/update_service_proxy.h"
#include <windows.h>
#include <wrl/client.h>
......@@ -271,23 +271,23 @@ void UpdaterObserver::OnCompleteOnSTA(const UpdateService::Result& result) {
base::BindOnce(std::move(callback_), result));
}
UpdateServiceOutOfProcess::UpdateServiceOutOfProcess(ServiceScope service_scope)
UpdateServiceProxy::UpdateServiceProxy(ServiceScope service_scope)
: main_task_runner_(base::SequencedTaskRunnerHandle::Get()),
com_task_runner_(
base::ThreadPool::CreateCOMSTATaskRunner(kComClientTraits)) {
DCHECK_EQ(service_scope, ServiceScope::kUser);
}
UpdateServiceOutOfProcess::~UpdateServiceOutOfProcess() = default;
UpdateServiceProxy::~UpdateServiceProxy() = default;
void UpdateServiceOutOfProcess::GetVersion(
void UpdateServiceProxy::GetVersion(
base::OnceCallback<void(const base::Version&)> callback) const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
com_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&UpdateServiceOutOfProcess::GetVersionOnSTA, this,
&UpdateServiceProxy::GetVersionOnSTA, this,
base::BindOnce(
[](scoped_refptr<base::SequencedTaskRunner> taskrunner,
base::OnceCallback<void(const base::Version&)> callback,
......@@ -298,15 +298,15 @@ void UpdateServiceOutOfProcess::GetVersion(
base::SequencedTaskRunnerHandle::Get(), std::move(callback))));
}
void UpdateServiceOutOfProcess::RegisterApp(
void UpdateServiceProxy::RegisterApp(
const RegistrationRequest& request,
base::OnceCallback<void(const RegistrationResponse&)> callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
NOTREACHED();
}
void UpdateServiceOutOfProcess::UpdateAll(StateChangeCallback state_update,
Callback callback) {
void UpdateServiceProxy::UpdateAll(StateChangeCallback state_update,
Callback callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Reposts the call to the COM task runner. Adapts |callback| so that
......@@ -314,7 +314,7 @@ void UpdateServiceOutOfProcess::UpdateAll(StateChangeCallback state_update,
com_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&UpdateServiceOutOfProcess::UpdateAllOnSTA, this, state_update,
&UpdateServiceProxy::UpdateAllOnSTA, this, state_update,
base::BindOnce(
[](scoped_refptr<base::SequencedTaskRunner> taskrunner,
Callback callback, Result result) {
......@@ -324,10 +324,10 @@ void UpdateServiceOutOfProcess::UpdateAll(StateChangeCallback state_update,
base::SequencedTaskRunnerHandle::Get(), std::move(callback))));
}
void UpdateServiceOutOfProcess::Update(const std::string& app_id,
UpdateService::Priority /*priority*/,
StateChangeCallback state_update,
Callback callback) {
void UpdateServiceProxy::Update(const std::string& app_id,
UpdateService::Priority /*priority*/,
StateChangeCallback state_update,
Callback callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Reposts the call to the COM task runner. Adapts |callback| so that
......@@ -335,7 +335,7 @@ void UpdateServiceOutOfProcess::Update(const std::string& app_id,
com_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&UpdateServiceOutOfProcess::UpdateOnSTA, this, app_id,
&UpdateServiceProxy::UpdateOnSTA, this, app_id,
base::BindRepeating(
[](scoped_refptr<base::SequencedTaskRunner> taskrunner,
StateChangeCallback state_update, UpdateState update_state) {
......@@ -352,11 +352,11 @@ void UpdateServiceOutOfProcess::Update(const std::string& app_id,
base::SequencedTaskRunnerHandle::Get(), std::move(callback))));
}
void UpdateServiceOutOfProcess::Uninitialize() {
void UpdateServiceProxy::Uninitialize() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
void UpdateServiceOutOfProcess::GetVersionOnSTA(
void UpdateServiceProxy::GetVersionOnSTA(
base::OnceCallback<void(const base::Version&)> callback) const {
DCHECK(com_task_runner_->BelongsToCurrentThread());
......@@ -379,8 +379,8 @@ void UpdateServiceOutOfProcess::GetVersionOnSTA(
std::move(callback).Run(base::Version(base::WideToUTF8(version.Get())));
}
void UpdateServiceOutOfProcess::UpdateAllOnSTA(StateChangeCallback state_update,
Callback callback) {
void UpdateServiceProxy::UpdateAllOnSTA(StateChangeCallback state_update,
Callback callback) {
DCHECK(com_task_runner_->BelongsToCurrentThread());
Microsoft::WRL::ComPtr<IUpdater> updater;
......@@ -414,9 +414,9 @@ void UpdateServiceOutOfProcess::UpdateAllOnSTA(StateChangeCallback state_update,
}
}
void UpdateServiceOutOfProcess::UpdateOnSTA(const std::string& app_id,
StateChangeCallback state_update,
Callback callback) {
void UpdateServiceProxy::UpdateOnSTA(const std::string& app_id,
StateChangeCallback state_update,
Callback callback) {
DCHECK(com_task_runner_->BelongsToCurrentThread());
Microsoft::WRL::ComPtr<IUpdater> updater;
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_UPDATER_WIN_UPDATE_SERVICE_OUT_OF_PROCESS_H_
#define CHROME_UPDATER_WIN_UPDATE_SERVICE_OUT_OF_PROCESS_H_
#ifndef CHROME_UPDATER_WIN_UPDATE_SERVICE_PROXY_H_
#define CHROME_UPDATER_WIN_UPDATE_SERVICE_PROXY_H_
#include <string>
......@@ -33,9 +33,9 @@ namespace updater {
// through the task runner.
// All public functions and callbacks must be called on the same sequence.
class UpdateServiceOutOfProcess : public UpdateService {
class UpdateServiceProxy : public UpdateService {
public:
explicit UpdateServiceOutOfProcess(ServiceScope service_scope);
explicit UpdateServiceProxy(ServiceScope service_scope);
// Overrides for updater::UpdateService.
void GetVersion(
......@@ -51,7 +51,7 @@ class UpdateServiceOutOfProcess : public UpdateService {
void Uninitialize() override;
private:
~UpdateServiceOutOfProcess() override;
~UpdateServiceProxy() override;
// These functions runs on the |com_task_runner_|.
void GetVersionOnSTA(
......@@ -74,4 +74,4 @@ class UpdateServiceOutOfProcess : public UpdateService {
} // namespace updater
#endif // CHROME_UPDATER_WIN_UPDATE_SERVICE_OUT_OF_PROCESS_H_
#endif // CHROME_UPDATER_WIN_UPDATE_SERVICE_PROXY_H_
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