Commit 98f6ea73 authored by Kevin Marshall's avatar Kevin Marshall Committed by Commit Bot

[fuchsia] Fix threading for FilteredServiceDirectory connect call.

Previously, ChildProcessLauncherHelper would bind a ServiceDirectory
connection on the launcher thread. The binding would attach to the
asynchronous dispatcher of the launcher task runner's thread,
rather than the client thread. This generated some test flakiness
during test teardown.

This CL moves the ServiceDirectory binding call so that it runs
in the client thread instead.

Bug: 876894
Change-Id: I53e05d79a24ab8347e3df697f65f84601f618f40
Reviewed-on: https://chromium-review.googlesource.com/1187125
Commit-Queue: Wez <wez@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585667}
parent 817178cd
...@@ -80,6 +80,11 @@ void SandboxPolicyFuchsia::Initialize(service_manager::SandboxType type) { ...@@ -80,6 +80,11 @@ void SandboxPolicyFuchsia::Initialize(service_manager::SandboxType type) {
base::fuchsia::ComponentContext::GetDefault()); base::fuchsia::ComponentContext::GetDefault());
for (const char* service_name : services_list) for (const char* service_name : services_list)
service_directory_->AddService(service_name); service_directory_->AddService(service_name);
// Bind the service directory and store the client channel for
// UpdateLaunchOptionsForSandbox()'s use.
service_directory_client_channel_ = service_directory_->ConnectClient();
CHECK(service_directory_client_channel_);
} }
} }
...@@ -110,7 +115,7 @@ void SandboxPolicyFuchsia::UpdateLaunchOptionsForSandbox( ...@@ -110,7 +115,7 @@ void SandboxPolicyFuchsia::UpdateLaunchOptionsForSandbox(
if (service_directory_) { if (service_directory_) {
// Provide the child process with a restricted set of services. // Provide the child process with a restricted set of services.
options->paths_to_transfer.push_back(base::PathToTransfer{ options->paths_to_transfer.push_back(base::PathToTransfer{
base::FilePath("/svc"), service_directory_->ConnectClient().release()}); base::FilePath("/svc"), service_directory_client_channel_.release()});
} }
} }
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef CONTENT_COMMON_SANDBOX_POLICY_FUCHSIA_H_ #ifndef CONTENT_COMMON_SANDBOX_POLICY_FUCHSIA_H_
#define CONTENT_COMMON_SANDBOX_POLICY_FUCHSIA_H_ #define CONTENT_COMMON_SANDBOX_POLICY_FUCHSIA_H_
#include <lib/zx/channel.h>
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "services/service_manager/sandbox/sandbox_type.h" #include "services/service_manager/sandbox/sandbox_type.h"
...@@ -40,6 +42,7 @@ class SandboxPolicyFuchsia { ...@@ -40,6 +42,7 @@ class SandboxPolicyFuchsia {
// Services directory used for the /svc namespace of the child process. // Services directory used for the /svc namespace of the child process.
std::unique_ptr<base::fuchsia::FilteredServiceDirectory> service_directory_; std::unique_ptr<base::fuchsia::FilteredServiceDirectory> service_directory_;
zx::channel service_directory_client_channel_;
scoped_refptr<base::SequencedTaskRunner> service_directory_task_runner_; scoped_refptr<base::SequencedTaskRunner> service_directory_task_runner_;
}; };
......
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