Commit dd1de5b5 authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Commit Bot

Migrate cleaner_engine_requests.mojom to the new Mojo types

Convert the implementation and all users of the
chrome_cleaner::mojom::CleanerEngineRequests interface.

Bug: 955171
Change-Id: Ic89e56e567b1d357fb994f5636cd62adbfb4c8c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1855922
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Reviewed-by: default avatarEmily Stark <estark@chromium.org>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarJoe Mason <joenotcharles@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711539}
parent 730add3a
......@@ -34,16 +34,15 @@ CleanerEngineRequestsImpl::CleanerEngineRequestsImpl(
InterfaceMetadataObserver* metadata_observer,
std::unique_ptr<chrome_cleaner::FileRemoverAPI> file_remover)
: mojo_task_runner_(mojo_task_runner),
binding_(this),
metadata_observer_(metadata_observer),
file_remover_(std::move(file_remover)) {}
CleanerEngineRequestsImpl::~CleanerEngineRequestsImpl() = default;
void CleanerEngineRequestsImpl::Bind(
mojom::CleanerEngineRequestsAssociatedPtrInfo* ptr_info) {
binding_.Bind(mojo::MakeRequest(ptr_info));
// There's no need to call set_connection_error_handler on this since it's an
mojo::PendingAssociatedRemote<mojom::CleanerEngineRequests>* remote) {
receiver_.Bind(remote->InitWithNewEndpointAndPassReceiver());
// There's no need to call set_disconnect_handler on this since it's an
// associated interface. Any errors will be handled on the main EngineCommands
// interface.
}
......
......@@ -12,11 +12,12 @@
#include "base/strings/string16.h"
#include "chrome/chrome_cleaner/engines/broker/cleaner_sandbox_interface.h"
#include "chrome/chrome_cleaner/engines/broker/interface_metadata_observer.h"
#include "chrome/chrome_cleaner/mojom/cleaner_engine_requests.mojom.h"
#include "chrome/chrome_cleaner/ipc/mojo_task_runner.h"
#include "chrome/chrome_cleaner/mojom/cleaner_engine_requests.mojom.h"
#include "chrome/chrome_cleaner/os/file_remover_api.h"
#include "chrome/chrome_cleaner/zip_archiver/zip_archiver.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
namespace chrome_cleaner {
......@@ -33,7 +34,8 @@ class CleanerEngineRequestsImpl : public mojom::CleanerEngineRequests {
std::unique_ptr<chrome_cleaner::FileRemoverAPI> file_remover);
~CleanerEngineRequestsImpl() override;
void Bind(mojom::CleanerEngineRequestsAssociatedPtrInfo* ptr_info);
void Bind(
mojo::PendingAssociatedRemote<mojom::CleanerEngineRequests>* remote);
// mojom::CleanerEngineRequests
void SandboxDeleteFile(const base::FilePath& file_name,
......@@ -74,7 +76,7 @@ class CleanerEngineRequestsImpl : public mojom::CleanerEngineRequests {
bool TerminateProcess(uint32_t process_id);
scoped_refptr<MojoTaskRunner> mojo_task_runner_;
mojo::AssociatedBinding<mojom::CleanerEngineRequests> binding_;
mojo::AssociatedReceiver<mojom::CleanerEngineRequests> receiver_{this};
InterfaceMetadataObserver* metadata_observer_ = nullptr;
std::unique_ptr<chrome_cleaner::FileRemoverAPI> file_remover_;
};
......
......@@ -414,8 +414,9 @@ void EngineClient::StartCleanupAsync(const std::vector<UwSId>& enabled_uws,
mojo::PendingAssociatedRemote<mojom::EngineRequests> engine_requests;
sandbox_requests_->Bind(&engine_requests);
mojom::CleanerEngineRequestsAssociatedPtrInfo cleaner_engine_requests_info;
sandbox_cleaner_requests_->Bind(&cleaner_engine_requests_info);
mojo::PendingAssociatedRemote<mojom::CleanerEngineRequests>
cleaner_engine_requests;
sandbox_cleaner_requests_->Bind(&cleaner_engine_requests);
// Create a receiver to the EngineCleanupResults interface that will receive
// results and pass them on to |done_callback|.
......@@ -429,7 +430,7 @@ void EngineClient::StartCleanupAsync(const std::vector<UwSId>& enabled_uws,
(*engine_commands_)
->StartCleanup(
enabled_uws, std::move(file_requests), std::move(engine_requests),
std::move(cleaner_engine_requests_info), std::move(cleanup_results),
std::move(cleaner_engine_requests), std::move(cleanup_results),
CallbackWithErrorHandling(std::move(result_callback)));
}
......
......@@ -21,7 +21,6 @@ CleanerEngineRequestsImpl::CleanerEngineRequestsImpl(
InterfaceMetadataObserver* metadata_observer,
std::unique_ptr<chrome_cleaner::FileRemoverAPI> file_remover)
: mojo_task_runner_(mojo_task_runner),
binding_(this),
metadata_observer_(metadata_observer),
file_remover_(std::move(file_remover)) {
ANALYZER_ALLOW_UNUSED(metadata_observer_);
......@@ -30,9 +29,9 @@ CleanerEngineRequestsImpl::CleanerEngineRequestsImpl(
CleanerEngineRequestsImpl::~CleanerEngineRequestsImpl() = default;
void CleanerEngineRequestsImpl::Bind(
mojom::CleanerEngineRequestsAssociatedPtrInfo* ptr_info) {
binding_.Bind(mojo::MakeRequest(ptr_info));
// There's no need to call set_connection_error_handler on this since it's an
mojo::PendingAssociatedRemote<mojom::CleanerEngineRequests>* remote) {
receiver_.Bind(remote->InitWithNewEndpointAndPassReceiver());
// There's no need to call set_disconnect_handler on this since it's an
// associated interface. Any errors will be handled on the main EngineCommands
// interface.
}
......
......@@ -26,12 +26,12 @@ void SaveBoolCallback(bool* out_result,
} // namespace
CleanerEngineRequestsProxy::CleanerEngineRequestsProxy(
mojom::CleanerEngineRequestsAssociatedPtr requests_ptr,
mojo::PendingAssociatedRemote<mojom::CleanerEngineRequests> requests,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: requests_ptr_(std::move(requests_ptr)), task_runner_(task_runner) {}
: requests_(std::move(requests)), task_runner_(task_runner) {}
void CleanerEngineRequestsProxy::UnbindRequestsPtr() {
requests_ptr_.reset();
void CleanerEngineRequestsProxy::UnbindRequestsRemote() {
requests_.reset();
}
bool CleanerEngineRequestsProxy::DeleteFile(const base::FilePath& file_name) {
......@@ -150,12 +150,12 @@ CleanerEngineRequestsProxy::~CleanerEngineRequestsProxy() = default;
MojoCallStatus CleanerEngineRequestsProxy::SandboxDeleteFile(
const base::FilePath& path,
mojom::CleanerEngineRequests::SandboxDeleteFileCallback result_callback) {
if (!requests_ptr_.is_bound()) {
LOG(ERROR) << "SandboxDeleteFile called without bound pointer";
if (!requests_.is_bound()) {
LOG(ERROR) << "SandboxDeleteFile called without bound remote";
return MojoCallStatus::Failure(SandboxErrorCode::INTERNAL_ERROR);
}
requests_ptr_->SandboxDeleteFile(path, std::move(result_callback));
requests_->SandboxDeleteFile(path, std::move(result_callback));
return MojoCallStatus::Success();
}
......@@ -163,12 +163,12 @@ MojoCallStatus CleanerEngineRequestsProxy::SandboxDeleteFilePostReboot(
const base::FilePath& path,
mojom::CleanerEngineRequests::SandboxDeleteFilePostRebootCallback
result_callback) {
if (!requests_ptr_.is_bound()) {
LOG(ERROR) << "SandboxDeleteFilePostReboot called without bound pointer";
if (!requests_.is_bound()) {
LOG(ERROR) << "SandboxDeleteFilePostReboot called without bound remote";
return MojoCallStatus::Failure(SandboxErrorCode::INTERNAL_ERROR);
}
requests_ptr_->SandboxDeleteFilePostReboot(path, std::move(result_callback));
requests_->SandboxDeleteFilePostReboot(path, std::move(result_callback));
return MojoCallStatus::Success();
}
......@@ -176,12 +176,12 @@ MojoCallStatus CleanerEngineRequestsProxy::SandboxNtDeleteRegistryKey(
const String16EmbeddedNulls& key,
mojom::CleanerEngineRequests::SandboxNtDeleteRegistryKeyCallback
result_callback) {
if (!requests_ptr_.is_bound()) {
LOG(ERROR) << "SandboxNtDeleteRegistryKey called without bound pointer";
if (!requests_.is_bound()) {
LOG(ERROR) << "SandboxNtDeleteRegistryKey called without bound remote";
return MojoCallStatus::Failure(SandboxErrorCode::INTERNAL_ERROR);
}
requests_ptr_->SandboxNtDeleteRegistryKey(key, std::move(result_callback));
requests_->SandboxNtDeleteRegistryKey(key, std::move(result_callback));
return MojoCallStatus::Success();
}
......@@ -190,12 +190,12 @@ MojoCallStatus CleanerEngineRequestsProxy::SandboxNtDeleteRegistryValue(
const String16EmbeddedNulls& value_name,
mojom::CleanerEngineRequests::SandboxNtDeleteRegistryValueCallback
result_callback) {
if (!requests_ptr_.is_bound()) {
LOG(ERROR) << "SandboxNtDeleteRegistryValue called without bound pointer";
if (!requests_.is_bound()) {
LOG(ERROR) << "SandboxNtDeleteRegistryValue called without bound remote";
return MojoCallStatus::Failure(SandboxErrorCode::INTERNAL_ERROR);
}
requests_ptr_->SandboxNtDeleteRegistryValue(key, value_name,
requests_->SandboxNtDeleteRegistryValue(key, value_name,
std::move(result_callback));
return MojoCallStatus::Success();
}
......@@ -206,12 +206,12 @@ MojoCallStatus CleanerEngineRequestsProxy::SandboxNtChangeRegistryValue(
const String16EmbeddedNulls& new_value,
mojom::CleanerEngineRequests::SandboxNtChangeRegistryValueCallback
result_callback) {
if (!requests_ptr_.is_bound()) {
LOG(ERROR) << "SandboxNtChangeRegistryValue called without bound pointer";
if (!requests_.is_bound()) {
LOG(ERROR) << "SandboxNtChangeRegistryValue called without bound remote";
return MojoCallStatus::Failure(SandboxErrorCode::INTERNAL_ERROR);
}
requests_ptr_->SandboxNtChangeRegistryValue(key, value_name, new_value,
requests_->SandboxNtChangeRegistryValue(key, value_name, new_value,
std::move(result_callback));
return MojoCallStatus::Success();
......@@ -221,24 +221,24 @@ MojoCallStatus CleanerEngineRequestsProxy::SandboxDeleteService(
const base::string16& name,
mojom::CleanerEngineRequests::SandboxDeleteServiceCallback
result_callback) {
if (!requests_ptr_.is_bound()) {
LOG(ERROR) << "SandboxDeleteService called without bound pointer";
if (!requests_.is_bound()) {
LOG(ERROR) << "SandboxDeleteService called without bound remote";
return MojoCallStatus::Failure(SandboxErrorCode::INTERNAL_ERROR);
}
requests_ptr_->SandboxDeleteService(name, std::move(result_callback));
requests_->SandboxDeleteService(name, std::move(result_callback));
return MojoCallStatus::Success();
}
MojoCallStatus CleanerEngineRequestsProxy::SandboxDeleteTask(
const base::string16& name,
mojom::CleanerEngineRequests::SandboxDeleteTaskCallback result_callback) {
if (!requests_ptr_.is_bound()) {
LOG(ERROR) << "SandboxDeleteTask called without bound pointer";
if (!requests_.is_bound()) {
LOG(ERROR) << "SandboxDeleteTask called without bound remote";
return MojoCallStatus::Failure(SandboxErrorCode::INTERNAL_ERROR);
}
requests_ptr_->SandboxDeleteTask(name, std::move(result_callback));
requests_->SandboxDeleteTask(name, std::move(result_callback));
return MojoCallStatus::Success();
}
......@@ -246,13 +246,12 @@ MojoCallStatus CleanerEngineRequestsProxy::SandboxTerminateProcess(
uint32_t process_id,
mojom::CleanerEngineRequests::SandboxTerminateProcessCallback
result_callback) {
if (!requests_ptr_.is_bound()) {
LOG(ERROR) << "SandboxTerminateProcess called without bound pointer";
if (!requests_.is_bound()) {
LOG(ERROR) << "SandboxTerminateProcess called without bound remote";
return MojoCallStatus::Failure(SandboxErrorCode::INTERNAL_ERROR);
}
requests_ptr_->SandboxTerminateProcess(process_id,
std::move(result_callback));
requests_->SandboxTerminateProcess(process_id, std::move(result_callback));
return MojoCallStatus::Success();
}
......
......@@ -10,6 +10,8 @@
#include "base/single_thread_task_runner.h"
#include "chrome/chrome_cleaner/engines/target/sandbox_request_helper.h"
#include "chrome/chrome_cleaner/mojom/cleaner_engine_requests.mojom.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
namespace chrome_cleaner {
......@@ -17,7 +19,7 @@ class CleanerEngineRequestsProxy
: public base::RefCountedThreadSafe<CleanerEngineRequestsProxy> {
public:
CleanerEngineRequestsProxy(
mojom::CleanerEngineRequestsAssociatedPtr requests_ptr,
mojo::PendingAssociatedRemote<mojom::CleanerEngineRequests> requests,
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
// Implements synchronous callbacks to be called on arbitrary threads from the
......@@ -38,7 +40,7 @@ class CleanerEngineRequestsProxy
return task_runner_;
}
void UnbindRequestsPtr();
void UnbindRequestsRemote();
protected:
virtual ~CleanerEngineRequestsProxy();
......@@ -83,7 +85,7 @@ class CleanerEngineRequestsProxy
// A CleanerEngineRequests that will send the requests over the Mojo
// connection.
mojom::CleanerEngineRequestsAssociatedPtr requests_ptr_;
mojo::AssociatedRemote<mojom::CleanerEngineRequests> requests_;
// A task runner for the IPC thread.
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
......
......@@ -213,7 +213,7 @@ MULTIPROCESS_TEST_MAIN(DeleteTaskNoHang) {
scoped_refptr<CleanerEngineRequestsProxy> proxy(
child_process->GetCleanerEngineRequestsProxy());
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
TestTaskScheduler test_task_scheduler;
......@@ -294,7 +294,7 @@ MULTIPROCESS_TEST_MAIN(DeleteFileNoHang) {
scoped_refptr<CleanerEngineRequestsProxy> proxy(
child_process->GetCleanerEngineRequestsProxy());
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
EXPECT_FALSE(proxy->DeleteFile(
GetTestFilePath(child_process->command_line(), kTempFileName)));
......@@ -332,7 +332,7 @@ MULTIPROCESS_TEST_MAIN(DeleteFilePostRebootNoHang) {
scoped_refptr<CleanerEngineRequestsProxy> proxy(
child_process->GetCleanerEngineRequestsProxy());
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
EXPECT_FALSE(proxy->DeleteFilePostReboot(
GetTestFilePath(child_process->command_line(), kTempFileName)));
......@@ -440,7 +440,7 @@ MULTIPROCESS_TEST_MAIN(NtDeleteRegistryKeyNoHang) {
EXPECT_FALSE(proxy->NtDeleteRegistryKey(String16EmbeddedNulls(nullptr)));
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
EXPECT_FALSE(proxy->NtDeleteRegistryKey(
GetTestRegistryKeyPath(child_process->command_line())));
......@@ -477,7 +477,7 @@ MULTIPROCESS_TEST_MAIN(NtDeleteRegistryValueNoHang) {
EXPECT_FALSE(proxy->NtDeleteRegistryValue(String16EmbeddedNulls(nullptr),
GetTestRegistryValueName()));
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
EXPECT_FALSE(proxy->NtDeleteRegistryValue(
GetTestRegistryKeyPath(child_process->command_line()),
......@@ -533,7 +533,7 @@ MULTIPROCESS_TEST_MAIN(NtChangeRegistryValueNoHang) {
GetTestRegistryKeyPath(child_process->command_line()),
String16EmbeddedNulls(nullptr), new_value));
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
EXPECT_FALSE(proxy->NtChangeRegistryValue(
GetTestRegistryKeyPath(child_process->command_line()),
......@@ -607,7 +607,7 @@ MULTIPROCESS_TEST_MAIN(DeleteServiceNoHang) {
scoped_refptr<CleanerEngineRequestsProxy> proxy(
child_process->GetCleanerEngineRequestsProxy());
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
base::string16 service_name =
base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(
......@@ -756,7 +756,7 @@ MULTIPROCESS_TEST_MAIN(TerminateProcessNoHang) {
scoped_refptr<CleanerEngineRequestsProxy> proxy(
child_process->GetCleanerEngineRequestsProxy());
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
base::ProcessId pid = GetTestProcessId(child_process->command_line());
if (!pid) {
......
......@@ -18,9 +18,6 @@
namespace chrome_cleaner {
using mojom::CleanerEngineRequestsAssociatedPtr;
using mojom::CleanerEngineRequestsAssociatedPtrInfo;
namespace {
constexpr char kStageCrashKey[] = "stage";
......@@ -116,7 +113,7 @@ void EngineCommandsImpl::StartCleanup(
mojo::PendingAssociatedRemote<mojom::EngineFileRequests> file_requests,
mojo::PendingAssociatedRemote<mojom::EngineRequests>
sandboxed_engine_requests,
mojom::CleanerEngineRequestsAssociatedPtrInfo
mojo::PendingAssociatedRemote<mojom::CleanerEngineRequests>
sandboxed_cleaner_engine_requests,
mojo::PendingAssociatedRemote<mojom::EngineCleanupResults> cleanup_results,
StartCleanupCallback callback) {
......@@ -131,12 +128,9 @@ void EngineCommandsImpl::StartCleanup(
base::MakeRefCounted<EngineRequestsProxy>(
std::move(sandboxed_engine_requests), task_runner_);
CleanerEngineRequestsAssociatedPtr cleaner_engine_requests_ptr;
cleaner_engine_requests_ptr.Bind(
std::move(sandboxed_cleaner_engine_requests));
scoped_refptr<CleanerEngineRequestsProxy> cleaner_engine_requests_proxy =
base::MakeRefCounted<CleanerEngineRequestsProxy>(
std::move(cleaner_engine_requests_ptr), task_runner_);
std::move(sandboxed_cleaner_engine_requests), task_runner_);
// Create an EngineCleanupResults proxy to send results back over the
// Mojo connection.
......
......@@ -50,7 +50,7 @@ class EngineCommandsImpl : public mojom::EngineCommands {
mojo::PendingAssociatedRemote<mojom::EngineFileRequests> file_requests,
mojo::PendingAssociatedRemote<mojom::EngineRequests>
sandboxed_engine_requests,
mojom::CleanerEngineRequestsAssociatedPtrInfo
mojo::PendingAssociatedRemote<mojom::CleanerEngineRequests>
sandboxed_cleaner_engine_requests,
mojo::PendingAssociatedRemote<mojom::EngineCleanupResults>
cleanup_results,
......
......@@ -250,7 +250,7 @@ MULTIPROCESS_TEST_MAIN(FindFirstFileNoHangs) {
SandboxErrorCode::NULL_FIND_HANDLE,
proxy->FindFirstFile(child_process->valid_utf8_path(), &data, nullptr));
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
FindFileHandle handle;
EXPECT_EQ(SandboxErrorCode::INTERNAL_ERROR,
proxy->FindFirstFile(base::FilePath(L"Name"), &data, &handle));
......@@ -262,7 +262,7 @@ MULTIPROCESS_TEST_MAIN(FindNextFileNoHangs) {
auto child_process = SetupSandboxedChildProcess();
if (!child_process)
return 1;
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
scoped_refptr<EngineFileRequestsProxy> proxy(
child_process->GetFileRequestsProxy());
......@@ -279,7 +279,7 @@ MULTIPROCESS_TEST_MAIN(FindCloseNoHangs) {
auto child_process = SetupSandboxedChildProcess();
if (!child_process)
return 1;
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
scoped_refptr<EngineFileRequestsProxy> proxy(
child_process->GetFileRequestsProxy());
......@@ -346,7 +346,7 @@ MULTIPROCESS_TEST_MAIN(OpenReadOnlyFileNoHangs) {
proxy->OpenReadOnlyFile(base::FilePath(too_long), FILE_ATTRIBUTE_NORMAL)
.IsValid());
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
EXPECT_FALSE(proxy->OpenReadOnlyFile(base::FilePath(), FILE_ATTRIBUTE_NORMAL)
.IsValid());
......
......@@ -126,7 +126,7 @@ MULTIPROCESS_TEST_MAIN(GetFileAttributesNoHangs) {
if (!child_process)
return 1;
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
scoped_refptr<EngineRequestsProxy> proxy(
child_process->GetEngineRequestsProxy());
......@@ -187,7 +187,7 @@ MULTIPROCESS_TEST_MAIN(GetKnownFolderPathNoHangs) {
if (!child_process)
return 1;
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
scoped_refptr<EngineRequestsProxy> proxy(
child_process->GetEngineRequestsProxy());
......@@ -229,7 +229,7 @@ MULTIPROCESS_TEST_MAIN(GetProcessesNoHangs) {
auto child_process = SetupSandboxedChildProcess();
if (!child_process)
return 1;
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
scoped_refptr<EngineRequestsProxy> proxy(
child_process->GetEngineRequestsProxy());
......@@ -314,7 +314,7 @@ MULTIPROCESS_TEST_MAIN(GetTasksNoHangs) {
auto child_process = SetupSandboxedChildProcess();
if (!child_process)
return 1;
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
scoped_refptr<EngineRequestsProxy> proxy(
child_process->GetEngineRequestsProxy());
......@@ -356,7 +356,7 @@ MULTIPROCESS_TEST_MAIN(GetProcessImagePathNoHangs) {
auto child_process = SetupSandboxedChildProcess();
if (!child_process)
return 1;
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
scoped_refptr<EngineRequestsProxy> proxy(
child_process->GetEngineRequestsProxy());
......@@ -398,7 +398,7 @@ MULTIPROCESS_TEST_MAIN(GetLoadedModulesNoHangs) {
auto child_process = SetupSandboxedChildProcess();
if (!child_process)
return 1;
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
scoped_refptr<EngineRequestsProxy> proxy(
child_process->GetEngineRequestsProxy());
......@@ -437,7 +437,7 @@ MULTIPROCESS_TEST_MAIN(GetProcessCommandLineNoHangs) {
auto child_process = SetupSandboxedChildProcess();
if (!child_process)
return 1;
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
scoped_refptr<EngineRequestsProxy> proxy(
child_process->GetEngineRequestsProxy());
......@@ -481,7 +481,7 @@ MULTIPROCESS_TEST_MAIN(GetUserInfoFromSIDNoHangs) {
auto child_process = SetupSandboxedChildProcess();
if (!child_process)
return 1;
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
scoped_refptr<EngineRequestsProxy> proxy(
child_process->GetEngineRequestsProxy());
......@@ -556,7 +556,7 @@ MULTIPROCESS_TEST_MAIN(OpenReadOnlyRegistryNoHangs) {
SandboxErrorCode::NULL_ROOT_KEY,
proxy->OpenReadOnlyRegistry(nullptr, base::string16(), 0, &reg_handle));
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
EXPECT_EQ(
SandboxErrorCode::INTERNAL_ERROR,
......@@ -684,7 +684,7 @@ MULTIPROCESS_TEST_MAIN(NtOpenReadOnlyRegistryNoHangs) {
proxy->NtOpenReadOnlyRegistry(
nullptr, String16EmbeddedNulls(too_long), 0, &reg_handle));
child_process->UnbindRequestsPtrs();
child_process->UnbindRequestsRemotes();
EXPECT_EQ(SandboxErrorCode::INTERNAL_ERROR,
proxy->NtOpenReadOnlyRegistry(nullptr, String16EmbeddedNulls(), 0,
......
......@@ -77,7 +77,7 @@ class SandboxChildProcess::FakeEngineDelegate : public EngineDelegate {
return privileged_removal_calls_;
}
void UnbindRequestsPtrs() {
void UnbindRequestsRemotes() {
if (privileged_scan_calls_) {
privileged_scan_calls_->UnbindRequestsRemote();
}
......@@ -140,18 +140,18 @@ SandboxChildProcess::GetCleanerEngineRequestsProxy() {
return fake_engine_delegate_->GetCleanerEngineRequestsProxy();
}
void SandboxChildProcess::UnbindRequestsPtrs() {
void SandboxChildProcess::UnbindRequestsRemotes() {
base::SingleThreadTaskExecutor main_task_executor;
base::RunLoop run_loop;
if (GetCleanerEngineRequestsProxy() != nullptr) {
mojo_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&CleanerEngineRequestsProxy::UnbindRequestsPtr,
base::BindOnce(&CleanerEngineRequestsProxy::UnbindRequestsRemote,
GetCleanerEngineRequestsProxy()));
}
mojo_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&FakeEngineDelegate::UnbindRequestsPtrs,
FROM_HERE, base::BindOnce(&FakeEngineDelegate::UnbindRequestsRemotes,
fake_engine_delegate_));
mojo_task_runner_->PostTaskAndReply(FROM_HERE, base::DoNothing(),
......
......@@ -101,10 +101,10 @@ class MaybeSandboxedParentProcess : public BaseClass {
base::BindOnce(base::DoNothing::Once<uint32_t>()));
}
mojom::CleanerEngineRequestsAssociatedPtrInfo cleaner_info;
mojo::PendingAssociatedRemote<mojom::CleanerEngineRequests> cleaner;
mojo::PendingAssociatedRemote<mojom::EngineCleanupResults> cleanup_results;
if (requests_to_setup_ == CallbacksToSetup::kCleanupRequests) {
cleaner_impl_->Bind(&cleaner_info);
cleaner_impl_->Bind(&cleaner);
cleanup_results_impl_->BindToCallbacks(
&cleanup_results, base::BindOnce(base::DoNothing::Once<uint32_t>()));
}
......@@ -129,7 +129,7 @@ class MaybeSandboxedParentProcess : public BaseClass {
(*engine_commands_)
->StartCleanup(/*enabled_uws=*/std::vector<UwSId>(),
std::move(file_requests), std::move(scanner),
std::move(cleaner_info), std::move(cleanup_results),
std::move(cleaner), std::move(cleanup_results),
std::move(operation_started));
}
}
......@@ -172,7 +172,7 @@ class SandboxChildProcess : public ChildProcess {
scoped_refptr<EngineRequestsProxy> GetEngineRequestsProxy();
scoped_refptr<CleanerEngineRequestsProxy> GetCleanerEngineRequestsProxy();
void UnbindRequestsPtrs();
void UnbindRequestsRemotes();
// Exit code value to be used by the child process on connection errors.
static const int kConnectionErrorExitCode;
......
......@@ -72,7 +72,8 @@ interface EngineCommands {
array<uint32> enabled_uws,
pending_associated_remote<EngineFileRequests> file_requests,
pending_associated_remote<EngineRequests> sandboxed_engine_requests,
associated CleanerEngineRequests sandboxed_cleaner_engine_requests,
pending_associated_remote<CleanerEngineRequests>
sandboxed_cleaner_engine_requests,
pending_associated_remote<EngineCleanupResults> results) =>
(uint32 result_code);
......
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