Skip to content

Commit

Permalink
[fuchsia] Remove the fuchsia sub-namespace from FilteredServiceDirectory
Browse files Browse the repository at this point in the history
Bug: 1073821
Change-Id: I89a01ee8ebfd0154b1986fab965cb9bbf7f73e5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2432724
Commit-Queue: Fabrice de Gans-Riberi <fdegans@chromium.org>
Reviewed-by: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#848764}
  • Loading branch information
Steelskin authored and Chromium LUCI CQ committed Jan 29, 2021
1 parent 613246c commit 6542ddc
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 30 deletions.
2 changes: 0 additions & 2 deletions base/fuchsia/filtered_service_directory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "base/fuchsia/fuchsia_logging.h"

namespace base {
namespace fuchsia {

FilteredServiceDirectory::FilteredServiceDirectory(
sys::ServiceDirectory* directory)
Expand Down Expand Up @@ -40,5 +39,4 @@ void FilteredServiceDirectory::ConnectClient(
dir_request.TakeChannel());
}

} // namespace fuchsia
} // namespace base
8 changes: 7 additions & 1 deletion base/fuchsia/filtered_service_directory.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "base/strings/string_piece.h"

namespace base {
namespace fuchsia {

// ServiceDirectory that uses the supplied sys::ServiceDirectory to satisfy
// requests for only a restricted set of services.
Expand Down Expand Up @@ -47,7 +46,14 @@ class BASE_EXPORT FilteredServiceDirectory {
DISALLOW_COPY_AND_ASSIGN(FilteredServiceDirectory);
};

// TODO(crbug.com/1073821): Remove this block when out-of-tree callers have been
// changed to use the non-fuchsia-sub-namespace version.
namespace fuchsia {

using FilteredServiceDirectory = ::base::FilteredServiceDirectory;

} // namespace fuchsia

} // namespace base

#endif // BASE_FUCHSIA_FILTERED_SERVICE_DIRECTORY_H_
2 changes: 0 additions & 2 deletions base/fuchsia/filtered_service_directory_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "testing/gtest/include/gtest/gtest.h"

namespace base {
namespace fuchsia {

class FilteredServiceDirectoryTest : public ServiceDirectoryTestBase {
public:
Expand Down Expand Up @@ -85,5 +84,4 @@ TEST_F(FilteredServiceDirectoryTest, AdditionalService) {
VerifyTestInterface(&stub, ZX_OK);
}

} // namespace fuchsia
} // namespace base
2 changes: 1 addition & 1 deletion base/fuchsia/test_component_context_for_process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ TestComponentContextForProcess::TestComponentContextForProcess(

// Set up |incoming_services_| to use the ServiceDirectory from the current
// default ComponentContext to fetch services from.
context_services_ = std::make_unique<fuchsia::FilteredServiceDirectory>(
context_services_ = std::make_unique<FilteredServiceDirectory>(
base::ComponentContextForProcess()->svc().get());

// Push all services from /svc to the test context if requested.
Expand Down
4 changes: 1 addition & 3 deletions base/fuchsia/test_component_context_for_process.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ class ServiceDirectory;

namespace base {

namespace fuchsia {
class FilteredServiceDirectory;
} // namespace fuchsia

// Replaces the process-global sys::ComponentContext (as returned by the
// base::ComponentContextForProcess() function) with an empty instance which the
Expand Down Expand Up @@ -106,7 +104,7 @@ class BASE_EXPORT TestComponentContextForProcess {
private:
std::unique_ptr<sys::ComponentContext> old_context_;

std::unique_ptr<fuchsia::FilteredServiceDirectory> context_services_;
std::unique_ptr<FilteredServiceDirectory> context_services_;
std::unique_ptr<sys::ServiceDirectory> published_services_;
};

Expand Down
2 changes: 1 addition & 1 deletion fuchsia/engine/web_engine_integration_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ WebEngineIntegrationTestBase::DefaultContextParamsWithTestData() const {
fuchsia::web::CreateContextParams
WebEngineIntegrationTestBase::ContextParamsWithFilteredServiceDirectory() {
filtered_service_directory_ =
std::make_unique<base::fuchsia::FilteredServiceDirectory>(
std::make_unique<base::FilteredServiceDirectory>(
base::ComponentContextForProcess()->svc().get());
fidl::InterfaceHandle<fuchsia::io::Directory> svc_dir;
filtered_service_directory_->ConnectClient(svc_dir.NewRequest());
Expand Down
3 changes: 1 addition & 2 deletions fuchsia/engine/web_engine_integration_test_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ class WebEngineIntegrationTestBase : public testing::Test {
std::unique_ptr<fidl::Binding<fuchsia::web::NavigationEventListener>>
navigation_listener_binding_;

std::unique_ptr<base::fuchsia::FilteredServiceDirectory>
filtered_service_directory_;
std::unique_ptr<base::FilteredServiceDirectory> filtered_service_directory_;
};

#endif // FUCHSIA_ENGINE_WEB_ENGINE_INTEGRATION_TEST_BASE_H_
7 changes: 3 additions & 4 deletions fuchsia/runners/cast/cast_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,13 @@ class DataResetComponent : public fuchsia::sys::ComponentController,

CastRunner::CastRunner(bool is_headless)
: is_headless_(is_headless),
main_services_(std::make_unique<base::fuchsia::FilteredServiceDirectory>(
main_services_(std::make_unique<base::FilteredServiceDirectory>(
base::ComponentContextForProcess()->svc().get())),
main_context_(std::make_unique<WebContentRunner>(
base::BindRepeating(&CastRunner::GetMainContextParams,
base::Unretained(this)))),
isolated_services_(
std::make_unique<base::fuchsia::FilteredServiceDirectory>(
base::ComponentContextForProcess()->svc().get())) {
isolated_services_(std::make_unique<base::FilteredServiceDirectory>(
base::ComponentContextForProcess()->svc().get())) {
// Delete persisted data staged for deletion during the previous run.
DeleteStagedForDeletionDirectoryIfExists();

Expand Down
7 changes: 2 additions & 5 deletions fuchsia/runners/cast/cast_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
#include "fuchsia/runners/cast/pending_cast_component.h"

namespace base {
namespace fuchsia {
class FilteredServiceDirectory;
} // namespace fuchsia
} // namespace base

class WebContentRunner;
Expand Down Expand Up @@ -124,11 +122,10 @@ class CastRunner : public fuchsia::sys::Runner,
// Holds the main fuchsia.web.Context used to host CastComponents.
// Note that although |main_context_| is actually a WebContentRunner, that is
// only being used to maintain the Context for the hosted components.
const std::unique_ptr<base::fuchsia::FilteredServiceDirectory> main_services_;
const std::unique_ptr<base::FilteredServiceDirectory> main_services_;
const std::unique_ptr<WebContentRunner> main_context_;

const std::unique_ptr<base::fuchsia::FilteredServiceDirectory>
isolated_services_;
const std::unique_ptr<base::FilteredServiceDirectory> isolated_services_;

// Holds fuchsia.web.Contexts used to host isolated components.
base::flat_set<std::unique_ptr<WebContentRunner>, base::UniquePtrComparator>
Expand Down
5 changes: 2 additions & 3 deletions sandbox/policy/fuchsia/sandbox_policy_fuchsia.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,8 @@ SandboxPolicyFuchsia::SandboxPolicyFuchsia(SandboxType type) {
const SandboxConfig* config = GetConfigForSandboxType(type_);
if (config && !(config->features & kUseServiceDirectoryOverride)) {
service_directory_task_runner_ = base::ThreadTaskRunnerHandle::Get();
service_directory_ =
std::make_unique<base::fuchsia::FilteredServiceDirectory>(
base::ComponentContextForProcess()->svc().get());
service_directory_ = std::make_unique<base::FilteredServiceDirectory>(
base::ComponentContextForProcess()->svc().get());
for (const char* service_name : kDefaultServices) {
service_directory_->AddService(service_name);
}
Expand Down
8 changes: 2 additions & 6 deletions sandbox/policy/fuchsia/sandbox_policy_fuchsia.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@
#include "sandbox/policy/sandbox_type.h"

namespace base {
class FilteredServiceDirectory;
struct LaunchOptions;
class SequencedTaskRunner;

namespace fuchsia {
class FilteredServiceDirectory;
} // namespace fuchsia

} // namespace base

namespace sandbox {
Expand Down Expand Up @@ -48,7 +44,7 @@ class SANDBOX_POLICY_EXPORT SandboxPolicyFuchsia {
SandboxType type_;

// Services directory used for the /svc namespace of the child process.
std::unique_ptr<base::fuchsia::FilteredServiceDirectory> service_directory_;
std::unique_ptr<base::FilteredServiceDirectory> service_directory_;
fidl::InterfaceHandle<::fuchsia::io::Directory> service_directory_client_;
scoped_refptr<base::SequencedTaskRunner> service_directory_task_runner_;

Expand Down

0 comments on commit 6542ddc

Please sign in to comment.