0

components: default the user-defined empty ctor and dtor where possible

I need an owner's approval please for changes under:
['components/favicon', 'components/favicon_base', 'components/query_parser', 'components/sessions', 'components/visitedlink']

This is a mechanical change. There are a few instances (but not all)
of empty user-defined constructors and destructors which can be
defaulted in the /components code.

This CL was uploaded by git cl split.

R=sky@chromium.org

Bug: 371316188
Change-Id: If2b363c364d8437b6a65434bacc49a73a033152f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5918669
Auto-Submit: Sorin Jianu <sorin@chromium.org>
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1366386}
This commit is contained in:
Sorin Jianu
2024-10-09 19:46:41 +00:00
committed by Chromium LUCI CQ
parent 8908fa0a96
commit 592d5754fa
32 changed files with 54 additions and 53 deletions

@ -18,12 +18,12 @@ namespace favicon {
// e.g. Chrome.
class FaviconClient {
public:
FaviconClient() {}
FaviconClient() = default;
FaviconClient(const FaviconClient&) = delete;
FaviconClient& operator=(const FaviconClient&) = delete;
virtual ~FaviconClient() {}
virtual ~FaviconClient() = default;
// Returns true if the specified URL is a native application page URL.
// If this returns true the favicon for the page must be fetched using

@ -34,12 +34,12 @@ class FaviconDriverObserver {
TOUCH_LARGEST
};
FaviconDriverObserver() {}
FaviconDriverObserver() = default;
FaviconDriverObserver(const FaviconDriverObserver&) = delete;
FaviconDriverObserver& operator=(const FaviconDriverObserver&) = delete;
virtual ~FaviconDriverObserver() {}
virtual ~FaviconDriverObserver() = default;
// Called when either:
// 1) Chrome determines the best icon for the page for

@ -51,7 +51,7 @@ FaviconServiceImpl::FaviconServiceImpl(
CHECK(history_service_);
}
FaviconServiceImpl::~FaviconServiceImpl() {}
FaviconServiceImpl::~FaviconServiceImpl() = default;
base::CancelableTaskTracker::TaskId FaviconServiceImpl::GetFaviconImage(
const GURL& icon_url,

@ -70,7 +70,8 @@ HistoryUiFaviconRequestHandlerImpl::HistoryUiFaviconRequestHandlerImpl(
DCHECK(large_icon_service);
}
HistoryUiFaviconRequestHandlerImpl::~HistoryUiFaviconRequestHandlerImpl() {}
HistoryUiFaviconRequestHandlerImpl::~HistoryUiFaviconRequestHandlerImpl() =
default;
void HistoryUiFaviconRequestHandlerImpl::GetRawFaviconForPageURL(
const GURL& page_url,

@ -178,7 +178,7 @@ class LargeIconService : public KeyedService {
// postpones the automatic eviction of the favicon from the database.
virtual void TouchIconFromGoogleServer(const GURL& icon_url) = 0;
protected:
LargeIconService() {}
LargeIconService() = default;
};
} // namespace favicon

@ -192,7 +192,7 @@ LargeIconServiceImpl::LargeIconServiceImpl(
// a DCHECK(image_fetcher_) here.
}
LargeIconServiceImpl::~LargeIconServiceImpl() {}
LargeIconServiceImpl::~LargeIconServiceImpl() = default;
base::CancelableTaskTracker::TaskId
LargeIconServiceImpl::GetLargeIconRawBitmapOrFallbackStyleForPageUrl(

@ -109,7 +109,7 @@ class LargeIconServiceTest : public testing::Test {
LargeIconServiceTest(const LargeIconServiceTest&) = delete;
LargeIconServiceTest& operator=(const LargeIconServiceTest&) = delete;
~LargeIconServiceTest() override {}
~LargeIconServiceTest() override = default;
protected:
base::test::TaskEnvironment task_environment_;
@ -438,7 +438,7 @@ class LargeIconServiceGetterTest : public LargeIconServiceTest,
LargeIconServiceGetterTest& operator=(const LargeIconServiceGetterTest&) =
delete;
~LargeIconServiceGetterTest() override {}
~LargeIconServiceGetterTest() override = default;
void ExpectFetchImageFromGoogleServer() {
EXPECT_CALL(*mock_image_fetcher_,

@ -11,9 +11,9 @@ namespace favicon_base {
// ---------------------------------------------------------
// FaviconImageResult
FaviconImageResult::FaviconImageResult() {}
FaviconImageResult::FaviconImageResult() = default;
FaviconImageResult::~FaviconImageResult() {}
FaviconImageResult::~FaviconImageResult() = default;
// --------------------------------------------------------
// FaviconRawBitmapResult
@ -24,7 +24,7 @@ FaviconRawBitmapResult::FaviconRawBitmapResult()
FaviconRawBitmapResult::FaviconRawBitmapResult(
const FaviconRawBitmapResult& other) = default;
FaviconRawBitmapResult::~FaviconRawBitmapResult() {}
FaviconRawBitmapResult::~FaviconRawBitmapResult() = default;
// --------------------------------------------------------
// LargeIconResult
@ -35,7 +35,7 @@ LargeIconResult::LargeIconResult(const FaviconRawBitmapResult& bitmap_in)
LargeIconResult::LargeIconResult(FallbackIconStyle* fallback_icon_style_in)
: fallback_icon_style(fallback_icon_style_in) {}
LargeIconResult::~LargeIconResult() {}
LargeIconResult::~LargeIconResult() = default;
LargeIconResult::LargeIconResult(LargeIconResult&& result) = default;
@ -50,6 +50,6 @@ LargeIconImageResult::LargeIconImageResult(
FallbackIconStyle* fallback_icon_style_in)
: fallback_icon_style(fallback_icon_style_in) {}
LargeIconImageResult::~LargeIconImageResult() {}
LargeIconImageResult::~LargeIconImageResult() = default;
} // namespace favicon_base

@ -173,12 +173,12 @@ SkBitmap GetResizedBitmap(const SkBitmap& source_bitmap,
class FaviconImageSource : public gfx::ImageSkiaSource {
public:
FaviconImageSource() {}
FaviconImageSource() = default;
FaviconImageSource(const FaviconImageSource&) = delete;
FaviconImageSource& operator=(const FaviconImageSource&) = delete;
~FaviconImageSource() override {}
~FaviconImageSource() override = default;
// gfx::ImageSkiaSource:
gfx::ImageSkiaRep GetImageForScale(float scale) override {

@ -100,7 +100,7 @@ QueryNodeWord::QueryNodeWord(const std::u16string& word,
MatchingAlgorithm matching_algorithm)
: word_(word), literal_(false), matching_algorithm_(matching_algorithm) {}
QueryNodeWord::~QueryNodeWord() {}
QueryNodeWord::~QueryNodeWord() = default;
int QueryNodeWord::AppendToSQLiteQuery(std::u16string* query) const {
query->append(word_);
@ -180,7 +180,7 @@ class QueryNodeList : public QueryNode {
QueryNodeVector children_;
};
QueryNodeList::QueryNodeList() {}
QueryNodeList::QueryNodeList() = default;
QueryNodeList::~QueryNodeList() {
}
@ -266,9 +266,9 @@ class QueryNodePhrase : public QueryNodeList {
const QueryWord** last_word) const;
};
QueryNodePhrase::QueryNodePhrase() {}
QueryNodePhrase::QueryNodePhrase() = default;
QueryNodePhrase::~QueryNodePhrase() {}
QueryNodePhrase::~QueryNodePhrase() = default;
int QueryNodePhrase::AppendToSQLiteQuery(std::u16string* query) const {
query->push_back(L'"');

@ -42,7 +42,7 @@ using QueryWordVector = std::vector<query_parser::QueryWord>;
// really isn't meant for external usage.
class QueryNode {
public:
virtual ~QueryNode() {}
virtual ~QueryNode() = default;
// Serialize ourselves out to a string that can be passed to SQLite. Returns
// the number of words in this node.

@ -31,7 +31,7 @@ ContentLiveTab* ContentLiveTab::GetForWebContents(
ContentLiveTab::ContentLiveTab(content::WebContents* contents)
: web_contents_(contents) {}
ContentLiveTab::~ContentLiveTab() {}
ContentLiveTab::~ContentLiveTab() = default;
bool ContentLiveTab::IsInitialBlankNavigation() {
return navigation_controller().IsInitialBlankNavigation();

@ -48,7 +48,7 @@ class TestExtendedInfoHandler : public ExtendedInfoHandler {
TestExtendedInfoHandler(const TestExtendedInfoHandler&) = delete;
TestExtendedInfoHandler& operator=(const TestExtendedInfoHandler&) = delete;
~TestExtendedInfoHandler() override {}
~TestExtendedInfoHandler() override = default;
// ExtendedInfoHandler:
std::string GetExtendedInfo(content::NavigationEntry* entry) const override {
@ -111,14 +111,14 @@ void SetExtendedInfoForTest(content::NavigationEntry* entry) {
class ContentSerializedNavigationBuilderTest : public testing::Test {
public:
ContentSerializedNavigationBuilderTest() {}
ContentSerializedNavigationBuilderTest() = default;
ContentSerializedNavigationBuilderTest(
const ContentSerializedNavigationBuilderTest&) = delete;
ContentSerializedNavigationBuilderTest& operator=(
const ContentSerializedNavigationBuilderTest&) = delete;
~ContentSerializedNavigationBuilderTest() override {}
~ContentSerializedNavigationBuilderTest() override = default;
void SetUp() override {
ContentSerializedNavigationDriver* driver =

@ -22,8 +22,8 @@ namespace sessions {
// Chrome.
class SESSIONS_EXPORT ExtendedInfoHandler {
public:
ExtendedInfoHandler() {}
virtual ~ExtendedInfoHandler() {}
ExtendedInfoHandler() = default;
virtual ~ExtendedInfoHandler() = default;
// Returns the data to write to disk for the specified NavigationEntry.
virtual std::string GetExtendedInfo(

@ -11,12 +11,12 @@
namespace sessions {
const char kTaskIdKey[] = "task_id_data";
NavigationTaskId::NavigationTaskId() {}
NavigationTaskId::NavigationTaskId() = default;
NavigationTaskId::NavigationTaskId(const NavigationTaskId& navigation_task_id) =
default;
NavigationTaskId::~NavigationTaskId() {}
NavigationTaskId::~NavigationTaskId() = default;
NavigationTaskId* NavigationTaskId::Get(content::NavigationEntry* entry) {
NavigationTaskId* navigation_task_id =

@ -12,12 +12,12 @@ namespace sessions {
class NavigationTaskIDTest : public testing::Test {
public:
NavigationTaskIDTest() {}
NavigationTaskIDTest() = default;
NavigationTaskIDTest(const NavigationTaskIDTest&) = delete;
NavigationTaskIDTest& operator=(const NavigationTaskIDTest&) = delete;
~NavigationTaskIDTest() override {}
~NavigationTaskIDTest() override = default;
void SetUp() override {
navigation_entry_ = content::NavigationEntry::Create();

@ -15,7 +15,7 @@ namespace sessions {
// chrome/content dependencies.
class CommandStorageManagerDelegate {
public:
CommandStorageManagerDelegate() {}
CommandStorageManagerDelegate() = default;
// Returns true if save operations can be performed as a delayed task - which
// is usually only used by unit tests.
@ -34,7 +34,7 @@ class CommandStorageManagerDelegate {
virtual void OnErrorWritingSessionCommands() = 0;
protected:
virtual ~CommandStorageManagerDelegate() {}
virtual ~CommandStorageManagerDelegate() = default;
};
} // namespace sessions

@ -6,7 +6,7 @@
namespace sessions {
LiveTab::~LiveTab() {}
LiveTab::~LiveTab() = default;
std::unique_ptr<tab_restore::PlatformSpecificTabData>
LiveTab::GetPlatformSpecificTabData() {

@ -87,7 +87,7 @@ class SESSIONS_EXPORT LiveTabContext {
virtual void CloseTab() = 0;
protected:
virtual ~LiveTabContext() {}
virtual ~LiveTabContext() = default;
};
} // namespace sessions

@ -38,7 +38,7 @@ class SESSIONS_EXPORT SerializedNavigationDriver {
const std::string& page_state) const = 0;
protected:
virtual ~SerializedNavigationDriver() {}
virtual ~SerializedNavigationDriver() = default;
};
} // namespace sessions

@ -96,7 +96,7 @@ SessionIdGenerator::SessionIdGenerator()
last_value_(0),
rand_generator_(base::BindRepeating(&DefaultRandGenerator)) {}
SessionIdGenerator::~SessionIdGenerator() {}
SessionIdGenerator::~SessionIdGenerator() = default;
void SessionIdGenerator::IncrementValueBy(int increment) {
DCHECK_LT(0, increment);

@ -28,7 +28,7 @@ SessionTab::~SessionTab() {
SessionTabGroup::SessionTabGroup(const tab_groups::TabGroupId& id) : id(id) {}
SessionTabGroup::~SessionTabGroup() {}
SessionTabGroup::~SessionTabGroup() = default;
// SessionWindow ---------------------------------------------------------------
@ -40,6 +40,6 @@ SessionWindow::SessionWindow()
is_constrained(true),
show_state(ui::mojom::WindowShowState::kDefault) {}
SessionWindow::~SessionWindow() {}
SessionWindow::~SessionWindow() = default;
} // namespace sessions

@ -6,7 +6,7 @@
namespace sessions {
TabRestoreServiceClient::~TabRestoreServiceClient() {}
TabRestoreServiceClient::~TabRestoreServiceClient() = default;
void TabRestoreServiceClient::OnTabRestored(const GURL& url) {}

@ -26,7 +26,7 @@ class SESSIONS_EXPORT TabRestoreServiceObserver {
virtual void TabRestoreServiceLoaded(TabRestoreService* service) {}
protected:
virtual ~TabRestoreServiceObserver() {}
virtual ~TabRestoreServiceObserver() = default;
};
} // namespace sessions

@ -7,6 +7,6 @@
namespace sessions {
IOSLiveTab::~IOSLiveTab() {}
IOSLiveTab::~IOSLiveTab() = default;
} // namespace sessions

@ -11,7 +11,7 @@ namespace sessions {
RestoreIOSLiveTab::RestoreIOSLiveTab(web::proto::NavigationStorage storage)
: storage_(std::move(storage)) {}
RestoreIOSLiveTab::~RestoreIOSLiveTab() {}
RestoreIOSLiveTab::~RestoreIOSLiveTab() = default;
bool RestoreIOSLiveTab::IsInitialBlankNavigation() {
return false;

@ -28,7 +28,7 @@ IOSWebStateLiveTab* IOSWebStateLiveTab::GetForWebState(
IOSWebStateLiveTab::IOSWebStateLiveTab(web::WebState* web_state)
: web_state_(web_state) {}
IOSWebStateLiveTab::~IOSWebStateLiveTab() {}
IOSWebStateLiveTab::~IOSWebStateLiveTab() = default;
bool IOSWebStateLiveTab::IsInitialBlankNavigation() {
return navigation_manager()->GetItemCount() == 0;

@ -42,7 +42,7 @@ class PartitionedVisitedLinkWriter : public VisitedLinkCommon {
// event as a constructor argument and dispatches events using it.
class Listener {
public:
virtual ~Listener() {}
virtual ~Listener() = default;
// Called when link coloring database has been created or replaced. The
// argument is a memory region containing the new table.
@ -102,7 +102,7 @@ class PartitionedVisitedLinkWriter : public VisitedLinkCommon {
virtual bool HasNextVisitedLink() const = 0;
protected:
virtual ~VisitedLinkIterator() {}
virtual ~VisitedLinkIterator() = default;
};
// Deletes the specified VisitedLinks from the hashtable.

@ -34,7 +34,7 @@ class VisitedLinkDelegate {
virtual void OnComplete(bool success) = 0;
protected:
virtual ~URLEnumerator() {}
virtual ~URLEnumerator() = default;
private:
friend class base::RefCountedThreadSafe<URLEnumerator>;
@ -76,7 +76,7 @@ class VisitedLinkDelegate {
const scoped_refptr<VisitedLinkEnumerator>& enumerator) = 0;
protected:
virtual ~VisitedLinkDelegate() {}
virtual ~VisitedLinkDelegate() = default;
};
} // namespace visitedlink

@ -219,7 +219,7 @@ class VisitedLinkWriter::TableBuilder
void OnComplete(bool succeed) override;
private:
~TableBuilder() override {}
~TableBuilder() override = default;
// OnComplete mashals to this function on the main thread to do the
// notification.

@ -63,7 +63,7 @@ class VisitedLinkWriter : public VisitedLinkCommon {
// event as a constructor argument and dispatches events using it.
class Listener {
public:
virtual ~Listener() {}
virtual ~Listener() = default;
// Called when link coloring database has been created or replaced. The
// argument is a memory region containing the new table.
@ -140,7 +140,7 @@ class VisitedLinkWriter : public VisitedLinkCommon {
virtual bool HasNextURL() const = 0;
protected:
virtual ~URLIterator() {}
virtual ~URLIterator() = default;
};
// Deletes the specified URLs from |rows| from the table.

@ -100,7 +100,7 @@ GURL TestURL(const char* prefix, int i) {
// We have no readers, so all methods on this listener are a no-ops.
class DummyVisitedLinkEventListener : public VisitedLinkWriter::Listener {
public:
DummyVisitedLinkEventListener() {}
DummyVisitedLinkEventListener() = default;
void NewTable(base::ReadOnlySharedMemoryRegion*) override {}
void Add(VisitedLinkCommon::Fingerprint) override {}
void Reset(bool invalidate_hashes) override {}