Modernize equality operators in //services
This CL is pure clean-up and contains no functionality changes. Depending on the files covered in the CL (since the CL was generated using git cl split), it does a subset of the following: the following: - Remove unneeded operator!= declarations/definitions since C++20 can automatically derive those from operator==. - Default operator== where this is equivalent to the current behavior. - Default operator<=> where this is equivalent to the current behavior. This CL was uploaded by git cl split. R=steimel@chromium.org Bug: 40256175 Change-Id: Ice095859dc878a0e2c6b78b9d40274f5a9fabe4a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6540427 Reviewed-by: Tommy Steimel <steimel@chromium.org> Auto-Submit: Jan Keitel <jkeitel@google.com> Commit-Queue: Tommy Steimel <steimel@chromium.org> Cr-Commit-Position: refs/heads/main@{#1459507}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
422804e898
commit
b46b9733cf
services/media_session/public/cpp
@ -15,16 +15,6 @@ MediaMetadata::~MediaMetadata() = default;
|
||||
|
||||
MediaMetadata::MediaMetadata(const MediaMetadata& other) = default;
|
||||
|
||||
bool MediaMetadata::operator==(const MediaMetadata& other) const {
|
||||
return title == other.title && artist == other.artist &&
|
||||
album == other.album && source_title == other.source_title &&
|
||||
chapters == other.chapters;
|
||||
}
|
||||
|
||||
bool MediaMetadata::operator!=(const MediaMetadata& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
bool MediaMetadata::IsEmpty() const {
|
||||
return title.empty() && artist.empty() && album.empty() &&
|
||||
source_title.empty() && chapters.empty();
|
||||
|
@ -31,8 +31,7 @@ struct COMPONENT_EXPORT(MEDIA_SESSION_BASE_CPP) MediaMetadata {
|
||||
|
||||
MediaMetadata(const MediaMetadata& other);
|
||||
|
||||
bool operator==(const MediaMetadata& other) const;
|
||||
bool operator!=(const MediaMetadata& other) const;
|
||||
friend bool operator==(const MediaMetadata&, const MediaMetadata&) = default;
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// Creates a Java MediaMetadata instance and returns the JNI ref.
|
||||
|
@ -79,10 +79,6 @@ bool MediaPosition::operator==(const MediaPosition& other) const {
|
||||
return GetPositionAtTime(now) == other.GetPositionAtTime(now);
|
||||
}
|
||||
|
||||
bool MediaPosition::operator!=(const MediaPosition& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
std::string MediaPosition::ToString() const {
|
||||
return base::StringPrintf(
|
||||
"playback_rate=%f duration=%f current_time=%f end_of_media=%s",
|
||||
|
@ -76,7 +76,6 @@ struct COMPONENT_EXPORT(MEDIA_SESSION_BASE_CPP) MediaPosition {
|
||||
base::TimeDelta GetPositionAtTime(base::TimeTicks time) const;
|
||||
|
||||
bool operator==(const MediaPosition&) const;
|
||||
bool operator!=(const MediaPosition&) const;
|
||||
|
||||
std::string ToString() const;
|
||||
|
||||
|
Reference in New Issue
Block a user