0

Fix defaulted comparisons to follow best practices/style guide

I wrote these somewhat incorrectly in https://crrev.com/c/6175640.

See https://docs.google.com/presentation/d/13VxKq7L-vY4mPVnK7NMMEMjfAuoDfj3SFcZbW01z3HM/edit#slide=id.g3290701ab79_0_44

Change-Id: Ie3a0e678ac2cbb29845abd0a2dc4e17c5037bd72
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6309755
Reviewed-by: Charlie Harrison <csharrison@chromium.org>
Commit-Queue: Maks Orlovich <morlovich@chromium.org>
Auto-Submit: Chris Fredrickson <cfredric@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1425830}
This commit is contained in:
Chris Fredrickson
2025-02-27 10:14:25 -08:00
committed by Chromium LUCI CQ
parent 118c32492c
commit 1be15a12a9
5 changed files with 14 additions and 11 deletions

@ -149,7 +149,10 @@ class NET_EXPORT SchemefulSite {
// See base/trace_event/memory_usage_estimator.h for more info.
size_t EstimateMemoryUsage() const;
std::strong_ordering operator<=>(const SchemefulSite& other) const = default;
friend bool operator==(const SchemefulSite& left,
const SchemefulSite& right) = default;
friend auto operator<=>(const SchemefulSite& left,
const SchemefulSite& right) = default;
private:
// IPC serialization code needs to access internal origin.

@ -64,8 +64,10 @@ class NET_EXPORT UniqueCookieKey {
~UniqueCookieKey();
std::strong_ordering operator<=>(const UniqueCookieKey& other) const =
default;
friend bool operator==(const UniqueCookieKey& left,
const UniqueCookieKey& right) = default;
friend auto operator<=>(const UniqueCookieKey& left,
const UniqueCookieKey& right) = default;
const std::string& name() const { return name_; }
const std::string& domain() const { return domain_; }

@ -282,7 +282,8 @@ class COMPONENT_EXPORT(URL) Origin {
// Allows Origin to be used as a key in STL (for example, a std::set or
// std::map).
std::strong_ordering operator<=>(const Origin& other) const = default;
friend bool operator==(const Origin& left, const Origin& right) = default;
friend auto operator<=>(const Origin& left, const Origin& right) = default;
// Creates a new opaque origin that is guaranteed to be cross-origin to all
// currently existing origins. An origin created by this method retains its

@ -269,11 +269,6 @@ size_t SchemeHostPort::EstimateMemoryUsage() const {
base::trace_event::EstimateMemoryUsage(host_);
}
bool SchemeHostPort::operator==(const SchemeHostPort& other) const = default;
std::strong_ordering SchemeHostPort::operator<=>(
const SchemeHostPort& other) const = default;
std::string SchemeHostPort::SerializeInternal(url::Parsed* parsed) const {
std::string result;
if (!IsValid())

@ -148,8 +148,10 @@ class COMPONENT_EXPORT(URL) SchemeHostPort {
// Note that this comparison is _not_ the same as an origin-based comparison.
// In particular, invalid SchemeHostPort objects match each other (and
// themselves). Opaque origins, on the other hand, would not.
bool operator==(const SchemeHostPort& other) const;
std::strong_ordering operator<=>(const SchemeHostPort& other) const;
friend bool operator==(const SchemeHostPort& left,
const SchemeHostPort& right) = default;
friend auto operator<=>(const SchemeHostPort& left,
const SchemeHostPort& right) = default;
// Whether to discard host and port information for a specific scheme.
//