Replace DISALLOW_COPY_AND_ASSIGN in chrome/
This replaces DISALLOW_COPY_AND_ASSIGN with explicit constructor deletes
where a local script is able to detect its insertion place (~Foo() is
public => insert before this line).
This is incomplete as not all classes have a public ~Foo() declared, so
not all DISALLOW_COPY_AND_ASSIGN occurrences are replaced.
IWYU cleanup is left as a separate pass that is easier when these macros
go away.
Bug: 1010217
Change-Id: I882202fb6295332b52c34ba12fae4705276b0b5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3165772
Auto-Submit: Peter Boström <[email protected]>
Commit-Queue: Daniel Cheng <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Owners-Override: Daniel Cheng <[email protected]>
Cr-Commit-Position: refs/heads/main@{#922479}
diff --git a/chrome/browser/push_messaging/budget_database.h b/chrome/browser/push_messaging/budget_database.h
index 3bbc9631..3af2cc3a 100644
--- a/chrome/browser/push_messaging/budget_database.h
+++ b/chrome/browser/push_messaging/budget_database.h
@@ -62,6 +62,10 @@
// The database_dir specifies the location of the budget information on disk.
explicit BudgetDatabase(Profile* profile);
+
+ BudgetDatabase(const BudgetDatabase&) = delete;
+ BudgetDatabase& operator=(const BudgetDatabase&) = delete;
+
~BudgetDatabase();
// Get the full budget expectation for the origin. This will return a
@@ -170,8 +174,6 @@
std::unique_ptr<base::Clock> clock_;
base::WeakPtrFactory<BudgetDatabase> weak_ptr_factory_{this};
-
- DISALLOW_COPY_AND_ASSIGN(BudgetDatabase);
};
#endif // CHROME_BROWSER_PUSH_MESSAGING_BUDGET_DATABASE_H_
diff --git a/chrome/browser/push_messaging/push_messaging_notification_manager.h b/chrome/browser/push_messaging/push_messaging_notification_manager.h
index 7f7de31..a872249 100644
--- a/chrome/browser/push_messaging/push_messaging_notification_manager.h
+++ b/chrome/browser/push_messaging/push_messaging_notification_manager.h
@@ -45,6 +45,12 @@
base::OnceCallback<void(bool did_show_generic_notification)>;
explicit PushMessagingNotificationManager(Profile* profile);
+
+ PushMessagingNotificationManager(const PushMessagingNotificationManager&) =
+ delete;
+ PushMessagingNotificationManager& operator=(
+ const PushMessagingNotificationManager&) = delete;
+
~PushMessagingNotificationManager();
// Enforces the requirements implied for push subscriptions which must display
@@ -111,8 +117,6 @@
#endif
base::WeakPtrFactory<PushMessagingNotificationManager> weak_factory_{this};
-
- DISALLOW_COPY_AND_ASSIGN(PushMessagingNotificationManager);
};
#endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_NOTIFICATION_MANAGER_H_
diff --git a/chrome/browser/push_messaging/push_messaging_refresher.h b/chrome/browser/push_messaging/push_messaging_refresher.h
index f0675930..c049a14 100644
--- a/chrome/browser/push_messaging/push_messaging_refresher.h
+++ b/chrome/browser/push_messaging/push_messaging_refresher.h
@@ -24,6 +24,10 @@
class PushMessagingRefresher {
public:
PushMessagingRefresher();
+
+ PushMessagingRefresher(const PushMessagingRefresher&) = delete;
+ PushMessagingRefresher& operator=(const PushMessagingRefresher&) = delete;
+
~PushMessagingRefresher();
// Return number of objects that are currently being refreshed
@@ -90,7 +94,6 @@
RefreshMap refresh_map_;
base::WeakPtrFactory<PushMessagingRefresher> weak_factory_{this};
- DISALLOW_COPY_AND_ASSIGN(PushMessagingRefresher);
};
#endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_REFRESHER_H_
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.h b/chrome/browser/push_messaging/push_messaging_service_impl.h
index 96f9d0a..b3eb71f7 100644
--- a/chrome/browser/push_messaging/push_messaging_service_impl.h
+++ b/chrome/browser/push_messaging/push_messaging_service_impl.h
@@ -91,6 +91,10 @@
static void InitializeForProfile(Profile* profile);
explicit PushMessagingServiceImpl(Profile* profile);
+
+ PushMessagingServiceImpl(const PushMessagingServiceImpl&) = delete;
+ PushMessagingServiceImpl& operator=(const PushMessagingServiceImpl&) = delete;
+
~PushMessagingServiceImpl() override;
// Check and remove subscriptions that are expired when |this| is initialized
@@ -466,8 +470,6 @@
bool shutdown_started_ = false;
base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_{this};
-
- DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl);
};
#endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_
diff --git a/chrome/browser/push_messaging/push_messaging_service_unittest.cc b/chrome/browser/push_messaging/push_messaging_service_unittest.cc
index 977b4472..f7e9fc4 100644
--- a/chrome/browser/push_messaging/push_messaging_service_unittest.cc
+++ b/chrome/browser/push_messaging/push_messaging_service_unittest.cc
@@ -74,6 +74,11 @@
class PushMessagingTestingProfile : public TestingProfile {
public:
PushMessagingTestingProfile() = default;
+
+ PushMessagingTestingProfile(const PushMessagingTestingProfile&) = delete;
+ PushMessagingTestingProfile& operator=(const PushMessagingTestingProfile&) =
+ delete;
+
~PushMessagingTestingProfile() override = default;
PushMessagingServiceImpl* GetPushMessagingService() override {
@@ -83,9 +88,6 @@
permissions::PermissionManager* GetPermissionControllerDelegate() override {
return PermissionManagerFactory::GetForProfile(this);
}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PushMessagingTestingProfile);
};
std::unique_ptr<KeyedService> BuildFakeGCMProfileService(