Commit 16bfb75b authored by Fabrice de Gans-Riberi's avatar Fabrice de Gans-Riberi Committed by Chromium LUCI CQ

[fuchsia] Remove the fuchsia sub-namespace from some base classes

This removes the fuchsia sub-namespace from the following classes:
-ScopedServiceBinging
-ScopedServicePublisher
-ServiceDirectoryTestBase

A ::base::fuchsia pseudonym is left in place for these classes for the
duration of the transition.

In addition, this CL removes an unused source file.

Bug: 1073821
Change-Id: I2c0bb6215e9bc073ec03b37834a887457ebcff38
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2602596
Commit-Queue: Fabrice de Gans-Riberi <fdegans@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843144}
parent 715c158b
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/fuchsia/scoped_service_binding.h"
#include <lib/sys/cpp/outgoing_directory.h>
#include <lib/vfs/cpp/pseudo_dir.h>
#include <lib/vfs/cpp/service.h>
namespace base {
namespace fuchsia {
namespace internal {
ScopedServiceBindingBase::ScopedServiceBindingBase(
sys::OutgoingDirectory* outgoing_directory)
: ScopedServiceBindingBase(
outgoing_directory->GetOrCreateDirectory("svc")) {}
ScopedServiceBindingBase::ScopedServiceBindingBase(vfs::PseudoDir* pseudo_dir)
: pseudo_dir_(pseudo_dir) {}
ScopedServiceBindingBase::~ScopedServiceBindingBase() = default;
void ScopedServiceBindingBase::RegisterService(const char* service_name,
Connector connector) {
pseudo_dir_->AddEntry(service_name,
std::make_unique<vfs::Service>(std::move(connector)));
}
void ScopedServiceBindingBase::UnregisterService(const char* service_name) {
pseudo_dir_->RemoveEntry(service_name);
}
} // namespace internal
} // namespace fuchsia
} // namespace base
...@@ -24,7 +24,6 @@ class PseudoDir; ...@@ -24,7 +24,6 @@ class PseudoDir;
} // namespace vfs } // namespace vfs
namespace base { namespace base {
namespace fuchsia {
template <typename Interface> template <typename Interface>
class BASE_EXPORT ScopedServiceBinding { class BASE_EXPORT ScopedServiceBinding {
...@@ -123,7 +122,21 @@ class BASE_EXPORT ScopedSingleClientServiceBinding { ...@@ -123,7 +122,21 @@ class BASE_EXPORT ScopedSingleClientServiceBinding {
DISALLOW_COPY_AND_ASSIGN(ScopedSingleClientServiceBinding); DISALLOW_COPY_AND_ASSIGN(ScopedSingleClientServiceBinding);
}; };
// 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 {
template <typename Interface>
using ScopedServiceBinding = ::base::ScopedServiceBinding<Interface>;
template <typename Interface,
ScopedServiceBindingPolicy Policy =
ScopedServiceBindingPolicy::kPreferNew>
using ScopedSingleClientServiceBinding =
ScopedSingleClientServiceBinding<Interface, Policy>;
} // namespace fuchsia } // namespace fuchsia
} // namespace base } // namespace base
#endif // BASE_FUCHSIA_SCOPED_SERVICE_BINDING_H_ #endif // BASE_FUCHSIA_SCOPED_SERVICE_BINDING_H_
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace base { namespace base {
namespace fuchsia {
class ScopedServiceBindingTest : public ServiceDirectoryTestBase {}; class ScopedServiceBindingTest : public ServiceDirectoryTestBase {};
...@@ -220,5 +219,4 @@ TEST_F(MultiUseBindingTest, MultipleLastClientCallback) { ...@@ -220,5 +219,4 @@ TEST_F(MultiUseBindingTest, MultipleLastClientCallback) {
EXPECT_EQ(disconnect_count_, 2); EXPECT_EQ(disconnect_count_, 2);
} }
} // namespace fuchsia
} // namespace base } // namespace base
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
namespace base { namespace base {
namespace fuchsia {
template <typename Interface> template <typename Interface>
class BASE_EXPORT ScopedServicePublisher { class BASE_EXPORT ScopedServicePublisher {
...@@ -48,7 +47,15 @@ class BASE_EXPORT ScopedServicePublisher { ...@@ -48,7 +47,15 @@ class BASE_EXPORT ScopedServicePublisher {
DISALLOW_COPY_AND_ASSIGN(ScopedServicePublisher); DISALLOW_COPY_AND_ASSIGN(ScopedServicePublisher);
}; };
// 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 {
template <typename Interface>
using ScopedServicePublisher = ::base::ScopedServicePublisher<Interface>;
} // namespace fuchsia } // namespace fuchsia
} // namespace base } // namespace base
#endif // BASE_FUCHSIA_SCOPED_SERVICE_PUBLISHER_H_ #endif // BASE_FUCHSIA_SCOPED_SERVICE_PUBLISHER_H_
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace base { namespace base {
namespace fuchsia {
class ScopedServicePublisherTest : public ServiceDirectoryTestBase {}; class ScopedServicePublisherTest : public ServiceDirectoryTestBase {};
...@@ -42,5 +41,4 @@ TEST_F(ScopedServicePublisherTest, DestructorRemovesService) { ...@@ -42,5 +41,4 @@ TEST_F(ScopedServicePublisherTest, DestructorRemovesService) {
VerifyTestInterface(&new_client, ZX_ERR_PEER_CLOSED); VerifyTestInterface(&new_client, ZX_ERR_PEER_CLOSED);
} }
} // namespace fuchsia
} // namespace base } // namespace base
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "base/test/test_timeouts.h" #include "base/test/test_timeouts.h"
namespace base { namespace base {
namespace fuchsia {
ServiceDirectoryTestBase::ServiceDirectoryTestBase() ServiceDirectoryTestBase::ServiceDirectoryTestBase()
: run_timeout_(FROM_HERE, TestTimeouts::action_timeout()) { : run_timeout_(FROM_HERE, TestTimeouts::action_timeout()) {
...@@ -78,5 +77,4 @@ void ServiceDirectoryTestBase::VerifyTestInterface( ...@@ -78,5 +77,4 @@ void ServiceDirectoryTestBase::VerifyTestInterface(
stub->set_error_handler(nullptr); stub->set_error_handler(nullptr);
} }
} // namespace fuchsia
} // namespace base } // namespace base
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace base { namespace base {
namespace fuchsia {
class ServiceDirectoryTestBase : public testing::Test { class ServiceDirectoryTestBase : public testing::Test {
public: public:
...@@ -46,7 +45,14 @@ class ServiceDirectoryTestBase : public testing::Test { ...@@ -46,7 +45,14 @@ class ServiceDirectoryTestBase : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(ServiceDirectoryTestBase); DISALLOW_COPY_AND_ASSIGN(ServiceDirectoryTestBase);
}; };
// TODO(crbug.com/1073821): Remove this block when all callers have been changed
// to use the non-fuchsia-sub-namespace version.
namespace fuchsia {
using ServiceDirectoryTestBase = ::base::ServiceDirectoryTestBase;
} // namespace fuchsia } // namespace fuchsia
} // namespace base } // namespace base
#endif // BASE_FUCHSIA_SERVICE_DIRECTORY_TEST_BASE_H_ #endif // BASE_FUCHSIA_SERVICE_DIRECTORY_TEST_BASE_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