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