Skip to content

Commit

Permalink
Remove DISALLOW_* macros from components/
Browse files Browse the repository at this point in the history
This inlines all remaining DISALLOW_* macros in components/. This is
done manually (vim regex + manually finding insertion position).

IWYU cleanup is left as a separate pass that is easier when these macros
go away.

Bug: 1010217
Change-Id: I2409b6250d85e74e8c4b6863fbeeaaeacc37733c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3194821
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#927361}
  • Loading branch information
pbos authored and Chromium LUCI CQ committed Oct 1, 2021
1 parent 7f8a311 commit 9f667c3
Show file tree
Hide file tree
Showing 814 changed files with 3,763 additions and 2,229 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ class ArcBrowserContextKeyedServiceFactoryBase
return GetForBrowserContext(context);
}

ArcBrowserContextKeyedServiceFactoryBase(
const ArcBrowserContextKeyedServiceFactoryBase&) = delete;
ArcBrowserContextKeyedServiceFactoryBase& operator=(
const ArcBrowserContextKeyedServiceFactoryBase&) = delete;

protected:
ArcBrowserContextKeyedServiceFactoryBase()
: BrowserContextKeyedServiceFactory(
Expand All @@ -130,9 +135,6 @@ class ArcBrowserContextKeyedServiceFactoryBase

return new Service(context, arc_service_manager->arc_bridge_service());
}

private:
DISALLOW_COPY_AND_ASSIGN(ArcBrowserContextKeyedServiceFactoryBase);
};

} // namespace internal
Expand Down
17 changes: 9 additions & 8 deletions components/arc/arc_features_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ struct ArcFeatures {
using BuildPropsMapping = std::map<std::string, std::string>;

ArcFeatures();
ArcFeatures(ArcFeatures&& other);
~ArcFeatures();

ArcFeatures(const ArcFeatures&) = delete;
ArcFeatures& operator=(const ArcFeatures&) = delete;

ArcFeatures(ArcFeatures&& other);
ArcFeatures& operator=(ArcFeatures&& other);

~ArcFeatures();

// This map contains all ARC system available features. For each feature, it
// has the name and version. Unavailable features have been filtered out from
// this map.
Expand All @@ -47,9 +51,6 @@ struct ArcFeatures {
BuildPropsMapping build_props;

std::string play_store_version;

private:
DISALLOW_COPY_AND_ASSIGN(ArcFeatures);
};

// Parses JSON files for Android system available features and build properties.
Expand Down Expand Up @@ -78,6 +79,9 @@ struct ArcFeatures {
// }
class ArcFeaturesParser {
public:
ArcFeaturesParser(const ArcFeaturesParser&) = delete;
ArcFeaturesParser& operator=(const ArcFeaturesParser&) = delete;

// Get ARC system available features.
static void GetArcFeatures(
base::OnceCallback<void(absl::optional<ArcFeatures>)> callback);
Expand All @@ -92,9 +96,6 @@ class ArcFeaturesParser {
// is called.
static void SetArcFeaturesGetterForTesting(
base::RepeatingCallback<absl::optional<ArcFeatures>()>* getter);

private:
DISALLOW_COPY_AND_ASSIGN(ArcFeaturesParser);
};

} // namespace arc
Expand Down
4 changes: 2 additions & 2 deletions components/arc/arc_features_parser_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class ArcFeaturesParserTest : public testing::Test {
public:
ArcFeaturesParserTest() = default;

private:
DISALLOW_COPY_AND_ASSIGN(ArcFeaturesParserTest);
ArcFeaturesParserTest(const ArcFeaturesParserTest&) = delete;
ArcFeaturesParserTest& operator=(const ArcFeaturesParserTest&) = delete;
};

constexpr const char kValidJson[] = R"json({"features": [
Expand Down
6 changes: 4 additions & 2 deletions components/arc/metrics/arc_metrics_service_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ void VerifyAnr(const base::HistogramTester& tester,
}

class ArcMetricsServiceTest : public testing::Test {
public:
ArcMetricsServiceTest(const ArcMetricsServiceTest&) = delete;
ArcMetricsServiceTest& operator=(const ArcMetricsServiceTest&) = delete;

protected:
ArcMetricsServiceTest() {
prefs::RegisterLocalStatePrefs(local_state_.registry());
Expand Down Expand Up @@ -163,8 +167,6 @@ class ArcMetricsServiceTest : public testing::Test {

std::unique_ptr<aura::Window> fake_arc_window_;
std::unique_ptr<aura::Window> fake_non_arc_window_;

DISALLOW_COPY_AND_ASSIGN(ArcMetricsServiceTest);
};

// Tests that ReportBootProgress() actually records UMA stats.
Expand Down
7 changes: 5 additions & 2 deletions components/arc/metrics/stability_metrics_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
namespace arc {

class StabilityMetricsManagerTest : public testing::Test {
public:
StabilityMetricsManagerTest(const StabilityMetricsManagerTest&) = delete;
StabilityMetricsManagerTest& operator=(const StabilityMetricsManagerTest&) =
delete;

protected:
StabilityMetricsManagerTest() {
prefs::RegisterLocalStatePrefs(local_state.registry());
Expand All @@ -28,8 +33,6 @@ class StabilityMetricsManagerTest : public testing::Test {

private:
TestingPrefServiceSimple local_state;

DISALLOW_COPY_AND_ASSIGN(StabilityMetricsManagerTest);
};

TEST_F(StabilityMetricsManagerTest, GetArcEnabledState) {
Expand Down
5 changes: 3 additions & 2 deletions components/arc/net/always_on_vpn_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class AlwaysOnVpnManagerTest : public testing::Test {
public:
AlwaysOnVpnManagerTest() = default;

AlwaysOnVpnManagerTest(const AlwaysOnVpnManagerTest&) = delete;
AlwaysOnVpnManagerTest& operator=(const AlwaysOnVpnManagerTest&) = delete;

void SetUp() override {
arc::prefs::RegisterProfilePrefs(pref_service()->registry());
}
Expand All @@ -67,8 +70,6 @@ class AlwaysOnVpnManagerTest : public testing::Test {
content::BrowserTaskEnvironment task_environment_;
chromeos::NetworkHandlerTestHelper network_handler_test_helper_;
TestingPrefServiceSimple pref_service_;

DISALLOW_COPY_AND_ASSIGN(AlwaysOnVpnManagerTest);
};

TEST_F(AlwaysOnVpnManagerTest, SetPackageWhileLockdownUnset) {
Expand Down
6 changes: 4 additions & 2 deletions components/arc/net/arc_net_host_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ namespace arc {
namespace {

class ArcNetHostImplTest : public testing::Test {
public:
ArcNetHostImplTest(const ArcNetHostImplTest&) = delete;
ArcNetHostImplTest& operator=(const ArcNetHostImplTest&) = delete;

protected:
ArcNetHostImplTest()
: arc_service_manager_(std::make_unique<ArcServiceManager>()),
Expand All @@ -39,8 +43,6 @@ class ArcNetHostImplTest : public testing::Test {
TestingPrefServiceSimple pref_service_;
std::unique_ptr<TestBrowserContext> context_;
ArcNetHostImpl* const service_;

DISALLOW_COPY_AND_ASSIGN(ArcNetHostImplTest);
};

TEST_F(ArcNetHostImplTest, SetAlwaysOnVpn_SetPackage) {
Expand Down
5 changes: 4 additions & 1 deletion components/arc/session/arc_bridge_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ class ArcBridgeService {
};

ArcBridgeService();

ArcBridgeService(const ArcBridgeService&) = delete;
ArcBridgeService& operator=(const ArcBridgeService&) = delete;

~ArcBridgeService();

// Adds or removes observers.
Expand Down Expand Up @@ -417,7 +421,6 @@ class ArcBridgeService {
ConnectionHolder<mojom::WakeLockInstance, mojom::WakeLockHost> wake_lock_;
ConnectionHolder<mojom::WallpaperInstance, mojom::WallpaperHost> wallpaper_;
ConnectionHolder<mojom::WebApkInstance> webapk_;
DISALLOW_COPY_AND_ASSIGN(ArcBridgeService);
};

} // namespace arc
Expand Down
5 changes: 3 additions & 2 deletions components/arc/session/arc_data_remover_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class ArcDataRemoverTest : public testing::Test {
public:
ArcDataRemoverTest() = default;

ArcDataRemoverTest(const ArcDataRemoverTest&) = delete;
ArcDataRemoverTest& operator=(const ArcDataRemoverTest&) = delete;

void SetUp() override {
chromeos::DBusThreadManager::Initialize();
test_upstart_client_ = std::make_unique<TestUpstartClient>();
Expand All @@ -76,8 +79,6 @@ class ArcDataRemoverTest : public testing::Test {
const cryptohome::Identification cryptohome_id_{EmptyAccountId()};
base::test::TaskEnvironment task_environment_;
std::unique_ptr<TestUpstartClient> test_upstart_client_;

DISALLOW_COPY_AND_ASSIGN(ArcDataRemoverTest);
};

TEST_F(ArcDataRemoverTest, NotScheduled) {
Expand Down
6 changes: 3 additions & 3 deletions components/arc/session/arc_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ class ArcSession {
AdbSideloadingAvailabilityDelegate*
adb_sideloading_availability_delegate);

ArcSession(const ArcSession&) = delete;
ArcSession& operator=(const ArcSession&) = delete;

virtual ~ArcSession();

// Sends D-Bus message to start a mini-container.
Expand Down Expand Up @@ -113,9 +116,6 @@ class ArcSession {
ArcSession();

base::ObserverList<Observer>::Unchecked observer_list_;

private:
DISALLOW_COPY_AND_ASSIGN(ArcSession);
};

} // namespace arc
Expand Down
5 changes: 3 additions & 2 deletions components/arc/session/arc_session_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ class FakeDelegate : public ArcSessionImpl::Delegate {
public:
FakeDelegate() = default;

FakeDelegate(const FakeDelegate&) = delete;
FakeDelegate& operator=(const FakeDelegate&) = delete;

// Emulates to fail Mojo connection establishing. |callback| passed to
// ConnectMojo will be called with nullptr.
void EmulateMojoConnectionFailure() { success_ = false; }
Expand Down Expand Up @@ -200,8 +203,6 @@ class FakeDelegate : public ArcSessionImpl::Delegate {
bool suspend_ = false;
int64_t free_disk_space_ = kMinimumFreeDiskSpaceBytes * 2;
ConnectMojoCallback pending_callback_;

DISALLOW_COPY_AND_ASSIGN(FakeDelegate);
};

class TestArcSessionObserver : public ArcSession::Observer {
Expand Down
6 changes: 4 additions & 2 deletions components/arc/session/arc_session_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ class ArcSessionRunner : public ArcSession::Observer {
base::RepeatingCallback<std::unique_ptr<ArcSession>()>;

explicit ArcSessionRunner(const ArcSessionFactory& factory);

ArcSessionRunner(const ArcSessionRunner&) = delete;
ArcSessionRunner& operator=(const ArcSessionRunner&) = delete;

~ArcSessionRunner() override;

// Add/Remove an observer.
Expand Down Expand Up @@ -183,8 +187,6 @@ class ArcSessionRunner : public ArcSession::Observer {

// WeakPtrFactory to use callbacks.
base::WeakPtrFactory<ArcSessionRunner> weak_ptr_factory_{this};

DISALLOW_COPY_AND_ASSIGN(ArcSessionRunner);
};

} // namespace arc
Expand Down
10 changes: 6 additions & 4 deletions components/arc/session/arc_session_runner_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ class ArcSessionRunnerTest : public testing::Test,
ArcSessionRunnerTest()
: task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {}

ArcSessionRunnerTest(const ArcSessionRunnerTest&) = delete;
ArcSessionRunnerTest& operator=(const ArcSessionRunnerTest&) = delete;

void SetUp() override {
chromeos::SessionManagerClient::InitializeFakeInMemory();

Expand Down Expand Up @@ -137,8 +140,6 @@ class ArcSessionRunnerTest : public testing::Test,
bool restarting_called_;
std::unique_ptr<ArcSessionRunner> arc_session_runner_;
base::test::TaskEnvironment task_environment_;

DISALLOW_COPY_AND_ASSIGN(ArcSessionRunnerTest);
};

// Exercises the basic functionality of the ArcSessionRunner. Observer should
Expand All @@ -148,6 +149,9 @@ TEST_F(ArcSessionRunnerTest, Basic) {
public:
Observer() = default;

Observer(const Observer&) = delete;
Observer& operator=(const Observer&) = delete;

bool stopped_called() const { return stopped_called_; }

// ArcSessionRunner::Observer:
Expand All @@ -158,8 +162,6 @@ TEST_F(ArcSessionRunnerTest, Basic) {

private:
bool stopped_called_ = false;

DISALLOW_COPY_AND_ASSIGN(Observer);
};

arc_session_runner()->ResumeRunner();
Expand Down
10 changes: 6 additions & 4 deletions components/arc/session/arc_start_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,15 @@ struct StartParams {
};

StartParams();
~StartParams();

StartParams(const StartParams&) = delete;
StartParams& operator=(const StartParams&) = delete;

StartParams(StartParams&& other);
StartParams& operator=(StartParams&& other);

~StartParams();

bool native_bridge_experiment = false;
int lcd_density = -1;

Expand Down Expand Up @@ -94,9 +99,6 @@ struct StartParams {

// Flag to enable notification refresh.
bool enable_notifications_refresh = false;

private:
DISALLOW_COPY_AND_ASSIGN(StartParams);
};

} // namespace arc
Expand Down
15 changes: 9 additions & 6 deletions components/arc/session/connection_holder.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ class ConnectionHolderImpl {
explicit ConnectionHolderImpl(ConnectionNotifier* connection_notifier)
: connection_notifier_(connection_notifier) {}

ConnectionHolderImpl(const ConnectionHolderImpl&) = delete;
ConnectionHolderImpl& operator=(const ConnectionHolderImpl&) = delete;

InstanceType* instance() { return IsConnected() ? instance_ : nullptr; }
uint32_t instance_version() const {
return IsConnected() ? instance_version_ : 0;
Expand Down Expand Up @@ -172,8 +175,6 @@ class ConnectionHolderImpl {
std::unique_ptr<mojo::Receiver<HostType>> receiver_;

base::WeakPtrFactory<ConnectionHolderImpl> weak_ptr_factory_{this};

DISALLOW_COPY_AND_ASSIGN(ConnectionHolderImpl);
};

// Single direction Mojo connection holder implementation.
Expand All @@ -190,6 +191,9 @@ class ConnectionHolderImpl<InstanceType, void> {
explicit ConnectionHolderImpl(ConnectionNotifier* connection_notifier)
: connection_notifier_(connection_notifier) {}

ConnectionHolderImpl(const ConnectionHolderImpl&) = delete;
ConnectionHolderImpl& operator=(const ConnectionHolderImpl&) = delete;

InstanceType* instance() { return instance_; }
uint32_t instance_version() const { return instance_version_; }

Expand Down Expand Up @@ -237,8 +241,6 @@ class ConnectionHolderImpl<InstanceType, void> {
ConnectionNotifier* const connection_notifier_;
InstanceType* instance_ = nullptr;
uint32_t instance_version_ = 0;

DISALLOW_COPY_AND_ASSIGN(ConnectionHolderImpl);
};

} // namespace internal
Expand All @@ -260,6 +262,9 @@ class ConnectionHolder {

ConnectionHolder() = default;

ConnectionHolder(const ConnectionHolder&) = delete;
ConnectionHolder& operator=(const ConnectionHolder&) = delete;

// Returns instance version if instance is connected or 0 otherwise.
// This method is not intended to be used directly. Instead, prefer to use
// ARC_GET_INSTANCE_FOR_METHOD() with the expected version and check if it
Expand Down Expand Up @@ -337,8 +342,6 @@ class ConnectionHolder {
internal::ConnectionNotifier connection_notifier_;
internal::ConnectionHolderImpl<InstanceType, HostType> impl_{
&connection_notifier_};

DISALLOW_COPY_AND_ASSIGN(ConnectionHolder);
};

} // namespace arc
Expand Down
6 changes: 4 additions & 2 deletions components/arc/test/fake_app_instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ class FakeAppInstance : public mojom::AppInstance {
};

explicit FakeAppInstance(mojom::AppHost* app_host);

FakeAppInstance(const FakeAppInstance&) = delete;
FakeAppInstance& operator=(const FakeAppInstance&) = delete;

~FakeAppInstance() override;

// mojom::AppInstance overrides:
Expand Down Expand Up @@ -316,8 +320,6 @@ class FakeAppInstance : public mojom::AppInstance {
// Keeps the binding alive so that calls to this class can be correctly
// routed.
mojo::Remote<mojom::AppHost> host_remote_;

DISALLOW_COPY_AND_ASSIGN(FakeAppInstance);
};

} // namespace arc
Expand Down
Loading

0 comments on commit 9f667c3

Please sign in to comment.